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 = ();
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 {
$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;
}
next if $bad;
}
- push @ndeps, $pack;
+ $vers = '' unless defined $vers;
+ push @ndeps, "$pack$vers";
}
$replace = 1 if grep {/^-/} @ndeps;
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
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
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm zlib
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm 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
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
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 cracklib db gcc gdbm gettext
Required: glibc libtool ncurses perl rpm zlib
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm zlib
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm zlib
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm zlib
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm 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
Runscripts: aaa_base
+VMinstall: util-linux perl
+
Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
Required: libtool ncurses perl rpm 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
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);
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##*/}"
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
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
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"
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