diff --git a/debian/changelog b/debian/changelog index 5be209ff..c3b6cafb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,9 @@ debian-cd (3.1.6) UNRELEASED; urgency=low Closes: #622622 * update the URL for downloading i386 d-i dailies. * update the URL for downloading armel d-i dailies. + * tools/grab_md5: Improve Packages and Sources file parsing; cope with + differently-formed files that are still valid (don't assume field + ordering). Switch from awk to perl makes things much faster too! [ Aurelien Jarno ] * Add support for hurd-i386. Closes: #619211 diff --git a/tools/grab_md5 b/tools/grab_md5 index d4b8cf10..ac8b4621 100755 --- a/tools/grab_md5 +++ b/tools/grab_md5 @@ -24,46 +24,55 @@ do FILES=`find $LOCATIONS -name Sources.gz` echo "Using MD5 sums from Sources files:" echo $FILES - zcat -f $FILES | awk -v MIRROR=$MIRROR ' - /^Directory:/ { - DIR = $2 - next - } - /^Files:/ { - in_files = 1 - next - } - /^ / { - if (in_files) { - gsub("^ ", "", $0) - MD5 = $1 - SIZE = $2 - FILE = $3 - printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE); - next - } - } - /^[^ ]/ { - in_files = 0 - FILE = "" - DIR = "" - }' | sort | uniq >> $OUT + zcat -f $FILES | MIRROR=$MIRROR perl -ne ' + chomp; + my %files; + my $dir; + my $mirror = $ENV{"MIRROR"}; + my $filename; + while (<>) { + if (m/^ ([[:xdigit:]]{32}) (\d+) (\S+)/sg) { + $files{$3}{"md5"} = $1; + $files{$3}{"size"} = $2; + } + if (m/^Directory: (\S+)/sg) { + $dir = $1; + } + if (m/^$/) { + for $filename (keys %files) { + printf("%s %12s %s/%s/%s\n", + $files{$filename}{"md5"}, + $files{$filename}{"size"}, + $mirror, $dir, $filename); + } + undef %files; + } + }' | sort | uniq >> $OUT ;; alpha|amd64|arm|armel|hppa|i386|ia64|m68k|mips|mipsel|powerpc|s390|sparc|kfreebsd-amd64|kfreebsd-i386|hurd-i386) FILES=`find $LOCATIONS -name Packages.gz | grep binary-$ARCH` echo "Using MD5 sums from Packages files:" echo $FILES - zcat -f $FILES | awk -v MIRROR=$MIRROR ' - /^Filename:/ { - FILE = $2 - } - /^Size:/ { - SIZE = $2 - } - /^MD5sum:/ { - MD5 = $2 - printf("%s %12d %s/%s\n", MD5, SIZE, MIRROR, FILE) - }' | sort | uniq >> $OUT + zcat -f $FILES | MIRROR=$MIRROR perl -ne ' + chomp; + my $mirror = $ENV{"MIRROR"}; + my $filename; + my $size; + my $md5; + while (<>) { + if (m/^Filename: (\S+)/sg) { + $filename = $1; + } + if (m/^Size: (\S+)/sg) { + $size = $1; + } + if (m/^MD5sum: (\S+)/sg) { + $md5 = $1; + } + if (m/^$/) { + printf("%s %12s %s/%s\n", $md5, $size, $mirror, $filename); + } + }' | sort | uniq >> $OUT # Use the new D-I images. Do NOT use the "current" # link; it causes problems with overlaid files... for VER in $MIRROR/dists/$DI_CODENAME/main/installer-$ARCH/*