Bug 668 - rpm "unknown option" error while do_rootfs if build from sstate
Summary: rpm "unknown option" error while do_rootfs if build from sstate
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: High normal
Target Milestone: 1.0 M4
Assignee: Dongxiao Xu
QA Contact:
URL:
Whiteboard:
: 731 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-20 20:48 UTC by Dongxiao Xu
Modified: 2011-02-16 23:21 UTC (History)
6 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 Dongxiao Xu 2011-01-20 20:48:38 UTC
Reproduce process:

1) Build one poky image from scratch.
2) Remove all the tmp files and retain the sstate-cache prebuilt results.
3) Build another poky image from sstate.


With the above process, an rpm "unknown option" error will occur while executing do_rootfs.

Note that, to trigger the bug, we must remove/rename the tmp file of the original build.

Some phenomenon will be like:

| rpm: --dbpath: unknown option
| Function 'do_rootfs' failed (see /home/dongxiao/poky.git/build-atom-pc/tmp/work/atom-pc-poky-linux/poky-image-sdk-1.0-r0/temp/log.do_rootfs.12907 for further information)
NOTE: package poky-image-sdk-1.0-r0: task do_rootfs: Failed
ERROR: Task 9 (/home/dongxiao/poky.git/meta/recipes-sato/images/poky-image-sdk.bb, do_rootfs) failed with exit code '1'

or

| rpmbuild: --buildroot: unknown option
| Function 'BUILDSPEC' failed (see /distro/dongxiao/build-qemux86-sstate/tmp/work/qemux86-poky-linux/task-poky-boot-1.0-r7/temp/log.do_package_write_rpm.14059 for further information)
| ERROR: Function 'BUILDSPEC' failed (see /distro/dongxiao/build-qemux86-sstate/tmp/work/qemux86-poky-linux/task-poky-boot-1.0-r7/temp/log.do_package_write_rpm.14059 for further information)


If running "rpm --dbpath" in do_rootfs, rpm will search rpmpopt file to get the meaning of this additional options. However the rpm binary from sstate still tries to find the rpmpopt file from its original build dir, which is already removed. 

Since the rpmpopt path is assigned when configuration, thus we need to rebuild rpm-native to make sstate build correct.
Comment 1 Dongxiao Xu 2011-01-20 21:10:34 UTC
I just found that there is a runtime option "--rpmpopt" that can change the rpmpopt path, I will commit a patch to create a wrapper for rpm native binary.
Comment 2 Mark Hatle 2011-02-01 10:12:47 UTC
The version of RPM we built can be overridden in an easy way.

We need to set the environment values of:

RPM_USRLIBRPM
RPM_ETCRPM
RPM_LOCALEDIR

There is an example runtime relocation wrapper included in the RPM sources:

scripts/rt-reloc-wrapper.sh:


#! /bin/sh
# Identify run path, and forward to ../lib_or_lib64/$0

PROGNAME=$(basename $0)
DIR=$(cd $(dirname $0) ; pwd)

export LD_LIBRARY_PATH=$DIR/../libMark64:$DIR/../lib:$DIR/../lib64
export RPM_USRLIBRPM=$DIR/../libMark64/rpm
export RPM_ETCRPM=$DIR/../etc/rpm
export RPM_LOCALEDIR=$DIR/../share/locale

exec $DIR/../libMark64/rpm/$PROGNAME "$@"

where you see "libMark64" is replaced by either "lib" or "lib64"...
Comment 4 Edwin Zhai 2011-02-16 23:21:47 UTC
*** Bug 731 has been marked as a duplicate of this bug. ***