backport latest trunk version of grab_md5 for new Packages.gz layout

This commit is contained in:
Steve McIntyre 2011-06-09 16:18:37 +00:00
parent 5095647348
commit f30b595410
2 changed files with 51 additions and 40 deletions

View File

@ -30,6 +30,7 @@ debian-cd (3.1.6) UNRELEASED-backport; urgency=low
* Add linux-image-2.6-686-bigmem to tasks/<release>/interesting-fromcd23
to try and put that on i386 image sets before linux-image-amd64.
Closes: #622622
* New version of tools/grab_md5 to cope with new Packages.gz files layout
-- Raphaël Hertzog <hertzog@debian.org> Fri, 04 Feb 2011 09:59:21 +0100

View File

@ -24,45 +24,59 @@ 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
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;
}
/^Files:/ {
in_files = 1
next
if (m/^Directory: (\S+)/sg) {
$dir = $1;
}
/^ / {
if (in_files) {
gsub("^ ", "", $0)
MD5 = $1
SIZE = $2
FILE = $3
printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE);
next
if (m/^$/) {
for $filename (keys %files) {
printf("%s %12s %s/%s/%s\n",
$files{$filename}{"md5"},
$files{$filename}{"size"},
$mirror, $dir, $filename);
}
undef %files;
}
/^[^ ]/ {
in_files = 0
FILE = ""
DIR = ""
}' | sort | uniq >> $OUT
;;
alpha|amd64|arm|armel|hppa|i386|ia64|m68k|mips|mipsel|powerpc|s390|sparc|kfreebsd-amd64|kfreebsd-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
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 '
chomp;
my $mirror = $ENV{"MIRROR"};
my $filename;
my $size;
my $md5;
while (<>) {
if (m/^Filename: (\S+)/sg) {
$filename = $1;
}
/^Size:/ {
SIZE = $2
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);
}
/^MD5sum:/ {
MD5 = $2
printf("%s %12d %s/%s\n", MD5, SIZE, MIRROR, FILE)
}' | sort | uniq >> $OUT
# Use the new D-I images. Do NOT use the "current"
# link; it causes problems with overlaid files...
@ -82,10 +96,6 @@ do
fi
done
;;
*)
echo "Unknown arch/source $ARCH!"
exit 1
;;
esac
done