Bug 3817

Summary: dpkg-native:fix dpkg-scanpackages error at deb image creation time on Fedora 17
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Hongxu Jia <hongxu.jia>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: hongxu.jia, kai.kang, liang.li2, liezhi.yang, meta.mr.watcher, meta.watcher, Qi.Chen, sgw, yi.zhao, zhenfeng.zhao
Version: 1.4   
Target Milestone: 1.4 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Hongxu Jia 2013-01-31 12:00:11 UTC
*problem
1. On Fedora 17, download poky source and prepare a completely new build environment

2. Add the follow config option to a conf file:
    PACKAGE_CLASSES = "package_deb"

3. Run `bitbake dpkg-native'

4. Run `bitbake core-image-sato' and do_rootfs failed, the following is the error log:
| Can't locate Dpkg.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share
/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/
share/perl5 .) at /buildarea2/hongxujia/build-20130130-deb/tmp/sysroots/i686-linux/
usr/bin/dpkg-scanpackages line 27.
| BEGIN failed--compilation aborted at /buildarea2/hongxujia/build-20130130-deb/tmp/
sysroots/i686-linux/usr/bin/dpkg-scanpackages line 27.

*analysis
1. The dpkg-scanpackages is invoked at deb image creation time and it is built
by dpkg-native. The dpkg-scanpackages is a perl script and import module `Dpkg'.

2. The Dpkg.pm has been installed in perl's staging dir at dpkg-native building
time. Such as `tmp/sysroots/x86_64-linux/usr/lib/perl-native/perl/Dpkg.pm'

3. The dpkg-native uses create_wrapper to relocate to perl-native if perl-native
has been built. If perl-native isn't built, it will use the host Dpkg as default.

4. If dpkg-native is built on a new build envionment which means perl-native doesn't
exist before, and the build system doesn't install dpkg (such as Fedora 17), the 
dpkg-scanpackages could not work correctly.

*solution
Modify dpkg-native's depends, change `perl-native-runtime' to `perl-native', Let
perl-native automatically be built before building dpkg-native.
Comment 1 Hongxu Jia 2013-01-31 12:02:29 UTC
Log data follows:
| DEBUG: Executing shell function do_rootfs
| Can't locate Dpkg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| BEGIN failed--compilation aborted at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| Can't locate Dpkg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| BEGIN failed--compilation aborted at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| Can't locate Dpkg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| BEGIN failed--compilation aborted at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| Can't locate Dpkg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| BEGIN failed--compilation aborted at /buildarea2/hongxujia/build-20130130-ipk/tmp/sysroots/x86_64-linux/usr/bin/dpkg-scanpackages line 27.
| Ign file: ./ Release.gpg
| Ign file: ./ Release.gpg
| Ign file: ./ Release.gpg
| Get:1 file: ./ Release [15B]
| Ign file: ./ Packages
| Get:2 file: ./ Release [12B]
| Ign file: ./ Packages
| Get:3 file: ./ Release [11B]
| Ign file: ./ Packages
| Reading package lists...
| Reading package lists...
| Building dependency tree...
| E: Couldn't find package glibc-localedata-i18n
| ERROR: Function failed: do_rootfs (see /buildarea2/hongxujia/build-20130130-ipk/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.9166 for further information)
ERROR: Task 7 (/buildarea2/hongxujia/poky/meta/recipes-sato/images/core-image-sato.bb, do_rootfs) failed with exit code '1'
Comment 3 liang li 2013-02-06 04:05:27 UTC
no error when run following commands with git master branch commit 7e9cb437b1b720e656f4a33f73c07c5dc7356a2c when set "PACKAGE_CLASSES = "package_deb" in file "local.conf" on fedora 17 64bit host:
bitbake dpkg-native;bitbake core-image-sato