From cd5a1d2c9068daeacd52d82d4ac3831e5446136b Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Thu, 12 Feb 2009 00:22:17 +0000 Subject: [PATCH] * Merge patches from Jonathan Hall: + Add better support for extra components, improve non-i386 mirror support (Closes: 514237) + tools/update_tasks no longer assumes i386 for all builds (Closes: #513497) + tools/which_deb no longer assumes i386 for all builds (Closes: #513498) * For source-only builds, don't do any task updates as they're not useful anyway. * Last high-urgency upload, ready for Lenny! --- Makefile | 2 + debian/changelog | 14 ++++++- tools/generate_di_list | 65 +++++++++++++++++++---------- tools/make_disc_trees.pl | 2 +- tools/update_tasks | 11 +++-- tools/which_deb | 88 ++++++++++++++++++++++++---------------- 6 files changed, 121 insertions(+), 61 deletions(-) diff --git a/Makefile b/Makefile index b326fbb0..7888be86 100755 --- a/Makefile +++ b/Makefile @@ -118,6 +118,7 @@ $(BDIR): $(ADIR): $(Q)mkdir -p $(ADIR) $(TASKDIR): +ifneq ($(ARCHES),source) $(Q)echo "Updating task files..." $(Q)mkdir -p $(TASKDIR) $(Q)echo "- copying task files from 'tasks/$(DI_CODENAME)/'" @@ -130,6 +131,7 @@ $(TASKDIR): $(BASEDIR)/tools/update_tasks; \ $(BASEDIR)/tools/generate_di_list; \ $(BASEDIR)/tools/generate_di+k_list +endif $(BDIR)/DATE: $(Q)date '+%Y%m%d' > $(BDIR)/DATE diff --git a/debian/changelog b/debian/changelog index def23ead..11831671 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -debian-cd (3.1.1) UNRELEASED; urgency=low +debian-cd (3.1.1) UNRELEASED; urgency=high [ Frans Pop ] * sparc: remove bogus default "append=cdrom" line from silo.conf template. @@ -13,7 +13,17 @@ debian-cd (3.1.1) UNRELEASED; urgency=low [ Otavio Salvador ] * do not exclude libaio1-udeb from CDs. - -- Frans Pop Tue, 20 Jan 2009 01:30:11 +0100 + [ Steve McIntyre ] + * Merge patches from Jonathan Hall: + + Add better support for extra components, improve non-i386 mirror + support (Closes: 514237) + + tools/update_tasks no longer assumes i386 for all builds (Closes: #513497) + + tools/which_deb no longer assumes i386 for all builds (Closes: #513498) + * For source-only builds, don't do any task updates as they're not + useful anyway. + * Last high-urgency upload, ready for Lenny! + + -- Steve McIntyre <93sam@debian.org> Wed, 11 Jan 2009 11:13:24 +0000 debian-cd (3.1.0) unstable; urgency=low diff --git a/tools/generate_di_list b/tools/generate_di_list index 0302bd47..f148d62b 100755 --- a/tools/generate_di_list +++ b/tools/generate_di_list @@ -5,9 +5,19 @@ die "Missing \$MIRROR variable" unless $ENV{MIRROR}; die "Missing \$DI_CODENAME variable" unless $ENV{DI_CODENAME}; die "Missing \$BASEDIR variable" unless $ENV{BASEDIR}; +die "Missing \$ARCHES variable" unless $ENV{ARCHES}; + +# Early exit if we're building a source-only CD +exit 0 if $ENV{ARCHES} =~ /^\s*source\s*$/; + +my @ARCHES; +if ( $ENV{ARCHES} ) { + push @ARCHES, 'i386' if $ENV{ARCHES} =~ /i386/; + push @ARCHES, 'amd64' if $ENV{ARCHES} =~ /amd64/; + push @ARCHES, grep { !/source|i386|amd64/ } split /\s+/, $ENV{ARCHES}; +} +@ARCHES = qw{i386 amd64} unless @ARCHES; -my @ARCHES=qw{alpha arm armel hppa hurd-i386 i386 ia64 mips mipsel - powerpc s390 sparc amd64}; my $DATE=`date`; chomp $DATE; open(OUT, ">debian-installer") || die "write: $!"; @@ -24,32 +34,45 @@ print OUT << "EOF"; EOF my @common_excludes = read_exclude("exclude-udebs"); +my $mirror_path = "$ENV{MIRROR}/dists/$ENV{DI_CODENAME}"; +my @components = qw(main); +push @components, 'contrib' if $ENV{CONTRIB}; +push @components, 'non-free' if $ENV{NONFREE}; +push @components, 'local' if $ENV{LOCAL}; foreach my $arch (@ARCHES) { - my $packagefile="$ENV{MIRROR}/dists/$ENV{DI_CODENAME}/main/debian-installer/binary-$arch/Packages.gz"; - unless (-f $packagefile) { - print "Missing package file for arch $arch.\n"; - next; - } (my $cpparch = $arch) =~ s/-/_/g; - print OUT "#ifdef ARCH_$cpparch\n"; - my @exclude = @common_excludes; - push @exclude, read_exclude("exclude-udebs-$arch") - if -e exclude_path("exclude-udebs-$arch"); -UDEB: foreach my $udeb (map { chomp; $_ } `zcat $packagefile | awk '/^Package:/ {print \$2}'`) { - foreach my $pattern (@exclude) { - if ($udeb =~ /^$pattern$/) { - next UDEB; - } - } - print OUT "$udeb\n"; - } - print OUT "#endif /* ARCH_$cpparch */\n"; + my $output = ''; + for my $component ( @components ) { + my $packagefile="$mirror_path/$component/debian-installer/binary-$arch/Packages.gz"; + if ( $component eq 'local' and $ENV{LOCALDEBS} ) { + $packagefile="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.gz"; + } + if (! -f $packagefile) { + print "Missing package file for $arch/$component.\n"; + next; + } + + my @exclude = @common_excludes; + push @exclude, read_exclude("exclude-udebs-$arch") + if -e exclude_path("exclude-udebs-$arch"); + + foreach my $udeb (map { chomp; $_ } `zcat $packagefile | awk '/^Package:/ {print \$2}'`) { + $output .= "$udeb\n" unless grep { $udeb =~ /^${_}$/ } @exclude; + } + } + next unless $output; + print OUT "#ifdef ARCH_$cpparch\n"; + print OUT $output; + print OUT "#endif /* ARCH_$cpparch */\n"; } sub read_exclude { my $file=exclude_path(shift); - open (IN, "<$file") || warn "failed to read exclude file $file"; + unless ( open (IN, "<$file") ) { + warn "failed to read exclude file $file"; + return; + } my @ret; while () { chomp; diff --git a/tools/make_disc_trees.pl b/tools/make_disc_trees.pl index 920676a8..eb5f51e5 100755 --- a/tools/make_disc_trees.pl +++ b/tools/make_disc_trees.pl @@ -735,7 +735,7 @@ sub Packages_dir { } $pdir = "$dir/dists/$codename/$dist"; - if ($section eq "debian-installer") { + if ($section and $section eq "debian-installer") { $pdir = "$dir/dists/$codename/$dist/debian-installer"; } return $pdir; diff --git a/tools/update_tasks b/tools/update_tasks index b8a44f56..8837b48a 100755 --- a/tools/update_tasks +++ b/tools/update_tasks @@ -149,10 +149,15 @@ update_essential_list () { }' | sort -s -n -k1 | cut -d: -f2 >> $file } -# We need to gunzip a copy of the appropriate Packages.gz file -# Assume i386, use the $CODENAME main Packages file +# Look for the coreutils package (which should exist in all archs, and is +# a non -all package) to determine a valid arch for the rest of this +# script +arch=$(which_deb $MIRROR $CODENAME coreutils binary | sed -e "s/\.deb//" -e "s/.*_//") +# We need to gunzip a copy of the appropriate Packages.gz file(s) TMP_PKG=$TDIR/Packages -zcat $MIRROR/dists/$CODENAME/main/binary-i386/Packages.gz > $TMP_PKG +zcat $MIRROR/dists/$CODENAME/main/binary-$arch/Packages.gz > $TMP_PKG +[ -n "$LOCAL" ] && zcat \ + $MIRROR/dists/$CODENAME/local/binary-$arch/Packages.gz >> $TMP_PKG # Now grab the appropriate tasksel package TASKSEL_DEB=$MIRROR/`mawk ' diff --git a/tools/which_deb b/tools/which_deb index b3ee5b0c..e2cbcc39 100755 --- a/tools/which_deb +++ b/tools/which_deb @@ -6,6 +6,16 @@ # the archive to meet a requirement in the debian-cd build use strict; +use List::Util qw{first}; +# Give prefernce to i386 and amd64, if specified, or if building a +# source-only CD. +my @ARCHES; +if ( $ENV{ARCHES} ) { + push @ARCHES, 'i386' if $ENV{ARCHES} =~ /i386/; + push @ARCHES, 'amd64' if $ENV{ARCHES} =~ /amd64/; + push @ARCHES, grep { !/source|i386|amd64/ } split /\s+/, $ENV{ARCHES}; +} +@ARCHES = qw{i386 amd64} unless @ARCHES; my ($mirror, $codename, $pkg, $pth, $output); @@ -13,7 +23,12 @@ $mirror = shift; $codename = shift; $pkg = shift; $output = shift; -$pth = "$mirror/dists/$codename/main"; +$pth = "$mirror/dists/$codename"; + +my @components = qw(main); +push @components, 'contrib' if $ENV{CONTRIB}; +push @components, 'non-free' if $ENV{NONFREE}; +push @components, 'local' if $ENV{LOCAL}; if (!defined ($output)) { $output = "binary"; @@ -27,23 +42,27 @@ sub grab_bin_info { my $match; my $result = ""; - my $pgz = "$pth/binary-$arch/Packages.gz"; - $/ = ''; # Browse by paragraph - if (-e $pgz) { - open(PFILE, "zcat $pgz |") or - die "Failed to read Packages file $pgz"; - - while (defined($match = )) { - if (($match =~ /^Package: \Q$pkgname\E$/m)) { - $result = $match; - close PFILE; - return $result; - } + for my $component ( @components ) { + my $pgz = "$pth/$component/binary-$arch/Packages.gz"; + if ( $component eq 'local' and $ENV{LOCALDEBS} ) { + $pgz = "$ENV{LOCALDEBS}/dists/$codename/local/binary-$arch/Packages.gz"; + } + if (-e $pgz) { + open(PFILE, "zcat $pgz |") or + die "Failed to read Packages file $pgz"; + + while (defined($match = )) { + if (($match =~ /^Package: \Q$pkgname\E$/m)) { + $result = $match; + close PFILE; + return $result; + } + } + # Fell through + close PFILE; } - # Fell through - close PFILE; } return ""; } @@ -55,23 +74,25 @@ sub grab_src_info { my $match; my $result = ""; - my $pgz = "$pth/source/Sources.gz"; - $/ = ''; # Browse by paragraph - if (-e $pgz) { - open(PFILE, "zcat $pgz |") or - die "Failed to read Sources file $pgz"; + for my $component ( @components ) { + my $pgz = "$pth/$component/source/Sources.gz"; - while (defined($match = )) { - if (($match =~ /^Package: \Q$pkgname\E$/m)) { - $result = $match; - close PFILE; - return $result; + if (-e $pgz) { + open(PFILE, "zcat $pgz |") or + die "Failed to read Sources file $pgz"; + + while (defined($match = )) { + if (($match =~ /^Package: \Q$pkgname\E$/m)) { + $result = $match; + close PFILE; + return $result; + } } + # Fell through + close PFILE; } - # Fell through - close PFILE; } return ""; } @@ -80,19 +101,18 @@ my $bin_deb = ""; my $pkgdata = ""; my $srcname = ""; -if ($pkg eq "debootstrap") { - $pkgdata = grab_bin_info($pth, "i386", $pkg); - -} elsif ($pkg eq "silo") { +if ($pkg eq "silo") { $pkgdata = grab_bin_info($pth, "sparc", $pkg); } elsif ($pkg eq "syslinux") { - $pkgdata = grab_bin_info($pth, "i386", "syslinux-common"); - if (length($pkgdata) < 3) { - $pkgdata = grab_bin_info($pth, "i386", "syslinux"); + first { $pkgdata = grab_bin_info($pth, $_, "syslinux-common") } @ARCHES; + if (length($pkgdata) < 3) { + first { $pkgdata = grab_bin_info($pth, $_, "syslinux") } @ARCHES; } } elsif ($pkg eq "yaboot") { $pkgdata = grab_bin_info($pth, "powerpc", $pkg); +} else { # Fallthrough for all other packages + first { $pkgdata = grab_bin_info($pth, $_, $pkg) } @ARCHES; } if (length($pkgdata) > 2) {