Revert gbs install package policy, add use higher version option 81/89281/1
authory0169.zhang <y0169.zhang@samsung.com>
Fri, 19 Aug 2016 01:29:11 +0000 (10:29 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Fri, 23 Sep 2016 04:07:34 +0000 (13:07 +0900)
Change-Id: I5b1596e12f0ee45a46adf041f6cb9630ad319d3a

build
expanddeps
init_buildsystem

diff --git a/build b/build
index 500bd8a..c94f365 100755 (executable)
--- a/build
+++ b/build
@@ -97,6 +97,7 @@ RUN_SHELL=
 CCACHE=
 DLNOSIGNATURE=
 CACHE_DIR=/var/cache/build
+USEHIGHERDEPS=
 
 
 # This is for insserv
@@ -930,6 +931,9 @@ while test -n "$1"; do
        echo "$ARG does not take an argument"
        cleanup_and_exit
       ;;
+      -use-higher-deps)
+        USEHIGHERDEPS="--use-higher-deps"
+      ;;
       -*)
        if vm_parse_options "$@" ; then
            set -- "${nextargs[@]}"
@@ -1000,7 +1004,7 @@ if test -n "$LIST_STATE" ; then
        recipe_unpack_srcrpm
        RECIPEFILE="$MYSRCDIR/$RECIPEFILE"
     fi
-    init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --list-state "${definesnstuff[@]}" "${repos[@]}" $DLNOSIGNATURE $KEEP_PACKS $USEUSEDFORBUILD $RECIPEFILE $BUILD_EXTRA_PACKS
+    init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --list-state "${definesnstuff[@]}" "${repos[@]}" $DLNOSIGNATURE $KEEP_PACKS $USEHIGHERDEPS $USEUSEDFORBUILD $RECIPEFILE $BUILD_EXTRA_PACKS
     ERR=$?
     rm -rf "$BUILD_ROOT"
     cleanup_and_exit $ERR
@@ -1140,7 +1144,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
        test "$BUILDTYPE" = mock && CREATE_BUILD_BINARIES=--create-build-binaries
        test "$BUILDTYPE" = debootstrap && CREATE_BUILD_BINARIES=--create-build-binaries
        test "$BUILDTYPE" = livebuild && CREATE_BUILD_BINARIES=--create-build-binaries
-       set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $DLNOSIGNATURE $KEEP_PACKS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$RECIPEFILE" $ADDITIONAL_PACKS
+       set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $DLNOSIGNATURE $KEEP_PACKS $USEHIGHERDEPS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$RECIPEFILE" $ADDITIONAL_PACKS
        echo "$* ..."
         start_time=`date +%s`
        "$@" || cleanup_and_exit 1
index 387daf7..7e3b795 100755 (executable)
@@ -29,7 +29,7 @@ use strict;
 use Build;
 use File::Basename;
 
-my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall);
+my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall, $usehigherdeps);
 
 $configdir = ($::ENV{'BUILD_DIR'} || '/usr/lib/build') . '/configs';
 
@@ -77,6 +77,11 @@ while (@ARGV)  {
     Build::define("_without_$def --without-$def");
     next;
   }
+  if ($ARGV[0] eq '--usehigherdeps') {
+    shift @ARGV;
+    $usehigherdeps = 1;
+    next;
+  }
   last;
 }
 
@@ -194,16 +199,36 @@ while(<F>) {
     }
   } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgP = $2;
+    next if $prov{$1};
+    $prov{$1} = $2;
   } elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgR = $2;
+    next if $req{$1};
+    $req{$1} = $2;
   } elsif (/^C:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgC = $2;
+    next if $con{$1};
+    $con{$1} = $2;
   } elsif (/^O:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgO = $2;
+    next if $obs{$1};
+    $obs{$1} = $2;
   } elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+    my $r = 0;
+    if ($usehigherdeps) {
+      $r = 1;
+    } else {
+      if ($packs_done{$1}) {
+        $r = 0;
+      } else {
+        $r = 1;
+      }
+    }
+
+    next unless ($r);
     my ($i, $newid) = ($1, $2);
     undef $i unless !$ids{$i} || $verscmp->($ids{$i}, $newid) < 0;
-    undef $i unless defined($pkgF) && defined($pkgP);
+    undef $i unless defined($pkgF) && defined($pkgP) && defined($pkgR);
     if (defined $i) {
       $i =~ /^(.*)\.([^\.]+)$/ or die;
       push @{$packs_arch{$2}}, $1;
@@ -216,6 +241,9 @@ while(<F>) {
       $req{$i}  = $pkgR;
       $con{$i}  = $pkgC if defined $pkgC;
       $obs{$i}  = $pkgO if defined $pkgO;
+    } else {
+      next if $ids{$1};
+      $ids{$1} = $2;
     }
     undef $pkgF;
     undef $pkgP;
index 1b3170f..55b6416 100755 (executable)
@@ -59,6 +59,7 @@ CLEAN_BUILD=
 CREATE_BUILD_BINARIES=
 DLNOSIGNATURE=
 CACHE_DIR=/var/cache/build
+USEHIGHERDEPS=
 
 while test -n "$1" ; do
     case "$1" in
@@ -112,6 +113,10 @@ while test -n "$1" ; do
            shift
            DLNOSIGNATURE="--nosignature"
            ;;
+       --use-higher-deps)
+           shift
+           USEHIGHERDEPS="--usehigherdeps"
+           ;;
        *)
            break
            ;;
@@ -574,7 +579,7 @@ else
        #
        RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist
        test -z "$LIST_STATE" && echo "expanding package dependencies..."
-       if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
+       if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD $USEHIGHERDEPS "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
            rm -f $BUILD_IS_RUNNING
            cleanup_and_exit 1
        fi