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 * tools/make_image: generate list files while we have the CD trees
available 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 -- Frans Pop <fjp@debian.org> Sat, 13 Jun 2009 16:48:51 +0200
debian-cd (3.1.1) unstable; urgency=high debian-cd (3.1.1) unstable; urgency=high

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