From bf31b430d3fd41a0c4ca45ee0f5bd361e55b4b9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20Schr=C3=B6der?= Date: Tue, 13 Mar 2007 15:10:26 +0000 Subject: [PATCH] - support vminstall directive - obey versioned build-requires/depends - do not delete SOURCES.DEB --- Build.pm | 27 +++++++++++++++++++++------ Build/Deb.pm | 50 +++++++++++++++++++++++++++++++++++++++++++------- Build/Rpm.pm | 3 ++- build | 1 - configs/debian.conf | 2 ++ configs/sl10.0.conf | 2 ++ configs/sl10.1.conf | 2 ++ configs/sl8.1.conf | 2 ++ configs/sl8.2.conf | 2 ++ configs/sl9.0.conf | 2 ++ configs/sl9.1.conf | 2 ++ configs/sl9.2.conf | 2 ++ configs/sl9.3.conf | 2 ++ configs/sles10.conf | 2 ++ configs/sles8.conf | 2 ++ configs/sles9.conf | 2 ++ configs/ul1.conf | 2 ++ expanddeps | 1 + init_buildsystem | 13 ++++++++++++- 19 files changed, 105 insertions(+), 16 deletions(-) diff --git a/Build.pm b/Build.pm index 8b8539d..c01c535 100644 --- 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 = (); diff --git a/Build/Deb.pm b/Build/Deb.pm index 1b296c7..56d8498 100644 --- a/Build/Deb.pm +++ b/Build/Deb.pm @@ -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/<{'name'} = $name; diff --git a/Build/Rpm.pm b/Build/Rpm.pm index 1a9c95e..8f53013 100644 --- a/Build/Rpm.pm +++ b/Build/Rpm.pm @@ -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 --- 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 diff --git a/configs/debian.conf b/configs/debian.conf index ce59c2e..c37b4c4 100644 --- a/configs/debian.conf +++ b/configs/debian.conf @@ -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 diff --git a/configs/sl10.0.conf b/configs/sl10.0.conf index 50f2c06..7ba31a9 100644 --- a/configs/sl10.0.conf +++ b/configs/sl10.0.conf @@ -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 diff --git a/configs/sl10.1.conf b/configs/sl10.1.conf index 9f7e47b..fc852af 100644 --- a/configs/sl10.1.conf +++ b/configs/sl10.1.conf @@ -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 diff --git a/configs/sl8.1.conf b/configs/sl8.1.conf index ceac66e..1e0828b 100644 --- a/configs/sl8.1.conf +++ b/configs/sl8.1.conf @@ -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 diff --git a/configs/sl8.2.conf b/configs/sl8.2.conf index 5bd9c2d..f8da19e 100644 --- a/configs/sl8.2.conf +++ b/configs/sl8.2.conf @@ -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 diff --git a/configs/sl9.0.conf b/configs/sl9.0.conf index 493e8ba..f2ab7a0 100644 --- a/configs/sl9.0.conf +++ b/configs/sl9.0.conf @@ -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 diff --git a/configs/sl9.1.conf b/configs/sl9.1.conf index fc2c5c0..05484d0 100644 --- a/configs/sl9.1.conf +++ b/configs/sl9.1.conf @@ -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 diff --git a/configs/sl9.2.conf b/configs/sl9.2.conf index 816705c..0fcf915 100644 --- a/configs/sl9.2.conf +++ b/configs/sl9.2.conf @@ -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 diff --git a/configs/sl9.3.conf b/configs/sl9.3.conf index 3ebc75a..d78dd4c 100644 --- a/configs/sl9.3.conf +++ b/configs/sl9.3.conf @@ -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 diff --git a/configs/sles10.conf b/configs/sles10.conf index a4a1b3e..d5b7f6b 100644 --- a/configs/sles10.conf +++ b/configs/sles10.conf @@ -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 diff --git a/configs/sles8.conf b/configs/sles8.conf index ef8e14f..95bcc41 100644 --- a/configs/sles8.conf +++ b/configs/sles8.conf @@ -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 diff --git a/configs/sles9.conf b/configs/sles9.conf index 75f4b63..d6f2545 100644 --- a/configs/sles9.conf +++ b/configs/sles9.conf @@ -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 diff --git a/configs/ul1.conf b/configs/ul1.conf index 9f7e860..b9148c5 100644 --- a/configs/ul1.conf +++ b/configs/ul1.conf @@ -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 diff --git a/expanddeps b/expanddeps index e082576..e44aae0 100755 --- a/expanddeps +++ b/expanddeps @@ -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); diff --git a/init_buildsystem b/init_buildsystem index fcfcedc..4ace7d5 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -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 -- 2.7.4