Bug 4050 - build multilib core-image-sato failed when PR Server is enabled
Summary: build multilib core-image-sato failed when PR Server is enabled
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.4
Assignee: Hongxu Jia
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-03-19 02:38 UTC by Hongxu Jia
Modified: 2013-04-18 05:18 UTC (History)
10 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-19 02:38:52 UTC
*env
1, Build Configuration:
BB_VERSION        = "1.17.1"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "RedHatEnterpriseServer-6.3"
TARGET_SYS        = "x86_64-poky-linux"
MACHINE           = "qemux86-64"
DISTRO            = "poky"
DISTRO_VERSION    = "1.3+snapshot-20130318"
TUNE_FEATURES     = "m64"
TARGET_FPU        = ""
meta              
meta-yocto        
meta-yocto-bsp    = "hongxu-0206:6d9a3ac0515380d0789ee3d316c08212592a6f9a"

2, 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" 
IMAGE_INSTALL_append = " lib32-neard-dev lib32-neard-dbg"
...

3, Start PR Server: `bitbake-prserv --port=10000 --start'

*problem
Build core-image-sato and it crashed at rootfs time:
...
| Note: to be installed:  packagegroup-core-ssh-dropbear@all packagegroup-core-x11-sato-games@qemux86_64 packagegroup-core-x11-base@all neard-dbg@lib32_x86 smartpm@x86_64 psplash@x86_64 neard-dev@lib32_x86 packagegroup-core-boot@qemux86_64 packagegroup-base-extended@qemux86_64 rpm@x86_64 packagegroup-core-x11-sato@qemux86_64 locale-base-en-us@x86_64 locale-base-en-gb@x86_64
| Loading cache...
| Updating cache...               ######################################## [100%]
| 
| Computing transaction...error: Can't install neard-dev-0.9+git1+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.3@lib32_x86: no package provides neard = 0.9+git1+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1
| 
| Saving cache...
| 
| ERROR: Function failed: do_rootfs (see /home/jiahongxu/yocto/build-20130301-sanity/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.32373 for further information)
...

*analysis
1, Find out lib32-neard packages:
$ find tmp/deploy/ -name "*neard*lib32*"
tmp/deploy/rpm/lib32_x86/neard-0.9+git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.0.lib32_x86.rpm
tmp/deploy/rpm/lib32_x86/neard-dev-0.9+git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.0.lib32_x86.rpm
tmp/deploy/rpm/lib32_x86/neard-dbg-0.9+git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.0.lib32_x86.rpm

2, Check the dependency of neard-dev-0.9+git1+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.3@lib32_x86
rpm -qpR tmp/deploy/rpm/lib32_x86/neard-dev-0.9+git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1.0.lib32_x86.rpm
...
neard = 0.9+git0+1e20e396cb837017b7e5ef822bfdab6ce060d2cf-r1
...

3, The `r1' in versioned dependency string is incorrect. The `r1.0' is expected.

4, PKGR is `r1.0', and PR is `r1' and have
   PKGR ?= "${PR}${EXTENDPRAUTO}"
   EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}"
   RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPKGV})"
in bitbake.conf, when PR Server is enabled, EXTENDPRAUTO is not none.

5, When multilib is enabled, RDEPENDS_${PN}-dev is not expanded correctly which uses PR rather than PKGR in the versioned dependency string.

*solution
When write_specfile at do_package_rpm, make sure PKGR rahter than PR in version string.
Comment 1 Hongxu Jia 2013-03-19 02:56:00 UTC
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index b6d76e7..5108ccc 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -610,7 +610,14 @@ python write_specfile () {
                             pv = subd['PV']
                             pkgv = subd['PKGV']
                             reppv = pkgv.replace('-', '+')
-                            verlist.append(ver.replace(pv, reppv).replace(pkgv, reppv))
+                            ver = ver.replace(pv, reppv).replace(pkgv, reppv)
+                        if 'PKGR' in subd:
+                            # Make sure PKGR rahter than PR in ver
+                            pr = subd['PR']
+                            pkgr = subd['PKGR']
+                            import re
+                            ver = re.compile('-'+pr+'$').sub('-'+pkgr, ver)
+                        verlist.append(ver)
                     else:
                         verlist.append(ver)
                 newdeps_dict[dep] = verlist
Comment 2 Richard Purdie 2013-04-02 21:50:53 UTC
Could you reproduce this problem after http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=7803f5f98cf4d12d59ac793d9eb0048b701cafb7 and http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=b5e5d25c25f30db1f9855e24afef9d8f0bb77d35 were applied?

Note that current master won't show the issue since the "-" character was removed from neard's PV field. It would be good to know if the above commit was enough to resolve this issue though?
Comment 3 Hongxu Jia 2013-04-03 06:16:05 UTC
Yes, the problem could be reproduced if add `IMAGE_INSTALL_append = 
" lib32-neard-dev lib32-neard-dbg"' in local.conf.
The neard's PV field is ok, but the PKGV of lib32-neard-dev and
lib32-neard-dbg is incorrect.

1, In the neard.spec of lib32-neard:
  2 Name: neard
  3 Version: 0.10+git0+eb486bf35e24d7d1db61350f5ab393a0c880523d
  4 Release: r0.1
...
145 %package -n neard-dbg
...
149 Suggests: neard = 0.10+git0+eb486bf35e24d7d1db61350f5ab393a0c880523d-r0

2, `r0.1' rather than `r0' in the Suggests of neard-dbg is what we need.

3, The test is based on the master fd4e5c6c58183f1a017c6b5fe4d43c320e273567.
Comment 4 Hongxu Jia 2013-04-03 06:19:01 UTC
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index b6d76e7..34cf904 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -610,7 +610,14 @@ python write_specfile () {
                             pv = subd['PV']
                             pkgv = subd['PKGV']
                             reppv = pkgv.replace('-', '+')
-                            verlist.append(ver.replace(pv, reppv).replace(pkgv, reppv))
+                            ver = ver.replace(pv, reppv).replace(pkgv, reppv)
+                        if 'PKGR' in subd:
+                            # Make sure PKGR rather than PR in ver
+                            pr = '-' + subd['PR']
+                            pkgr = '-' + subd['PKGR']
+                            if pkgr not in ver:
+                                ver = ver.replace(pr, pkgr)
+                        verlist.append(ver)
                     else:
                         verlist.append(ver)
                 newdeps_dict[dep] = verlist
Comment 5 Hongxu Jia 2013-04-03 06:24:20 UTC
(In reply to comment #3)
> Yes, the problem could be reproduced if add `IMAGE_INSTALL_append = 
> " lib32-neard-dev lib32-neard-dbg"' in local.conf.
> The neard's PV field is ok, but the PKGV of lib32-neard-dev and
> lib32-neard-dbg is incorrect.
> 
The PV of lib32-neard-dev and lib32-neard-dbg is incorrect, we should
make sure PKGR rather than PR in package version.
Comment 7 Ning Zhang 2013-04-18 05:18:13 UTC
Verified env:
    poky: 90b98764555945a186562ca8d501a9585ce2b23f
    branch: master
Verified steps:
    1. Create a new build, modify conf/local.conf as below:

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" 
IMAGE_INSTALL_append = " lib32-neard-dev lib32-neard-dbg"

    2. bitbake core-image-sato
    3. start qemux86-64

Result:
    The build success and qemu could be started.