Bug 4025 - package.bbclass: build lib32neard failed
Summary: package.bbclass: build lib32neard failed
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Hongxu Jia
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-03-15 08:47 UTC by Hongxu Jia
Modified: 2013-04-12 05:14 UTC (History)
9 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hongxu Jia 2013-03-15 08:47:28 UTC
*env
In conf/local.conf
MACHINE ?= "qemux86-64"
PACKAGE_CLASSES ?= "package_rpm"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
PRSERV_HOST = "localhost:10000"
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"

start PR Server `bitbake-prserv --start --port=10000'

*problem
1, run `bitbake lib32neard' failed
>error log<
...
DEBUG: Executing shell function BUILDSPEC
error: line 152: Illegal char '-' in EVR:
Suggests: neard = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
error: Package has no %description: neard-dbg.lib32_x86
...

vim neard.spec
...
Name: neard
Release: r1.2
Version: 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8
%package -n neard-dbg
Suggests: neard = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
%package -n neard-staticdev
Requires: neard-dev = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
%package -n neard-dev
Requires: neard = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
...

2, run `bitbake neard', everything is ok.
vim neard.spec
...
Name: neard
Release: r1.2
Version: 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8
%package -n neard-dbg
Requires: neard-dev = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
%package -n neard-staticdev
Requires: neard-dev = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
%package -n neard-dev
Requires: neard = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
...
While build lib32-neard, why `0.9-gitAUTOINC'? Why not `0.9+git0'?
Why `r1'? Why not `r1.2'

*analysis
1, PKGV or PRAUTO is set to support PR Service, see
package_get_auto_pr in package.bbclass for detail.

