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

This commit is contained in:
Steve McIntyre 2011-06-09 16:18:27 +00:00
parent 11bfba0e9d
commit 5095647348
2 changed files with 53 additions and 40 deletions

View File

@ -12,6 +12,9 @@ debian-cd (3.1.1lenny1) UNRELEASED; urgency=low
* tools/make_image: generate list files while we have the CD trees
available
[ Backports from trunk ]
* New version of tools/grab_md5 to cope with new Packages.gz files layout
-- Frans Pop <fjp@debian.org> Sat, 13 Jun 2009 16:48:51 +0200
debian-cd (3.1.1) unstable; urgency=high

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)
*)
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