NOROOTFORBUILD=
LOGFILE=
KILL=
+CHANGELOG=
if test "$0" = "/.build/build" ; then
BUILD_ROOT=/
echo "$ARG does not take an argument"
cleanup_and_exit
;;
+ *-changelog)
+ CHANGELOG=true
+ ;;
-*)
echo Unknown Option "$PARAM". Exit.
cleanup_and_exit 1
fi
case $BUILD_ARCH in
-i686) BUILD_ARCH="i686:i586:i486:i386" ;;
-i586) BUILD_ARCH="i586:i486:i386" ;;
-i486) BUILD_ARCH="i486:i386" ;;
-x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
+ i686) BUILD_ARCH="i686:i586:i486:i386" ;;
+ i586) BUILD_ARCH="i586:i486:i386" ;;
+ i486) BUILD_ARCH="i486:i386" ;;
+ x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
esac
if test "$BUILD_ARCH" != "${BUILD_ARCH#i686}" ; then
cpuflags=`grep ^flags /proc/cpuinfo`
DO_INIT=true
fi
+ if test -n "$CHANGELOG" ; then
+ rm -f $BUILD_ROOT/.build-changelog
+ if test "$SPECFILE" = "${SPECFILE%.dsc}" ; then
+ $BUILD_DIR/changelog2spec --spec "$MYSRCDIR/$SPECFILE" > $BUILD_ROOT/.build-changelog || rm -f $BUILD_ROOT/.build-changelog
+ fi
+ fi
+
if test -n "$XENIMAGE" ; then
# do fist stage of init_buildsystem
echo init_buildsystem $USEUSEDFORBUILD $RPMLIST $SPECFILE $ADDITIONAL_PACKS ...
if test "$SPECFILE" = "${SPECFILE%.dsc}" ; then
# do buildrequires/release substitution
- substitutedeps $RELEASE --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" "$BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE" "$BUILD_ROOT/.spec.new" || cleanup_and_exit 1
+ CHANGELOGARGS=
+ test -n "$CHANGELOG" -a -f "$BUILD_ROOT/.build-changelog" && CHANGELOGARGS="--changelog $BUILD_ROOT/.build-changelog"
+ substitutedeps $RELEASE --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" $CHANGELOGARGS "$BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE" "$BUILD_ROOT/.spec.new" || cleanup_and_exit 1
# extract macros from configuration
getmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" > $BUILD_ROOT/root/.rpmmacros
test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros
--- /dev/null
+#!/usr/bin/perl -w
+
+#
+# Convert a SUSE changelog file to rpm format
+#
+
+use Date::Parse;
+use Time::Zone;
+
+use strict;
+
+my @wday = qw{Sun Mon Tue Wed Thu Fri Sat};
+my @mon = qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec};
+
+if (@ARGV == 2 && $ARGV[0] eq '--spec') {
+ die("bad --spec arg\n") unless $ARGV[1] =~ /^(.*)\/([^\/]+)\.spec$/;
+ my ($dir, $spec) = ($1, $2);
+ opendir(D, $dir) || die("$dir: $!\n");
+ my @changes = grep {/\.changes$/} readdir(D);
+ closedir(D);
+ @changes = sort {length($a) <=> length($b) || $a cmp $b} @changes;
+ exit(1) unless @changes;
+ if (@changes > 1) {
+ while ($spec ne '') {
+ my @c = grep {/\Q$spec\E/} @changes;
+ if (@c) {
+ @changes = @c;
+ last;
+ }
+ last unless $spec =~ s/[-.][^-.]*$//;
+ }
+ }
+ @ARGV = ("$dir/$changes[0]");
+}
+
+my $ok;
+my $zone;
+while (<>) {
+ chomp;
+ next if (/^--------------/);
+ next if (/^========================/);
+ if (/^(?:\* )?([A-Za-z]+\s+[A-Za-z]+\s+[0-9].*[0-9][0-9][0-9][0-9])(.*\@.*$)/) {
+ my $dt = $1;
+ my $who = $2;
+ $dt = lc($dt);
+ $who =~ s/^\s+//;
+ $who =~ s/^-\s*//;
+ $dt =~ /([0-9][0-9][0-9][0-9])/;
+ my $year = $1;
+ if (!defined($zone) && $dt =~ /\s([a-z]{3,4})(dst)?\s[0-9]{4}/) {
+ my $dst = $2;
+ $zone = tz_offset($1);
+ $zone += 3600 if defined($zone) && $dst;
+ }
+ my $tdt = str2time($dt);
+ $dt =~ /([0-9]+)/;
+ my $day = $1;
+ if (!$tdt) {
+ if ($dt =~ /([a-z]{3})\s+([a-z]{3})/) {
+ $tdt = str2time("$1 $2 $day $year");
+ }
+ }
+ if (!$tdt) {
+ if ($dt =~ /([a-z]{3})/) {
+ $tdt = str2time("$1 $day $year");
+ }
+ }
+ if (!$tdt) {
+ $tdt = str2time("$year-1-1");
+ }
+ $tdt += 12 * 3600 unless $dt =~ /\d:\d/; # 12:00 if not specified
+ my @gm = gmtime($tdt + ($zone || 0));
+ printf("* %s %s %2d %4d %s\n", $wday[$gm[6]], $mon[$gm[4]], $gm[3], $gm[5] + 1900, $who);
+ $ok = 1;
+ next;
+ }
+ next unless $ok;
+ s/\s+$//;
+ next if $_ eq '';
+ s/%/%%/g;
+ s/^(\s*)(\#\d*)/$1\[$2\]/; # lines starting with hash are a comment
+ s/^\s*-/-/ if $ok == 1; # obsolete?
+ s/^\s*\*\s*/ * /;
+ if (!/^-/) {
+ s/^\s+-\s*/ - /;
+ s/^\s*/ / unless s/^ \s*/ /;
+ }
+ $ok = 2;
+ print "$_\n";
+}
Ignore: gtk2:libpng,libtiff
Ignore: libgnomecanvas-devel:glib-devel
Ignore: libgnomeui:gnome-icon-theme,shared-mime-info
-Ignore: scrollkeeper:docbook_4,sgml-skel
+Ignore: scrollkeeper:docbook_4
Ignore: gnome-desktop:libgnomesu,startup-notification
Ignore: python-devel:python-tk
Ignore: gnome-pilot:gnome-panel
fi
fi
if test -n "$2" ; then
+ chroot $BUILD_ROOT /sbin/ldconfig 2>/dev/null
for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
echo "running $PKG preinstall script"
mkdir -p $BUILD_ROOT/var/lib/rpm || cleanup_and_exit 1
mkdir -p $BUILD_ROOT/usr/src/packages/SOURCES || cleanup_and_exit 1
mkdir -p $BUILD_ROOT/etc || cleanup_and_exit 1
+ mkdir -p $BUILD_ROOT/proc || cleanup_and_exit 1
test -f $BUILD_ROOT/etc/HOSTNAME || hostname -f > $BUILD_ROOT/etc/HOSTNAME
if test $PSUF = deb ; then
mkdir -p $BUILD_ROOT/var/lib/dpkg
preinstall ${PKG##*/}
done
test -c $BUILD_ROOT/dev/null || create_devs
+ test -e $BUILD_ROOT/etc/ld.so.conf || cp $BUILD_ROOT/etc/ld.so.conf.in $BUILD_ROOT/etc/ld.so.conf
if test -z "$PREPARE_XEN" ; then
preinstall '' true
init_db
mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
PROC_IS_MOUNTED=true
-test -e $BUILD_ROOT/etc/ld.so.conf || \
- cp $BUILD_ROOT/etc/ld.so.conf.in $BUILD_ROOT/etc/ld.so.conf
-chroot $BUILD_ROOT /sbin/ldconfig 2> /dev/null
-
#
# get list and ids of already installed rpms
#
use Build;
-my ($dist, $rpmdeps, $archs, $configdir, $release);
+my ($dist, $rpmdeps, $archs, $configdir, $release, $changelog);
while (@ARGV) {
if ($ARGV[0] eq '--dist') {
$release = shift @ARGV;
next;
}
+ if ($ARGV[0] eq '--changelog') {
+ shift @ARGV;
+ $changelog = shift @ARGV;
+ next;
+ }
last;
}
die("Usage: substitutedeps --dist <dist> --archpath <archpath> [--configdir <configdir>] <specin> <specout>\n") unless @ARGV == 2;
open(F, '>', $newspec) || die("$newspec: $!\n");
+my $used;
+my $inchangelog = 0;
for my $l (@$xspec) {
- if (!ref($l)) {
- $l =~ s/^(Release:\s*).*/$1$release/i if $release;
- if ($l !~ /^BuildRequires:/i) {
- print F "$l\n";
- next;
- }
- $l = [$l, $l];
- } else {
+ $used = 1;
+ if (ref($l)) {
if (!defined($l->[1])) {
- $l->[0] =~ s/^(Release:\s*).*/$1$release/i if $release;
- print F "$l->[0]\n";
- next;
- }
- $l->[1] =~ s/^(Release:\s*).*/$1$release/i if $release;
- if ($l->[1] !~ /^BuildRequires:/i) {
- print F "$l->[1]\n";
- next;
+ $used = 0;
+ $l = $l->[0];
+ } else {
+ $l = $l->[1];
}
}
- my $r = $l->[1];
+
+ if ($inchangelog) {
+ $inchangelog = 0 if $l =~ /^\s*%[^%]/;
+ next if $inchangelog;
+ }
+ if ($changelog && ($l =~ /\s*\%changelog\b/)) {
+ $inchangelog = 1;
+ next;
+ }
+
+ $l =~ s/^(Release:\s*).*/$1$release/i if $release;
+
+ if (!$used || ($l !~ /^BuildRequires:/i)) {
+ print F "$l\n";
+ next;
+ }
+
+ my $r = $l;
$r =~ s/^[^:]*:\s*//;
my @deps = $r =~ /([^\s\[\(,]+)(\s+[<=>]+\s+[^\s\[,]+)?[\s,]*/g;
my @ndeps = ();
if ($replace) {
print F "BuildRequires: ".join(' ', @ndeps)."\n" if @ndeps;
} else {
- print F "$l->[1]\n";
+ print F "$l\n";
}
}
+
+if ($changelog) {
+ print F "%changelog\n";
+ if (open(CF, '<', $changelog)) {
+ while(<CF>) {
+ print F $_;
+ }
+ close CF;
+ }
+}
+
close(F) || die("close: $!\n");
exit(0);