sub read_config {
my ($arch, $cfile) = @_;
- return undef unless !defined($cfile) || -e $cfile;
+ return undef unless !defined($cfile) || ref($cfile) || -e $cfile;
my @macros = split("\n", $std_macros);
push @macros, "%define _target_cpu $arch";
push @macros, "%define _target_os linux";
$config->{'ignore'} = [];
$config->{'conflict'} = [];
$config->{'substitute'} = {};
+ $config->{'optflags'} = {};
my $inmacro = 0;
for my $l (@spec) {
if ($inmacro) {
my $m = ref($l) ? $l->[0] : $l;
- $m =~ s/^%/%define /;
+ $m =~ s/^%/%define / unless @macros && $macros[-1] =~ /\\$/;
push @macros, $m;
next;
}
@deps = grep {!$ndeps{"-$_"}} @deps;
@deps = do_subst($config, @deps);
@deps = grep {!$ndeps{"-$_"}} @deps;
- @deps = expand($config, @deps);
+ @deps = expand($config, @deps, @ndeps);
return @deps;
}
my @error = ();
my @uerror = ();
my @usolve = ();
+ my @rerror = ();
for my $p (splice @p) {
for my $r (@{$requires->{$p} || [$p]}) {
next if $ignore->{"$p:$r"} || $xignore{"$p:$r"};
@q = grep {!$aconflicts{$_}} @q;
if (!@q) {
if ($r eq $p) {
- return undef, "nothing provides $r";
+ push @rerror, "nothing provides $r";
} else {
- return undef, "nothing provides $r needed by $p";
+ push @rerror, "nothing provides $r needed by $p";
}
+ next;
}
if (@q > 1 && grep {$conflicts->{$_}} @q) {
# delay this one as some conflict later on might
@error = ();
}
}
+ if (@rerror) {
+ return undef, @rerror;
+ }
if (!$didsomething && @error) {
return undef, @error;
}
}
sub read_spec {
- my ($config, $specfile, $xspec) = @_;
+ my ($config, $specfile, $xspec, $ifdeps) = @_;
my $packname;
my $packvers;
+ my $packrel;
+ my $exclarch;
my @subpacks;
my @packdeps;
my $hasnfb;
my %macros;
+ my $ret = {};
my $specdata;
local *SPEC;
$specdata = [ @$specfile ];
} elsif (!open(SPEC, '<', $specfile)) {
warn("$specfile: $!\n");
- return (undef, "open: $!", undef);
+ $ret->{'error'} = "open $specfile: $!";
+ return $ret;
}
my @macros = @{$config->{'macros'}};
my $skip = 0;
my $main_preamble = 1;
my $inspec = 0;
+ my $hasif = 0;
while (1) {
my $line;
if (@macros) {
$line = shift @macros;
+ $hasif = 0 unless @macros;
} elsif ($specdata) {
$inspec = 1;
last unless @$specdata;
$expandedline .= $1;
$line = $4;
my $macname = defined($3) ? $3 : $2;
- my $macorig = $2;
+ my $macorig = $2;
my $mactest = 0;
if ($macname =~ /^\!\?/ || $macname =~ /^\?\!/) {
$mactest = -1;
$mactest = 1;
}
$macname =~ s/^[\!\?]+//;
+ $macname =~ s/ .*//;
my $macalt;
($macname, $macalt) = split(':', $macname, 2);
if ($macname eq '%') {
}
$line = '';
last;
+ } elsif ($macname eq 'defined' || $macname eq 'with' || $macname eq 'undefined' || $macname eq 'without' || $macname eq 'bcond_with' || $macname eq 'bcond_without') {
+ my @args;
+ if ($macorig =~ /^\{(.*)\}$/) {
+ @args = split(' ', $1);
+ shift @args;
+ } else {
+ @args = split(' ', $line);
+ $line = '';
+ }
+ next unless @args;
+ if ($macname eq 'bcond_with') {
+ $macros{"with_$args[0]"} = 1 if exists $macros{"_with_$args[0]"};
+ next;
+ }
+ if ($macname eq 'bcond_without') {
+ $macros{"with_$args[0]"} = 1 unless exists $macros{"_without_$args[0]"};
+ next;
+ }
+ $args[0] = "with_$args[0]" if $macname eq 'with' || $macname eq 'without';
+ $line = ((exists($macros{$args[0]}) ? 1 : 0) ^ ($macname eq 'undefined' || $macname eq 'without' ? 1 : 0)).$line;
} elsif (exists($macros{$macname})) {
if (!defined($macros{$macname})) {
$line = 'MACRO';
if ($skip) {
$xspec->[-1] = [ $xspec->[-1], undef ] if $xspec;
+ $$ifdeps = 1 if $ifdeps && ($line =~ /^(BuildRequires|BuildConflicts|\#\!BuildIgnore):\s*(\S.*)$/i);
next;
}
my $arch = $macros{'_target_cpu'} || 'unknown';
my @archs = grep {$_ eq $arch} split(/\s+/, $1);
$skip = 1 if !@archs;
+ $hasif = 1;
next;
}
if ($line =~ /^\s*%ifnarch(.*)$/) {
my $arch = $macros{'_target_cpu'} || 'unknown';
my @archs = grep {$_ eq $arch} split(/\s+/, $1);
$skip = 1 if @archs;
+ $hasif = 1;
next;
}
if ($line =~ /^\s*%ifos(.*)$/) {
my $os = $macros{'_target_os'} || 'unknown';
my @oss = grep {$_ eq $os} split(/\s+/, $1);
$skip = 1 if !@oss;
+ $hasif = 1;
next;
}
if ($line =~ /^\s*%ifnos(.*)$/) {
my $os = $macros{'_target_os'} || 'unknown';
my @oss = grep {$_ eq $os} split(/\s+/, $1);
$skip = 1 if @oss;
+ $hasif = 1;
next;
}
if ($line =~ /^\s*%if(.*)$/) {
my ($v, $r) = expr($1);
$v = 0 if $v && $v eq '\"\"';
$skip = 1 unless $v;
+ $hasif = 1;
next;
}
if ($main_preamble && ($line =~ /^Name:\s*(\S+)/i)) {
$packvers = $1;
$macros{'version'} = $packvers;
}
+ if ($main_preamble && ($line =~ /^Release:\s*(\S+)/i)) {
+ $packrel = $1;
+ $macros{'release'} = $packrel;
+ }
+ if ($main_preamble && ($line =~ /^ExclusiveArch:\s*(\S+)/i)) {
+ $exclarch = $1;
+ }
if ($main_preamble && ($line =~ /^(BuildRequires|BuildConflicts|\#\!BuildIgnore):\s*(\S.*)$/i)) {
my $what = $1;
my $deps = $2;
+ $$ifdeps = 1 if $ifdeps && $hasif;
my @deps = $deps =~ /([^\s\[\(,]+)(\s+[<=>]+\s+[^\s\[,]+)?(\s+\[[^\]]+\])?[\s,]*/g;
if (defined($hasnfb)) {
next unless $xspec;
}
}
unshift @subpacks, $packname;
- return ($packname, $packvers, \@subpacks, @packdeps);
+ $ret->{'name'} = $packname;
+ $ret->{'version'} = $packvers;
+ $ret->{'release'} = $packrel if defined $packrel;
+ $ret->{'subpacks'} = \@subpacks;
+ $ret->{'exclarch'} = $exclarch if defined $exclarch;
+ $ret->{'deps'} = \@packdeps;
+ return $ret;
}
###########################################################################
sub read_dsc {
my ($bconf, $fn) = @_;
- local *F;
- open(F, '<', $fn) || return ();
- my @control = <F>;
- close F;
- chomp @control;
+ my $ret;
+ my @control;
+ if (ref($fn) eq 'ARRAY') {
+ @control = @$fn;
+ } else {
+ local *F;
+ if (!open(F, '<', $fn)) {
+ $ret->{'error'} = "$fn: $!";
+ return $ret;
+ }
+ @control = <F>;
+ close F;
+ chomp @control;
+ }
splice(@control, 0, 3) if @control > 3 && $control[0] =~ /^-----BEGIN/;
my $name;
my $version;
push @deps, map {"-$_"} @d;
}
}
- return ($name, $version, undef, @deps);
+ $ret->{'name'} = $name;
+ $ret->{'version'} = $version;
+ $ret->{'deps'} = \@deps;
+ return $ret;
}
###########################################################################
#
# (c) 1997-2006 SuSE GmbH Nuernberg, Germany
+test -z "$BUILD_DIR" && BUILD_DIR=/usr/lib/build
test -z "$BUILD_ROOT" && BUILD_ROOT=/var/tmp/build-root
test -z "$BUILD_RPMS" && BUILD_RPMS=/media/dvd/suse
test -z "$BUILD_ARCH" && {
BUILD_ARCH=`uname -m`
test i686 = "$BUILD_ARCH" && BUILD_ARCH=i586
}
-export BUILD_ARCH BUILD_ROOT BUILD_RPMS
+export BUILD_ARCH BUILD_ROOT BUILD_RPMS BUILD_DIR
-export BUILD_DIR=/usr/lib/build
-#export BUILD_DIR=/suse/mls/xenbuild
export PATH=$BUILD_DIR:$PATH
# This is for insserv
REASON=
NOROOTFORBUILD=
LOGFILE=
+KILL=
if test "$0" = "/.build/build" ; then
BUILD_ROOT=/
*-clean)
CLEAN_BUILD=true
;;
+ *-kill)
+ KILL=true
+ ;;
*-rpms)
BUILD_RPMS="$ARG"
if [ -z "$BUILD_RPMS" ] ; then
cleanup_and_exit 1
}
+if test -n "$KILL" ; then
+ test -z "$SRCDIR" || usage
+ if test -z "$XENIMAGE" ; then
+ if ! $BUILD_DIR/killchroot -s 9 $BUILD_ROOT ; then
+ echo "could not kill build in $BUILD_ROOT"
+ exit 1
+ fi
+ else
+ XENID="${XENIMAGE%/root}"
+ XENID="${XENID##*/}"
+ if xm list "$XENID" >/dev/null 2>&1 ; then
+ if ! xm destroy "$XENID" ; then
+ echo "could not kill xen build $XENID"
+ exit 1
+ fi
+ fi
+ fi
+ exit 0
+fi
+
case $BUILD_ARCH in
i686) BUILD_ARCH="i686:i586:i486:i386" ;;
i586) BUILD_ARCH="i586:i486:i386" ;;
Preinstall: aaa_base acl attr bash bzip2 coreutils db diffutils
Preinstall: filesystem fillup glibc grep insserv libacl libattr
-Preinstall: libgcc libnscd libxcrypt m4 ncurses pam
+Preinstall: libgcc41 libnscd libxcrypt m4 ncurses pam
Preinstall: permissions popt pwdutils readline rpm sed tar zlib
-Required: autoconf automake binutils bzip2 db gcc gdbm gettext glibc
-Required: libtool ncurses perl rpm zlib
+Required: autoconf automake binutils bzip2 db gcc gcc41
+Required: gdbm gettext glibc libtool ncurses perl rpm zlib
-Support: bind-libs bind-utils bison cpio cpp cracklib cvs cyrus-sasl
+Support: audit-libs bind-libs
+Support: bind-utils bison cpio cpp cpp41 cracklib cvs cyrus-sasl
Support: e2fsprogs file findutils flex gawk gdbm-devel gettext-devel
Support: glibc-devel glibc-locale gpm groff gzip info klogd less
-Support: libcom_err libstdc++ libzio make man mktemp module-init-tools
+Support: libcom_err libltdl libmudflap41 libstdc++41 libzio
+Support: linux-kernel-headers make man mktemp module-init-tools
Support: ncurses-devel net-tools netcfg openldap2-client openssl
Support: pam-modules patch procinfo procps psmisc rcs strace sysvinit
Support: tcpd texinfo timezone unzip util-linux vim zlib-devel
%ifnarch s390 s390x ppc ia64
Substitute: java2-devel-packages java-1_4_2-sun-devel update-alternatives
%else
- %ifnarch s390x
+ %ifnarch s390 ppc
Substitute: java2-devel-packages java-1_4_2-ibm-devel update-alternatives
- %else
+ %endif
+ %ifarch s390x
Substitute: java2-devel-packages java-1_4_2-ibm-devel xorg-x11-libs-32bit update-alternatives
%endif
+ %ifarch ia64
+Substitute: java2-devel-packages java-1_5_0-bea-devel update-alternatives
+ %endif
%endif
-Substitute: yast2-devel-packages docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer popt-devel sgml-skel update-desktop-files yast2 yast2-devtools yast2-packagemanager-devel yast2-perl-bindings yast2-testsuite
-
%ifarch x86_64 ppc64 s390x sparc64
Substitute: glibc-devel-32bit glibc-devel-32bit glibc-32bit
%else
%fillup_prereq fillup coreutils
%suseconfig_fonts_prereq perl aaa_base
%install_info_prereq info
-%suse_version 1001
+%kernel_module_package_buildreq kernel-source kernel-syms
+%suse_version 1020
%sles_version 0
%ul_version 0
%do_profiling 1