- support vminstall directive
authorMichael Schröder <mls@suse.de>
Tue, 13 Mar 2007 15:10:26 +0000 (15:10 +0000)
committerMichael Schröder <mls@suse.de>
Tue, 13 Mar 2007 15:10:26 +0000 (15:10 +0000)
- obey versioned build-requires/depends
- do not delete SOURCES.DEB

19 files changed:
Build.pm
Build/Deb.pm
Build/Rpm.pm
build
configs/debian.conf
configs/sl10.0.conf
configs/sl10.1.conf
configs/sl8.1.conf
configs/sl8.2.conf
configs/sl9.0.conf
configs/sl9.1.conf
configs/sl9.2.conf
configs/sl9.3.conf
configs/sles10.conf
configs/sles8.conf
configs/sles9.conf
configs/ul1.conf
expanddeps
init_buildsystem

index 8b8539d..c01c535 100644 (file)
--- a/Build.pm
+++ b/Build.pm
@@ -374,13 +374,28 @@ sub expand {
 
   my %xignore = map {substr($_, 1) => 1} grep {/^-/} @p;
   @p = grep {!/^-/} @p;
-  my %p = map {$_ => 1} grep {$requires->{$_}} @p;
 
-  my %aconflicts;
-  for my $p (keys %p) {
-    next unless exists $conflicts->{$p};
-    $aconflicts{$_} = 1 for @{$conflicts->{$p} || []};
+  my %p;               # expanded packages
+  my %aconflicts;      # packages we are conflicting with
+
+  # add direct dependency packages. this is different from below, 
+  # because we add packages even if to dep is already provided and
+  # we break ambiguities if the name is an exact match.
+  for my $p (splice @p) {
+    my @q = @{$rprovides->{$p} || addproviders($config, $p)};
+    if (@q > 1) {
+      my $pn = $p;
+      $pn =~ s/ .*//;
+      @q = grep {$_ eq $pn} @q;
+    }
+    if (@q != 1) {
+      push @p, $p;
+      next;
+    }
+    print "added $q[0] because of $p (direct dep)\n" if $expand_dbg;
+    push @p, $q[0];
+    $p{$q[0]} = 1;
+    $aconflicts{$_} = 1 for @{$conflicts->{$q[0]} || []};
   }
 
   my @pamb = ();
index 1b296c7..56d8498 100644 (file)
@@ -14,6 +14,20 @@ sub parse {
   my ($bconf, $fn) = @_;
   my $ret;
   my @control;
+
+  # get arch and os from macros
+  my ($arch, $os);
+  for (@{$bconf->{'macros'} || []}) {
+    $arch = $1 if /^%define _target_cpu (\S+)/;
+    $os = $1 if /^%define _target_os (\S+)/;
+  }
+  # map to debian names
+  $os = 'linux' if !defined($os);
+  $arch = 'all' if !defined($arch) || $arch eq 'noarch';
+  $arch = 'i386' if $arch =~ /^i[456]86$/;
+  $arch = 'powerpc' if $arch eq 'ppc';
+  $arch = 'amd64' if $arch eq 'x86_64';
+
   if (ref($fn) eq 'ARRAY') {
     @control = @$fn;
   } else {
@@ -46,14 +60,36 @@ sub parse {
       $version =~ s/-[^-]+$//;
     } elsif ($tag eq 'SOURCE') {
       $name = $data;
-    } elsif ($tag eq 'BUILD-DEPENDS') {
-      my @d = split(/,\s*/, $data);
-      s/\s.*// for @d;
-      push @deps, @d;
-    } elsif ($tag eq 'BUILD-CONFLICTS' || $tag eq 'BUILD-IGNORE') {
+    } elsif ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-CONFLICTS' || $tag eq 'BUILD-IGNORE') {
       my @d = split(/,\s*/, $data);
-      s/\s.*// for @d;
-      push @deps, map {"-$_"} @d;
+      for my $d (@d) {
+        if ($d =~ /^(.*?)\s*\[(.*)\]$/) {
+         $d = $1;
+         my $isneg = 0;
+          my $bad;
+          for my $q (split('[\s,]', $2)) {
+            $isneg = 1 if $q =~ s/^\!//;
+            $bad = 1 if !defined($bad) && !$isneg;
+            if ($isneg) {
+              if ($q eq $arch || $q eq "$os-$arch") {
+               $bad = 1;
+               last;
+             }
+           } elsif ($q eq $arch || $q eq "$os-$arch") {
+             $bad = 0;
+           }
+         }
+         next if $bad;
+       }
+       $d =~ s/ \(([^\)]*)\)/ $1/g;
+       $d =~ s/>>/>/g;
+       $d =~ s/<</</g;
+       if ($tag eq 'BUILD-DEPENDS') {
+          push @deps, $d;
+       } else {
+          push @deps, "-$d";
+       }
+      }
     }
   }
   $ret->{'name'} = $name;
index 1a9c95e..8f53013 100644 (file)
@@ -337,7 +337,8 @@ sub parse {
          }
          next if $bad;
        }
-       push @ndeps, $pack;
+       $vers = '' unless defined $vers;
+       push @ndeps, "$pack$vers";
       }
 
       $replace = 1 if grep {/^-/} @ndeps;
