Add support for archives without Packages.gz and Sources.gz

Try .xz files too
This commit is contained in:
Steve McIntyre 2016-11-15 09:06:41 +00:00
parent 413b82da73
commit a55bc64a77
11 changed files with 87 additions and 48 deletions

View File

@ -78,6 +78,7 @@ merge_package_lists=$(BASEDIR)/tools/merge_package_lists
update_popcon=$(BASEDIR)/tools/update_popcon
grab_source_list=$(BASEDIR)/tools/grab_source_list
which_deb=$(BASEDIR)/tools/which_deb
catz=$(BASEDIR)/tools/catz
BDIR=$(TDIR)/$(CODENAME)
TASKDIR=$(BDIR)/tasks
@ -236,13 +237,13 @@ $(ADIR)/status:
:> $(ADIR)/$(CODENAME)-backports-$$ARCH/status ; \
fi; \
else \
zcat $(MIRROR)/dists/$(CODENAME)/main/binary-$$ARCH/Packages.gz | \
$(catz) $(MIRROR)/dists/$(CODENAME)/main/binary-$$ARCH/Packages.*z* | \
perl -000 -ne 's/^(Package: .*)$$/$$1\nStatus: install ok installed/m; print if (/^Priority: (required|important|standard)/m or /^Section: base/m);' \
>> $(ADIR)/$(CODENAME)-$$ARCH/status ; \
|sort | uniq >> $(ADIR)/$(CODENAME)-$$ARCH/status ; \
if [ "$$BACKPORTS"x != ""x ] ; then \
zcat $(MIRROR)/dists/$(CODENAME)/main/binary-$$ARCH/Packages.gz | \
$(catz) $(MIRROR)/dists/$(CODENAME)/main/binary-$$ARCH/Packages.*z* | \
perl -000 -ne 's/^(Package: .*)$$/$$1\nStatus: install ok installed/m; print if (/^Priority: (required|important|standard)/m or /^Section: base/m);' \
>> $(ADIR)/$(CODENAME)-backports-$$ARCH/status ; \
|sort | uniq >> $(ADIR)/$(CODENAME)-backports-$$ARCH/status ; \
fi; \
fi; \
done;

2
debian/changelog vendored
View File

@ -5,6 +5,8 @@ debian-cd (3.1.19) UNRELEASED; urgency=medium
* Add workaround for dosfstools issue (#823881)
* Add support for adding backports into a build
* Remove obsolete dedicated_source script
* Add support for archives without Packages.gz and Sources.gz - try .xz
files too
[ Cyril Brulebois ]
* Only export WGET_OPTS="--ca-directory /etc/ssl/ca-debian/" when this

14
tools/catz Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
for file in $@; do
if [ -f $file ]; then
case $file in
*.gz)
zcat -f $file;;
*.xz)
xzcat -f $file;;
esac
fi
done

View File

@ -49,23 +49,31 @@ foreach my $arch (@ARCHES) {
(my $cpparch = $arch) =~ s/-/_/g;
my $output = '';
for my $component ( @components ) {
my $packagefile="$mirror_path/$component/debian-installer/binary-$arch/Packages.gz";
my $pgz="$mirror_path/$component/debian-installer/binary-$arch/Packages.gz";
my $pxz="$mirror_path/$component/debian-installer/binary-$arch/Packages.xz";
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;
$pgz="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.gz";
$pxz="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.xz";
}
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;
if (-f $pgz) {
foreach my $udeb (map { chomp; $_ } `zcat $pgz | awk '/^Package:/ {print \$2}'`) {
$output .= "$udeb\n" unless grep { $udeb =~ /^${_}$/ } @exclude;
}
} elsif (-f $pxz) {
foreach my $udeb (map { chomp; $_ } `xzcat $pxz | awk '/^Package:/ {print \$2}'`) {
$output .= "$udeb\n" unless grep { $udeb =~ /^${_}$/ } @exclude;
}
} else {
print "Missing package file for $arch/$component.\n";
next;
}
}
next unless $output;
print OUT "#ifdef ARCH_$cpparch\n";
print OUT $output;

View File

@ -35,11 +35,13 @@ if (!defined($codename) || !defined($mirror) ||
foreach $arch (split(' ', $archlist)) {
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.xz";
}
if (defined($localdebs)) {
foreach $arch (split(' ', $archlist)) {
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.xz";
}
}
@ -56,7 +58,7 @@ print OUT " */\n";
print "$0: Checking for firmware packages:\n";
open (INPKG, "zcat $pkgfiles |") or die "Can't read input package files: $!\n";
open (INPKG, "\$BASEDIR/tools/catz $pkgfiles |") or die "Can't read input package files: $!\n";
$/ = ''; # Browse by paragraph
sub contains_firmware($$) {

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# grab_md5
# (c) 2004 Steve McIntyre <steve@einval.com>
# (c) 2004-2016 Steve McIntyre <steve@einval.com>
#
# GPL v2
#
@ -33,10 +33,10 @@ do
case $ARCH in
source)
FILES=`find $LOCATIONS -name Sources.gz`
FILES=`find $LOCATIONS -name Sources.gz -o -name Sources.xz`
echo "Using MD5 sums from Sources files:"
echo $FILES
zcat -f $FILES | MIRROR=$MIRROR perl -ne '
$BASEDIR/tools/catz $FILES | MIRROR=$MIRROR perl -ne '
chomp;
my %files;
my $dir;
@ -62,15 +62,16 @@ do
}' | sort | uniq >> $OUT
;;
*)
FILES=`find $LOCATIONS -name Packages.gz | grep binary-$ARCH`
FILES=`find $LOCATIONS -name Packages.gz \
-o -name Packages.xz | grep binary-$ARCH`
echo "Using MD5 sums from Packages files:"
echo $FILES
NUM_FILES=`echo $FILES | wc -w`
NUM_FILES=`echo $FILES| wc -w`
if [ $NUM_FILES -eq 1 ] ; then
echo "No files found for arch $ARCH. Abort!"
exit 1
fi
zcat -f $FILES | MIRROR=$MIRROR perl -ne '
catz $FILES | MIRROR=$MIRROR perl -ne '
chomp;
my $mirror = $ENV{"MIRROR"};
my $filename;

