adapt to gbs
authoryang.zhang <y0169.zhang@samsung.com>
Tue, 8 Mar 2016 03:36:37 +0000 (11:36 +0800)
committeryang.zhang <y0169.zhang@samsung.com>
Tue, 8 Mar 2016 03:37:09 +0000 (11:37 +0800)
Change-Id: I1cd14379db3af453aa168e90eea656b20c00acd2

Build/Rpm.pm
build-pkg-rpm
init_buildsystem

index 4bdf78d9a3dc8b7840faabf7746181bdadf0e3e7..d9c6028b59f3de29bca15b741488e8e0fa8c8a87 100644 (file)
@@ -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) {
index 29f2acb8ebfb26695799b281378cb3b79b483ae8..c0f965399f1a535788df02810dd05de925d1d7d7 100644 (file)
@@ -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 ) | \
index 8fa8d7d6c58ff01bc438b2a4bbe95338adba4fc9..b2e8da5b697b30df12158359ccd30c83991cc271 100755 (executable)
@@ -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