diff --git a/build b/build
index 387caea..bf1ab9b 100755 (executable)
--- a/build
+++ b/build
@@ -725,7 +725,6 @@ for SPECFILE in $SPECFILES ; do
            mkdir -p $BUILD_ROOT$TOPDIR/SOURCES.DEB
             debtransform $CHANGELOGARGS $BUILD_ROOT$TOPDIR/SOURCES $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT$TOPDIR/SOURCES.DEB
            chroot $BUILD_ROOT su -c "dpkg-source -x $TOPDIR/SOURCES.DEB/*.dsc $TOPDIR/BUILD" - $BUILD_USER
-           rm -rf $BUILD_ROOT$TOPDIR/SOURCES.DEB
         else
            chroot $BUILD_ROOT su -c "dpkg-source -x $TOPDIR/SOURCES/$SPECFILE $TOPDIR/BUILD" - $BUILD_USER
         fi
index ce59c2e..c37b4c4 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: sysv-rc gzip base-files
 
 Runscripts: base-files
 
+VMinstall: util-linux binutils libblkid1 libuuid1 libdevmapper1.02 mount
+
 Required: autoconf automake binutils bzip2 gcc gettext libc6
 Required: libtool libncurses5 perl zlib1g dpkg
 
index 50f2c06..7ba31a9 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: permissions popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index 9f7e47b..fc852af 100644 (file)
@@ -5,6 +5,8 @@ Preinstall: permissions popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index ceac66e..1e0828b 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: textutils
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
 Required: glibc libtool ncurses pam perl rpm zlib
 
index 5bd9c2d..f8da19e 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: rpm sed shadow tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
 Required: glibc libtool ncurses pam perl rpm zlib
 
index 493e8ba..f2ab7a0 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: rpm sed shadow tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
 Required: glibc libtool ncurses perl rpm zlib
 
index fc2c5c0..05484d0 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index 816705c..0fcf915 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: permissions popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index 3ebc75a..d78dd4c 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: permissions popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index a4a1b3e..d5b7f6b 100644 (file)
@@ -5,6 +5,8 @@ Preinstall: permissions popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index ef8e14f..95bcc41 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: textutils
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
 Required: glibc libtool ncurses pam perl rpm zlib
 
index 75f4b63..d6f2545 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: popt pwdutils readline rpm sed tar zlib
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
 Required: libtool ncurses perl rpm zlib
 
index 9f7e860..b9148c5 100644 (file)
@@ -7,6 +7,8 @@ Preinstall: textutils
 
 Runscripts: aaa_base
 
+VMinstall: util-linux perl
+
 Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
 Required: glibc libtool ncurses pam perl rpm zlib
 
index e082576..e44aae0 100755 (executable)
@@ -142,6 +142,7 @@ if ($useusedforbuild) {
     print "$_ $fn{$packs{$_}}\n";
   }
   print "preinstall: @{$cf->{'preinstall'} || []}\n";
+  print "vminstall: @{$cf->{'vminstall'} || []}\n";
   print "runscripts: @{$cf->{'runscripts'} || []}\n";
   print "dist: $dist\n" if defined $dist;
   exit(0);
index fcfcedc..4ace7d5 100755 (executable)
@@ -301,6 +301,7 @@ else
        while read PKG SRC ; do
           test "$PKG" = "preinstall:" && continue
           test "$PKG" = "runscripts:" && continue
+          test "$PKG" = "vminstall:" && continue
           test "$PKG" = "dist:" && continue
           test "$PKG" = "rpmid:" && continue
           echo "${SRC##*/}"
@@ -312,6 +313,7 @@ else
     PACKAGES_TO_INSTALL=
     PACKAGES_TO_PREINSTALL=
     PACKAGES_TO_RUNSCRIPTS=
+    PACKAGES_TO_VMINSTALL=
     RUNSCRIPTS_SEEN=
     GUESSED_DIST=unknown
     mkdir -p $BUILD_ROOT/.init_b_cache/rpms
@@ -320,6 +322,10 @@ else
            PACKAGES_TO_PREINSTALL=$SRC
            continue
        fi
+       if test "$PKG" = "vminstall:" ; then
+           PACKAGES_TO_VMINSTALL=$SRC
+           continue
+       fi
        if test "$PKG" = "runscripts:" ; then
            RUNSCRIPTS_SEEN=true
            PACKAGES_TO_RUNSCRIPTS=$SRC
@@ -343,7 +349,7 @@ else
     echo "$GUESSED_DIST" > $BUILD_ROOT/.guessed_dist
     PSUF=rpm
     test -L $BUILD_ROOT/.init_b_cache/rpms/rpm.rpm || PSUF=deb
-    if test -n "$PREPARE_XEN" ; then
+    if test -n "$PREPARE_XEN" -a -z "$PACKAGES_TO_VMINSTALL" ; then
        # add util-linux/perl/binutils/mount to preinstall list
        test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/util-linux}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL util-linux"
        test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/perl}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL perl"
@@ -383,6 +389,11 @@ if test ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rp
     for PKG in $PACKAGES_TO_PREINSTALL ; do
        preinstall ${PKG##*/}
     done
+    if test -n "$PREPARE_XEN" ; then
+       for PKG in $PACKAGES_TO_VMINSTALL ; do
+           preinstall ${PKG##*/}
+       done
+    fi
     test -c $BUILD_ROOT/dev/null || create_devs
     test -e $BUILD_ROOT/etc/fstab || touch $BUILD_ROOT/etc/fstab
     test -e $BUILD_ROOT/etc/ld.so.conf || cp $BUILD_ROOT/etc/ld.so.conf.in $BUILD_ROOT/etc/ld.so.conf