View File

@ -25,8 +25,8 @@ if [ "$OMIT_MANUAL" != 1 ]; then
INSTALLDIR=$DIR/$DOCDIR/manual/$ARCH
fi
INSTALLGUIDE=$(zcat $MIRROR/dists/$CODENAME/main/binary-$ARCH//Packages.gz | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p")
INSTALLGUIDE=$($BASEDIR/tools/catz $MIRROR/dists/$CODENAME/main/binary-$ARCH//Packages.*z* | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p" | sort | uniq)
if [ -f "$MIRROR/$INSTALLGUIDE" ]; then
rm -rf $MANTDIR

View File

@ -25,7 +25,7 @@ fi
rm -rf $TMPDIR/firmware
mkdir -p $TMPDIR/firmware
FILES=`zcat ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.gz | \
FILES=`$BASEDIR/tools/catz ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.*z* | \
grep-dctrl -Pe '.*(firmware|microcode).*' -s Filename -n | sort -u`
for FILE in $FILES; do

View File

@ -25,8 +25,8 @@ if [ "$OMIT_MANUAL" != 1 ]; then
INSTALLDIR=$DIR/$DOCDIR/manual/$ARCH
fi
INSTALLGUIDE=$(zcat $MIRROR/dists/$CODENAME/main/binary-$ARCH//Packages.gz | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p")
INSTALLGUIDE=$($BASEDIR/tools/catz $MIRROR/dists/$CODENAME/main/binary-$ARCH//Packages.*z* | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p" | sort | uniq)
if [ -f "$MIRROR/$INSTALLGUIDE" ]; then
rm -rf $MANTDIR

View File

@ -25,8 +25,8 @@ if [ "$OMIT_MANUAL" != 1 ]; then
INSTALLDIR=$DIR/$DOCDIR/manual/$ARCH
fi
INSTALLGUIDE=$(zcat $MIRROR/dists/$CODENAME/main/binary-$ARCH//Packages.gz | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p")
INSTALLGUIDE=$($BASEDIR/tools/catz $MIRROR/dists/$CODENAME/main/binary-$ARCH/Packages.*z* | \
sed -n "s/Filename: \(pool\/main\/i\/installation-guide\/installation-guide-$ARCH.*deb\)$/\1/p" | sort | uniq)
if [ -f "$MIRROR/$INSTALLGUIDE" ]; then
rm -rf $MANTDIR

View File

@ -74,20 +74,27 @@ sub grab_bin_info {
if ( $component eq 'local' and $ENV{LOCALDEBS} ) {
$pgz = "$ENV{LOCALDEBS}/dists/$codename/local/binary-$arch/Packages.gz";
}
my $pxz = "$pth/$component/binary-$arch/Packages.xz";
if ( $component eq 'local' and $ENV{LOCALDEBS} ) {
$pgz = "$ENV{LOCALDEBS}/dists/$codename/local/binary-$arch/Packages.xz";
}
if (-e $pgz) {
open(PFILE, "zcat $pgz |") or
die "Failed to read Packages file $pgz";
while (defined($match = <PFILE>)) {
if (($match =~ /^Package: \Q$pkgname\E$/m)) {
$result = $match;
close PFILE;
return $result;
}
}
# Fell through
close PFILE;
}
} elsif (-e $pxz) {
open(PFILE, "xzcat $pxz |") or
die "Failed to read Packages file $pxz";
} else {
die "Can't find a working Packages file, tried $pgz and $pxz\n";
}
while (defined($match = <PFILE>)) {
if (($match =~ /^Package: \Q$pkgname\E$/m)) {
$result = $match;
close PFILE;
return $result;
}
}
close PFILE;
}
return "";
}
@ -103,21 +110,25 @@ sub grab_src_info {
for my $component ( @components ) {
my $pgz = "$pth/$component/source/Sources.gz";
my $pxz = "$pth/$component/source/Sources.xz";
if (-e $pgz) {
open(PFILE, "zcat $pgz |") or
die "Failed to read Sources file $pgz";
while (defined($match = <PFILE>)) {
if (($match =~ /^Package: \Q$pkgname\E$/m)) {
$result = $match;
close PFILE;
return $result;
}
}
# Fell through
close PFILE;
}
} elsif (-e $pxz) {
open(PFILE, "xzcat $pxz |") or
die "Failed to read Sources file $pxz";
} else {
die "Can't find a working Sources file, tried $pgz and $pxz\n";
}
while (defined($match = <PFILE>)) {
if (($match =~ /^Package: \Q$pkgname\E$/m)) {
$result = $match;
close PFILE;
return $result;
}
}
close PFILE;
}
return "";
}