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 * 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. to try and put that on i386 image sets before linux-image-amd64.
Closes: #622622 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 -- 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` FILES=`find $LOCATIONS -name Sources.gz`
echo "Using MD5 sums from Sources files:" echo "Using MD5 sums from Sources files:"
echo $FILES echo $FILES
zcat -f $FILES | awk -v MIRROR=$MIRROR ' zcat -f $FILES | MIRROR=$MIRROR perl -ne '
/^Directory:/ { chomp;
DIR = $2 my %files;
next 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:/ { if (m/^Directory: (\S+)/sg) {
in_files = 1 $dir = $1;
next
} }
/^ / { if (m/^$/) {
if (in_files) { for $filename (keys %files) {
gsub("^ ", "", $0) printf("%s %12s %s/%s/%s\n",
MD5 = $1 $files{$filename}{"md5"},
SIZE = $2 $files{$filename}{"size"},
FILE = $3 $mirror, $dir, $filename);
printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE);
next
} }
undef %files;
} }
/^[^ ]/ {
in_files = 0
FILE = ""
DIR = ""
}' | sort | uniq >> $OUT }' | 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` FILES=`find $LOCATIONS -name Packages.gz | grep binary-$ARCH`
echo "Using MD5 sums from Packages files:" echo "Using MD5 sums from Packages files:"
echo $FILES echo $FILES
zcat -f $FILES | awk -v MIRROR=$MIRROR ' NUM_FILES=`echo $FILES | wc -w`
/^Filename:/ { if [ $NUM_FILES -eq 1 ] ; then
FILE = $2 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:/ { if (m/^Size: (\S+)/sg) {
SIZE = $2 $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 }' | sort | uniq >> $OUT
# Use the new D-I images. Do NOT use the "current" # Use the new D-I images. Do NOT use the "current"
# link; it causes problems with overlaid files... # link; it causes problems with overlaid files...
@ -82,10 +96,6 @@ do
fi fi
done done
;; ;;
*)
echo "Unknown arch/source $ARCH!"
exit 1
;;
esac esac
done done