From: yang.zhang Date: Tue, 8 Mar 2016 03:36:37 +0000 (+0800) Subject: adapt to gbs X-Git-Tag: upstream/20150115~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90e7f2cf27d6dfdd20c47d455a41c505884b0d13;p=tools%2Fbuild.git adapt to gbs Change-Id: I1cd14379db3af453aa168e90eea656b20c00acd2 --- diff --git a/Build/Rpm.pm b/Build/Rpm.pm index 4bdf78d..d9c6028 100644 --- a/Build/Rpm.pm +++ b/Build/Rpm.pm @@ -1062,7 +1062,7 @@ sub queryinstalled { $root = '' if !defined($root) || $root eq '/'; local *F; - my $dochroot = $root ne '' && !$opts{'nochroot'} && !$< && (-x "$root/usr/bin/rpm" || -x "$root/bin/rpm") ? 1 : 0; + my $dochroot = $root ne '' && !$opts{'nochroot'} && !$< ? 1 : 0; my $pid = open(F, '-|'); die("fork: $!\n") unless defined $pid; if (!$pid) { diff --git a/build-pkg-rpm b/build-pkg-rpm index 29f2acb..c0f9653 100644 --- a/build-pkg-rpm +++ b/build-pkg-rpm @@ -109,16 +109,6 @@ pkg_cumulate_rpm() { } pkg_install_rpm() { - export ADDITIONAL_PARAMS= - if test "$USE_FORCE" = true ; then - export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force" - fi - # work around for cross-build installs, we must not overwrite the running rpm - if test "$PKG" = rpm ; then - for i in $BUILD_ROOT/.init_b_cache/preinstalls/rpm-x86-* ; do - test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb" - done - fi ( chroot $BUILD_ROOT rpm --ignorearch --nodeps -U --oldpackage --ignoresize $RPMCHECKOPTS \ $ADDITIONAL_PARAMS .init_b_cache/$PKG.rpm 2>&1 || \ touch $BUILD_ROOT/exit ) | \ diff --git a/init_buildsystem b/init_buildsystem index 8fa8d7d..b2e8da5 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -419,6 +419,74 @@ can_reuse_cached_package() { return 0 } +check_copy_qemu() +{ + local arch + + for arch in $EMULATOR_DEVS; do + if test -e $BUILD_DIR/qemu-$arch; then + return 0 + fi + done + return 1 +} + +copy_qemu() +{ + local path dest + + echo "copying qemu" + + mkdir -p $BUILD_ROOT/usr/bin + + if check_copy_qemu; then + + for path in $BUILD_DIR/qemu-*; do + if file $path | grep -q static; then + dest="$BUILD_ROOT/usr/bin/${path##*/}" + if [ -f "$path" -a ! -x "$dest" ]; then + echo -n " $path" # report copy + #echo install -m755 "$path" "$dest" + install -m755 "$path" "$dest" + fi + fi + done + + else + + for path in /usr/bin/qemu-*; do + if file $path | grep -q static; then + dest="$BUILD_ROOT/usr/bin/${path##*/}" + if [ -f "$path" -a ! -x "$dest" ]; then + echo -n " $path" # report copy + #echo install -m755 "$path" "$dest" + install -m755 "$path" "$dest" + fi + fi + done + + if [ -e /usr/sbin/qemu-binfmt-conf.sh \ + -a ! -e $BUILD_ROOT/usr/sbin/qemu-binfmt-conf.sh ]; then + echo " /usr/sbin/qemu-binfmt-conf.sh" # report copy + mkdir -p $BUILD_ROOT/usr/sbin + install -m755 /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin + fi + + fi + echo "" + + # Below for backward compatibility when /.build/initvm is not present + + if [ -n "$PREPARE_VM" ]; then + if [ -x /bin/bash-static -a -x /bin/mount-static ]; then + echo " /bin/bash-static /bin/mount-static" # report copy + mkdir -p $BUILD_ROOT/bin + install -m755 /bin/bash-static $BUILD_ROOT/bin + install -m755 /bin/mount-static $BUILD_ROOT/bin + fi + fi +} + set_build_arch trap fail_exit EXIT @@ -526,6 +594,7 @@ else # if test -z "$PREPARE_VM" ; then if check_use_emulator ; then + copy_qemu echo "registering binfmt handlers for cross build" "$BUILD_DIR/$INITVM_NAME" echo 0 > /proc/sys/vm/mmap_min_addr @@ -914,6 +983,17 @@ for PKG in $MAIN_LIST ; do check_exit fi + export ADDITIONAL_PARAMS= + if test "$USE_FORCE" = true ; then + export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force" + fi + # work around for cross-build installs, we must not overwrite the running rpm + if test "$PKG" = rpm ; then + for i in $BUILD_ROOT/.init_b_cache/preinstalls/rpm-x86-* ; do + test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb" + done + fi + if pkg_cumulate ; then echo "cumulate ${PKGID%% *}" continue