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,46 +24,60 @@ 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"};
/^Files:/ { my $filename;
in_files = 1 while (<>) {
next if (m/^ ([[:xdigit:]]{32}) (\d+) (\S+)/sg) {
} $files{$3}{"md5"} = $1;
/^ / { $files{$3}{"size"} = $2;
if (in_files) { }
gsub("^ ", "", $0) if (m/^Directory: (\S+)/sg) {
MD5 = $1 $dir = $1;
SIZE = $2 }
FILE = $3 if (m/^$/) {
printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE); for $filename (keys %files) {
next printf("%s %12s %s/%s/%s\n",
} $files{$filename}{"md5"},
} $files{$filename}{"size"},
/^[^ ]/ { $mirror, $dir, $filename);
in_files = 0 }
FILE = "" undef %files;
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
/^Size:/ { fi
SIZE = $2 zcat -f $FILES | MIRROR=$MIRROR perl -ne '
} chomp;
/^MD5sum:/ { my $mirror = $ENV{"MIRROR"};
MD5 = $2 my $filename;
printf("%s %12d %s/%s\n", MD5, SIZE, MIRROR, FILE) my $size;
}' | sort | uniq >> $OUT 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" # 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...
for VER in $MIRROR/dists/$DI_CODENAME/main/installer-$ARCH/* for VER in $MIRROR/dists/$DI_CODENAME/main/installer-$ARCH/*
@ -82,10 +96,6 @@ do
fi fi
done done
;; ;;
*)
echo "Unknown arch/source $ARCH!"
exit 1
;;
esac esac
done done