2, In meta/conf/bitbake.conf, the following variables
have relationship with PKGV and PRAUTO:
...
EXTENDPRAUTO = "${@['.${PRAUTO\x7d',''][d.getVar('PRAUTO',1) is None]}"
PKGR ?= "${PR}${EXTENDPRAUTO}"
EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}"
RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPKGV})"
RDEPENDS_${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
RRECOMMENDS_${PN}-dbg = "${PN} (= ${EXTENDPKGV})"
...
If PKGV or PRAUTO is set and the previous variable
is not assigned, the previous variables will be updated
implicity. But if they has been set, they will
not be expanded with PKGV and PRAUTO.

3, When build multilib packages (such as lib32neard),
`RDEPENDS_${PN}-dev', `RDEPENDS_${PN}-staticdev',
and `RRECOMMENDS_${PN}-dbg' have been assigned by
clsextend.map_packagevars() in multilib.bbclass, and
then PKGV or PRAUTO is set to support PR Service,
so the previous variables will not be expanded.

*solution
If multilib is enable, when PKGV or PRAUTO is set, the
previous related variables should do the same thing.

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 1625ebd..b534598 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -364,6 +364,25 @@ python package_get_auto_pr() {
         pkgv = d.getVar("PKGV", True)
         if 'AUTOINC' in pkgv:
             d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
+
+    multilibs = d.getVar('MULTILIBS', True)
+    if multilibs:
+        extendpkgv = d.getVar("EXTENDPKGV", True)
+        # RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPKGV})"
+        pkgdev_rdep_cur = "%s (= %s)" % (pn, extendpkgv)
+        if d.getVar("RDEPENDS_%s-dev" % pn, True) != pkgdev_rdep_cur:
+            d.setVar("RDEPENDS_%s-dev" % pn, pkgdev_rdep_cur)
+
+        # RDEPENDS_${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
+        pkgstaticdev_rdep_cur = "%s-dev (= %s)" % (pn, extendpkgv)
+        if d.getVar("RDEPENDS_%s-staticdev" % pn, True) != pkgstaticdev_rdep_cur:
+            d.setVar("RDEPENDS_%s-staticdev" % pn, pkgstaticdev_rdep_cur)
+
+        # RRECOMMENDS_${PN}-dbg = "${PN} (= ${EXTENDPKGV})"
+        pkgdbg_rrec_cur = "%s (= %s)" % (pn, extendpkgv)
+        if d.getVar("RRECOMMENDS_%s-dbg" % pn, True) != pkgdbg_rrec_cur:
+            d.setVar("RRECOMMENDS_%s-dbg" % pn, pkgdbg_rrec_cur)
+
 }
Comment 1 Hongxu Jia 2013-03-15 08:52:34 UTC
Sorry, The previous log about `vim neard.spec' between neard and lib32-neard should be exchange.
Comment 2 Hongxu Jia 2013-03-15 10:15:01 UTC
1, while build lib32-neard, vim neard.spec
...
Name: neard
Release: r1.2
Version: 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8
%package -n neard-dbg
Suggests: neard = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
%package -n neard-staticdev
Requires: neard-dev = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
%package -n neard-dev
Requires: neard = 0.9-gitAUTOINC+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1
...

2, while build neard, vim neard.spec
...
Name: neard
Release: r1.2
Version: 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8
%package -n neard-dbg
Requires: neard-dev = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
%package -n neard-staticdev
Requires: neard-dev = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
%package -n neard-dev
Requires: neard = 0.9+git0+7abdb13d106d496e1115fab49e6448a249dfb3c8-r1.2
...
While build lib32-neard, why `0.9-gitAUTOINC'? Why not `0.9+git0'?
Why `r1'? Why not `r1.2'
Comment 3 Hongxu Jia 2013-03-16 06:04:17 UTC
master 1ceb13dda11645229053fc4840954333f8910ba4

There is another defect when build neard:
error log
...
DEBUG: Executing shell function BUILDSPEC
error: line 148: Illegal char '-' in EVR: Suggests: neard = 0.9-git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1
error: Package has no %description: neard-dbg.x86_64
...


*analysis
Translate the "-" in the version to a "+" by loading the PKGV rather than PV.

*solution
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -607,10 +607,9 @@ python write_specfile () {
                     if '-' in ver:
                         subd = oe.packagedata.read_subpkgdata_dict(dep, d)
                         if 'PKGV' in subd:
-                            pv = subd['PV']
                             pkgv = subd['PKGV']
                             reppv = pkgv.replace('-', '+')
-                            verlist.append(ver.replace(pv, reppv))
+                            verlist.append(ver.replace(pkgv, reppv))
                     else:
                         verlist.append(ver)
                 newdeps_dict[dep] = verlist
Comment 4 Hongxu Jia 2013-03-16 10:16:08 UTC
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 1625ebd..b534598 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -364,6 +364,25 @@ python package_get_auto_pr() {
>          pkgv = d.getVar("PKGV", True)
>          if 'AUTOINC' in pkgv:
>              d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
> +
> +    multilibs = d.getVar('MULTILIBS', True)
> +    if multilibs:
> +        extendpkgv = d.getVar("EXTENDPKGV", True)
> +        # RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPKGV})"
> +        pkgdev_rdep_cur = "%s (= %s)" % (pn, extendpkgv)
> +        if d.getVar("RDEPENDS_%s-dev" % pn, True) != pkgdev_rdep_cur:
> +            d.setVar("RDEPENDS_%s-dev" % pn, pkgdev_rdep_cur)
> +
> +        # RDEPENDS_${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
> +        pkgstaticdev_rdep_cur = "%s-dev (= %s)" % (pn, extendpkgv)
> +        if d.getVar("RDEPENDS_%s-staticdev" % pn, True) !=
> pkgstaticdev_rdep_cur:
> +            d.setVar("RDEPENDS_%s-staticdev" % pn, pkgstaticdev_rdep_cur)
> +
> +        # RRECOMMENDS_${PN}-dbg = "${PN} (= ${EXTENDPKGV})"
> +        pkgdbg_rrec_cur = "%s (= %s)" % (pn, extendpkgv)
> +        if d.getVar("RRECOMMENDS_%s-dbg" % pn, True) != pkgdbg_rrec_cur:
> +            d.setVar("RRECOMMENDS_%s-dbg" % pn, pkgdbg_rrec_cur)
> +
>  }

The solution is wrong, the definition of RDEPENDS_${PN}-dev, RDEPENDS_${PN}-staticdev and RRECOMMENDS_${PN}-dbg may be changed by recipe. Such as RRECOMMENDS_${PN}-dbg has been changed in meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc. The previous will change them to default.

Here is another solution, if EXTENDPKGV is changed and the previous three variables have no change, repalce them with new EXTENDPKGV.

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index f3a6bc7..5655f48 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -347,6 +347,16 @@ python package_get_auto_pr() {
     if not (host is None):
         d.setVar("PRSERV_HOST", host)
 
+    # Back up RDEPENDS_${PN}-dev, RDEPENDS_${PN}-staticdev,
+    # RRECOMMENDS_${PN}-dbg, EXTENDPKGV before set PRAUTO and PKGV
+    pkgdev_rdep = "RDEPENDS_%s-dev" % pn
+    pkgstaticdev_rdep = "RDEPENDS_%s-staticdev" % pn
+    pkgdbg_rrec = "RRECOMMENDS_%s-dbg" % pn
+    pkgdev_rdep_value = d.getVar(pkgdev_rdep, True)
+    pkgstaticdev_rdep_value = d.getVar(pkgstaticdev_rdep, True)
+    pkgdbg_rrec_value = d.getVar(pkgdbg_rrec, True)
+    extendpkgv_old = d.getVar("EXTENDPKGV", True)
+
     if d.getVar('PRSERV_HOST', True):
         try:
             auto_pr=prserv_get_pr_auto(d)
@@ -364,6 +374,23 @@ python package_get_auto_pr() {
         pkgv = d.getVar("PKGV", True)
         if 'AUTOINC' in pkgv:
             d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
+
+    extendpkgv_new = d.getVar("EXTENDPKGV", True)
+    if extendpkgv_old != extendpkgv_new:
+        # If EXTENDPKGV is changed and RDEPENDS_${PN}-dev has no change
+        # replace RDEPENDS_${PN}-dev with new EXTENDPKGV
+        if (pkgdev_rdep_value == d.getVar(pkgdev_rdep, True)):
+            d.setVar(pkgdev_rdep, pkgdev_rdep_value.replace(extendpkgv_old, extendpkgv_new))
+
+        # If EXTENDPKGV is changed and RDEPENDS_${PN}-staticdev has no change
+        # replace RDEPENDS_${PN}-staticdev with new EXTENDPKGV
+        if (pkgstaticdev_rdep_value == d.getVar(pkgstaticdev_rdep, True)):
+            d.setVar(pkgstaticdev_rdep, pkgstaticdev_rdep_value.replace(extendpkgv_old, extendpkgv_new))
+
+        # If EXTENDPKGV is changed and RRECOMMENDS_${PN}-dbg has no change
+        # replace RRECOMMENDS_${PN}-dbg with new EXTENDPKGV
+        if (pkgdbg_rrec_value == d.getVar(pkgdbg_rrec, True)):
+            d.setVar(pkgdbg_rrec, pkgdbg_rrec_value.replace(extendpkgv_old, extendpkgv_new))
 }
 
 LOCALEBASEPN ??= "${PN}"
Comment 6 Hongxu Jia 2013-03-18 04:37:11 UTC
Verified on master:6d9a3ac0515380d0789ee3d316c08212592a6f9a
Comment 7 Ning Zhang 2013-04-12 05:14:15 UTC
Verified env:
    poky: 2a3f6772aadbe378259c87c05ab6f091866b63ef
    branch: master

Verified steps:

Modify conf/local.conf
MACHINE ?= "qemux86-64"
PACKAGE_CLASSES ?= "package_rpm"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
PRSERV_HOST = "localhost:10000"
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"

start PR Server `bitbake-prserv --start --port=10000'

run `bitbake lib32-neard'


----------build log-------------------
builder@pek-yocto-build1:/buildarea3/zn/20130411$ bitbake lib32-neard
Loading cache: 100% |###############################################################################################################################################################################| ETA:  00:00:00
Loaded 1934 entries from dependency cache.

Build Configuration:
BB_VERSION        = "1.18.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-11.10"
TARGET_SYS        = "x86_64-poky-linux"
MACHINE           = "qemux86-64"
DISTRO            = "poky"
DISTRO_VERSION    = "1.3+snapshot-20130411"
TUNE_FEATURES     = "m64"
TARGET_FPU        = ""
meta              
meta-yocto        
meta-yocto-bsp    = "master:2a3f6772aadbe378259c87c05ab6f091866b63ef"

NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 1869 tasks of which 307 didn't need to be rerun and all succeeded.