Use the new -md5-list JTE option to mkisofs to allow md5 checking at

image creation time rather than as a mirror-check step:

Added grab_md5 as a helper script to extract the filenames and MD5s
from Packages/Sources files

mirrorcheck target build now gone, replaced by mirrorcheck-binary and
mirrorcheck-source; updated build*.sh to cope with this.

Disable tools/mirror_check for now; actually remove it later.
This commit is contained in:
Steve McIntyre 2004-07-14 01:32:17 +00:00
parent 6fcab0af68
commit 22accde67a
5 changed files with 93 additions and 10 deletions

View File

@ -100,6 +100,7 @@ add_secured=$(BASEDIR)/tools/add_secured
md5sum=/usr/bin/md5sum.textutils
fastsums=$(BASEDIR)/tools/fast_sums
jigdo_cleanup=$(BASEDIR)/tools/jigdo_cleanup
grab_md5=$(BASEDIR)/tools/grab_md5
BDIR=$(TDIR)/$(CODENAME)-$(ARCH)
ADIR=$(APTTMP)/$(CODENAME)-$(ARCH)
@ -198,15 +199,17 @@ unstable-map:
# CLeans the current arch tree (but not packages selection info)
clean: ok bin-clean src-clean
bin-clean:
$(Q)rm -rf $(BDIR)/CD[1234567890]
$(Q)rm -rf $(BDIR)/CD[1234567890]*
$(Q)rm -rf $(BDIR)/*_NONUS
$(Q)rm -f $(BDIR)/*.filelist*
$(Q)rm -f $(BDIR)/packages-stamp $(BDIR)/bootable-stamp \
$(BDIR)/upgrade-stamp $(BDIR)/secured-stamp
$(BDIR)/upgrade-stamp $(BDIR)/secured-stamp \
$(BDIR)/md5-check
src-clean:
$(Q)rm -rf $(SDIR)/CD[1234567890]
$(Q)rm -rf $(SDIR)/CD[1234567890]*
$(Q)rm -rf $(SDIR)/*_NONUS
$(Q)rm -rf $(SDIR)/sources-stamp $(SDIR)/secured-stamp
$(Q)rm -rf $(SDIR)/sources-stamp $(SDIR)/secured-stamp \
$(SDIR)/md5-check
# Completely cleans the current arch tree
realclean: distclean
@ -873,6 +876,7 @@ bin-images: ok bin-md5list $(OUT)
-jigdo-template $(OUT)/$(CODENAME)-$(ARCH)-$$n.template \
-jigdo-map Debian=CD$$n/ \
-jigdo-exclude boot$$n \
-md5-list $(BDIR)/md5-check \
$(JIGDO_OPTS) $$opts CD$$n; \
elif [ "$(DOJIGDO)" = "2" ]; then \
echo $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \
@ -881,6 +885,7 @@ bin-images: ok bin-md5list $(OUT)
-jigdo-template $(OUT)/$(CODENAME)-$(ARCH)-$$n.template \
-jigdo-map Debian=CD$$n/ \
-jigdo-exclude boot$$n \
-md5-list $(BDIR)/md5-check \
$(JIGDO_OPTS) $$opts CD$$n; \
$(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \
-o /dev/null -v \
@ -920,7 +925,7 @@ src-images: ok src-md5list $(OUT)
-jigdo-jigdo $(OUT)/$(CODENAME)-src-$$n.jigdo \
-jigdo-template $(OUT)/$(CODENAME)-src-$$n.template \
-jigdo-map Debian=CD$$n/ \
-jigdo-exclude boot$$n \
-md5-list $(BDIR)/md5-check \
$(JIGDO_OPTS) $$opts CD$$n ; \
elif [ "$(DOJIGDO)" = "2" ]; then \
$(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \
@ -928,7 +933,7 @@ src-images: ok src-md5list $(OUT)
-jigdo-jigdo $(OUT)/$(CODENAME)-src-$$n.jigdo \
-jigdo-template $(OUT)/$(CODENAME)-src-$$n.template \
-jigdo-map Debian=CD$$n/ \
-jigdo-exclude boot$$n \
-md5-list $(BDIR)/md5-check \
$(JIGDO_OPTS) $$opts CD$$n ; \
fi; \
if [ "$(DOJIGDO)" != "0" ]; then \
@ -992,8 +997,19 @@ readme:
conf:
sensible-editor $(BASEDIR)/CONF.sh
mirrorcheck: ok apt-update
$(Q)$(apt) cache dumpavail | $(mirrorcheck)
mirrorcheck-binary: ok
rm -f $(BDIR)/md5-check.binary
$(Q)$(grab_md5) $(MIRROR) $(ARCH) $(CODENAME) $(BDIR)/md5-check
if [ -n "$(NONUS)" ]; then \
$(grab_md5) $(NONUS) $(ARCH) $(CODENAME) $(BDIR)/md5-check; \
fi
mirrorcheck-source: ok
rm -f $(SDIR)/md5-check.source
$(Q)$(grab_md5) $(MIRROR) source $(CODENAME) $(SDIR)/md5-check
if [ -n "$(NONUS)" ]; then \
$(grab_md5) $(NONUS) source $(CODENAME) $(SDIR)/md5-check; \
fi
update-popcon: tasks/popularity-contest-$(CODENAME)
tasks/popularity-contest-$(CODENAME):

View File

@ -17,7 +17,7 @@ if [ "$SKIPMIRRORCHECK" = "yes" ]; then
echo " ... WARNING: skipping mirror check"
else
echo " ... checking your mirror"
make mirrorcheck
make mirrorcheck-binary
if [ $? -gt 0 ]; then
echo "ERROR: Your mirror has a problem, please correct it." >&2
exit 1

View File

@ -15,7 +15,10 @@ do
make ${CODENAME}_status
echo " ... checking your mirror"
if [ "$SKIPMIRRORCHECK" != "yes" ] ; then
make mirrorcheck
make mirrorcheck-binary
if [ "$ARCH" = "i386" ]; then
make mirrorcheck-source
fi
else
echo "WARNING: skipping mirrorcheck"
fi

62
tools/grab_md5 Executable file
View File

@ -0,0 +1,62 @@
#!/bin/sh
#
# grab_md5
# (c) 2004 Steve McIntyre <steve@einval.com>
#
# GPL v2
#
# Parse Packages and Sources files out of a mirror and pre-process
# them into a single list ready for mkisofs to check later
MIRROR=$1
ARCH=$2
SUITE=$3
OUT=$4
case $ARCH in
source)
FILES=`find $MIRROR/dists/$SUITE/ -name Sources.gz`
echo -e "Using MD5 sums from Sources files:\n$FILES"
zcat -f $FILES | awk '
/^Directory:/ {
DIR = $2
next
}
/^Files:/ {
in_files = 1
next
}
/^ / {
if (in_files) {
gsub("^ ", "", $0)
MD5 = $1
FILE = $3
printf("%s %s%s\n", MD5, DIR, FILE);
}
}
/.*/ {
if (!length($0)) {
in_files = 0
next
}
}' | sort | uniq >> $OUT
;;
alpha|arm|hppa|i386|ia64|m68k|mips|mipsel|powerpc|s390|sparc)
FILES=`find $MIRROR/dists/$SUITE/ -name Packages -o -name Packages.gz | grep binary-$ARCH`
echo -e "Using MD5 sums from Packages files:\n$FILES"
zcat -f $FILES | awk '
/^Filename:/ {
FILE = $2
}
/^MD5sum:/ {
MD5 = $2
printf("%s %s\n", MD5, FILE)
}' | sort | uniq >> $OUT
;;
*)
echo "Unknown arch/source $ARCH!"
exit 1
;;
esac
exit 0

View File

@ -1,5 +1,7 @@
#!/usr/bin/perl -w
exit 0;
use Digest::MD5;
my $mirror = shift || $ENV{'MIRROR'};