<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4025</bug_id>
          
          <creation_ts>2013-03-15 08:47:28 +0000</creation_ts>
          <short_desc>package.bbclass: build lib32neard failed</short_desc>
          <delta_ts>2013-04-12 05:14:15 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hongxu Jia">hongxu.jia</reporter>
          <assigned_to name="Hongxu Jia">hongxu.jia</assigned_to>
          <cc>hongxu.jia</cc>
    
    <cc>kai.kang</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ning.zhang</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>30732</commentid>
    <comment_count>0</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-15 08:47:28 +0000</bug_when>
    <thetext>*env
In conf/local.conf
MACHINE ?= &quot;qemux86-64&quot;
PACKAGE_CLASSES ?= &quot;package_rpm&quot;
require conf/multilib.conf
MULTILIBS = &quot;multilib:lib32&quot;
DEFAULTTUNE_virtclass-multilib-lib32 = &quot;x86&quot;
PRSERV_HOST = &quot;localhost:10000&quot;
INHERIT += &quot;buildhistory&quot;
BUILDHISTORY_COMMIT = &quot;1&quot;

start PR Server `bitbake-prserv --start --port=10000&apos;

*problem
1, run `bitbake lib32neard&apos; failed
&gt;error log&lt;
...
DEBUG: Executing shell function BUILDSPEC
error: line 152: Illegal char &apos;-&apos; 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&apos;, 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&apos;? Why not `0.9+git0&apos;?
Why `r1&apos;? Why not `r1.2&apos;

*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 = &quot;${@[&apos;.${PRAUTO\x7d&apos;,&apos;&apos;][d.getVar(&apos;PRAUTO&apos;,1) is None]}&quot;
PKGR ?= &quot;${PR}${EXTENDPRAUTO}&quot;
EXTENDPKGV ?= &quot;${EXTENDPKGEVER}${PKGV}-${PKGR}&quot;
RDEPENDS_${PN}-dev = &quot;${PN} (= ${EXTENDPKGV})&quot;
RDEPENDS_${PN}-staticdev = &quot;${PN}-dev (= ${EXTENDPKGV})&quot;
RRECOMMENDS_${PN}-dbg = &quot;${PN} (= ${EXTENDPKGV})&quot;
...
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&apos;, `RDEPENDS_${PN}-staticdev&apos;,
and `RRECOMMENDS_${PN}-dbg&apos; 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(&quot;PKGV&quot;, True)
         if &apos;AUTOINC&apos; in pkgv:
             d.setVar(&quot;PKGV&quot;, pkgv.replace(&quot;AUTOINC&quot;, &quot;0&quot;))
+
+    multilibs = d.getVar(&apos;MULTILIBS&apos;, True)
+    if multilibs:
+        extendpkgv = d.getVar(&quot;EXTENDPKGV&quot;, True)
+        # RDEPENDS_${PN}-dev = &quot;${PN} (= ${EXTENDPKGV})&quot;
+        pkgdev_rdep_cur = &quot;%s (= %s)&quot; % (pn, extendpkgv)
+        if d.getVar(&quot;RDEPENDS_%s-dev&quot; % pn, True) != pkgdev_rdep_cur:
+            d.setVar(&quot;RDEPENDS_%s-dev&quot; % pn, pkgdev_rdep_cur)
+
+        # RDEPENDS_${PN}-staticdev = &quot;${PN}-dev (= ${EXTENDPKGV})&quot;
+        pkgstaticdev_rdep_cur = &quot;%s-dev (= %s)&quot; % (pn, extendpkgv)
+        if d.getVar(&quot;RDEPENDS_%s-staticdev&quot; % pn, True) != pkgstaticdev_rdep_cur:
+            d.setVar(&quot;RDEPENDS_%s-staticdev&quot; % pn, pkgstaticdev_rdep_cur)
+
+        # RRECOMMENDS_${PN}-dbg = &quot;${PN} (= ${EXTENDPKGV})&quot;
+        pkgdbg_rrec_cur = &quot;%s (= %s)&quot; % (pn, extendpkgv)
+        if d.getVar(&quot;RRECOMMENDS_%s-dbg&quot; % pn, True) != pkgdbg_rrec_cur:
+            d.setVar(&quot;RRECOMMENDS_%s-dbg&quot; % pn, pkgdbg_rrec_cur)
+
 }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30733</commentid>
    <comment_count>1</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-15 08:52:34 +0000</bug_when>
    <thetext>Sorry, The previous log about `vim neard.spec&apos; between neard and lib32-neard should be exchange.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30749</commentid>
    <comment_count>2</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-15 10:15:01 +0000</bug_when>
    <thetext>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&apos;? Why not `0.9+git0&apos;?
Why `r1&apos;? Why not `r1.2&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30768</commentid>
    <comment_count>3</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-16 06:04:17 +0000</bug_when>
    <thetext>master 1ceb13dda11645229053fc4840954333f8910ba4

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


*analysis
Translate the &quot;-&quot; in the version to a &quot;+&quot; 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 &apos;-&apos; in ver:
                         subd = oe.packagedata.read_subpkgdata_dict(dep, d)
                         if &apos;PKGV&apos; in subd:
-                            pv = subd[&apos;PV&apos;]
                             pkgv = subd[&apos;PKGV&apos;]
                             reppv = pkgv.replace(&apos;-&apos;, &apos;+&apos;)
-                            verlist.append(ver.replace(pv, reppv))
+                            verlist.append(ver.replace(pkgv, reppv))
                     else:
                         verlist.append(ver)
                 newdeps_dict[dep] = verlist</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30772</commentid>
    <comment_count>4</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-16 10:16:08 +0000</bug_when>
    <thetext>&gt; diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
&gt; index 1625ebd..b534598 100644
&gt; --- a/meta/classes/package.bbclass
&gt; +++ b/meta/classes/package.bbclass
&gt; @@ -364,6 +364,25 @@ python package_get_auto_pr() {
&gt;          pkgv = d.getVar(&quot;PKGV&quot;, True)
&gt;          if &apos;AUTOINC&apos; in pkgv:
&gt;              d.setVar(&quot;PKGV&quot;, pkgv.replace(&quot;AUTOINC&quot;, &quot;0&quot;))
&gt; +
&gt; +    multilibs = d.getVar(&apos;MULTILIBS&apos;, True)
&gt; +    if multilibs:
&gt; +        extendpkgv = d.getVar(&quot;EXTENDPKGV&quot;, True)
&gt; +        # RDEPENDS_${PN}-dev = &quot;${PN} (= ${EXTENDPKGV})&quot;
&gt; +        pkgdev_rdep_cur = &quot;%s (= %s)&quot; % (pn, extendpkgv)
&gt; +        if d.getVar(&quot;RDEPENDS_%s-dev&quot; % pn, True) != pkgdev_rdep_cur:
&gt; +            d.setVar(&quot;RDEPENDS_%s-dev&quot; % pn, pkgdev_rdep_cur)
&gt; +
&gt; +        # RDEPENDS_${PN}-staticdev = &quot;${PN}-dev (= ${EXTENDPKGV})&quot;
&gt; +        pkgstaticdev_rdep_cur = &quot;%s-dev (= %s)&quot; % (pn, extendpkgv)
&gt; +        if d.getVar(&quot;RDEPENDS_%s-staticdev&quot; % pn, True) !=
&gt; pkgstaticdev_rdep_cur:
&gt; +            d.setVar(&quot;RDEPENDS_%s-staticdev&quot; % pn, pkgstaticdev_rdep_cur)
&gt; +
&gt; +        # RRECOMMENDS_${PN}-dbg = &quot;${PN} (= ${EXTENDPKGV})&quot;
&gt; +        pkgdbg_rrec_cur = &quot;%s (= %s)&quot; % (pn, extendpkgv)
&gt; +        if d.getVar(&quot;RRECOMMENDS_%s-dbg&quot; % pn, True) != pkgdbg_rrec_cur:
&gt; +            d.setVar(&quot;RRECOMMENDS_%s-dbg&quot; % pn, pkgdbg_rrec_cur)
&gt; +
&gt;  }

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(&quot;PRSERV_HOST&quot;, host)
 
+    # Back up RDEPENDS_${PN}-dev, RDEPENDS_${PN}-staticdev,
+    # RRECOMMENDS_${PN}-dbg, EXTENDPKGV before set PRAUTO and PKGV
+    pkgdev_rdep = &quot;RDEPENDS_%s-dev&quot; % pn
+    pkgstaticdev_rdep = &quot;RDEPENDS_%s-staticdev&quot; % pn
+    pkgdbg_rrec = &quot;RRECOMMENDS_%s-dbg&quot; % 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(&quot;EXTENDPKGV&quot;, True)
+
     if d.getVar(&apos;PRSERV_HOST&apos;, True):
         try:
             auto_pr=prserv_get_pr_auto(d)
@@ -364,6 +374,23 @@ python package_get_auto_pr() {
         pkgv = d.getVar(&quot;PKGV&quot;, True)
         if &apos;AUTOINC&apos; in pkgv:
             d.setVar(&quot;PKGV&quot;, pkgv.replace(&quot;AUTOINC&quot;, &quot;0&quot;))
+
+    extendpkgv_new = d.getVar(&quot;EXTENDPKGV&quot;, 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 ??= &quot;${PN}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30774</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2013-03-16 17:10:22 +0000</bug_when>
    <thetext>Fixed in master with http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=b5e5d25c25f30db1f9855e24afef9d8f0bb77d35</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30778</commentid>
    <comment_count>6</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-03-18 04:37:11 +0000</bug_when>
    <thetext>Verified on master:6d9a3ac0515380d0789ee3d316c08212592a6f9a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32013</commentid>
    <comment_count>7</comment_count>
    <who name="Ning Zhang">ning.zhang</who>
    <bug_when>2013-04-12 05:14:15 +0000</bug_when>
    <thetext>Verified env:
    poky: 2a3f6772aadbe378259c87c05ab6f091866b63ef
    branch: master

Verified steps:

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

start PR Server `bitbake-prserv --start --port=10000&apos;

run `bitbake lib32-neard&apos;


----------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        = &quot;1.18.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Ubuntu-11.10&quot;
TARGET_SYS        = &quot;x86_64-poky-linux&quot;
MACHINE           = &quot;qemux86-64&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;1.3+snapshot-20130411&quot;
TUNE_FEATURES     = &quot;m64&quot;
TARGET_FPU        = &quot;&quot;
meta              
meta-yocto        
meta-yocto-bsp    = &quot;master:2a3f6772aadbe378259c87c05ab6f091866b63ef&quot;

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&apos;t need to be rerun and all succeeded.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>