summaryrefslogtreecommitdiff
path: root/mk/checksum
diff options
context:
space:
mode:
authorjlam <jlam>2007-08-15 13:56:24 +0000
committerjlam <jlam>2007-08-15 13:56:24 +0000
commite22d4015fa7a4a90ecb2812c06414a0a463115a2 (patch)
treeb39c3812c8c0a6ac7aeb0c9ba941493ef70c4828 /mk/checksum
parenteb5516f7b1840b6bc4b8574a3737dfdfd140c25b (diff)
downloadpkgsrc-e22d4015fa7a4a90ecb2812c06414a0a463115a2.tar.gz
Use a flag to the checksum script to tell it whether we're checking
a distfile or a pkgsrc patch. It's simple, cleaner, less magic, etc. (duh!). While here, I notice that _CHECKSUM_CMD was already being defined in mk/checksum/checksum.mk (as it should be), so update the definition from mk/patch/patch.mk and remove it from patch.mk.
Diffstat (limited to 'mk/checksum')
-rwxr-xr-xmk/checksum/checksum31
-rw-r--r--mk/checksum/checksum.mk5
2 files changed, 18 insertions, 18 deletions
diff --git a/mk/checksum/checksum b/mk/checksum/checksum
index 4b8d770640a..ba0ad67faf2 100755
--- a/mk/checksum/checksum
+++ b/mk/checksum/checksum
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: checksum,v 1.11 2007/08/14 21:25:09 jlam Exp $
+# $NetBSD: checksum,v 1.12 2007/08/15 13:56:24 jlam Exp $
#
# Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -47,10 +47,7 @@
#
# DESCRIPTION
# checksum will verify the checksums in the distinfo file for each
-# of the files specified. If the file is a patch (named patch-*),
-# then strip out any lines containing NetBSD RCS ID tags before
-# computing the checksum for comparison the one in the distinfo
-# file.
+# of the files specified.
#
# The checksum utility exits with one of the following values:
#
@@ -64,6 +61,11 @@
#
# OPTIONS
# -a algorithm Only verify checksums for the specified algorithm.
+#
+# -p The specified files are patches, so strip out any
+# lines containing NetBSD RCS ID tags before
+# computing the checksums for verification.
+#
# -s suffix Strip the specified suffix from the file names
# when searching for the checksum.
#
@@ -80,15 +82,17 @@ set -e # exit on errors
self="${0##*/}"
usage() {
- ${ECHO} 1>&2 "usage: $self [-a algorithm] [-s suffix] distinfo [file ...]"
+ ${ECHO} 1>&2 "usage: $self [-a algorithm] [-p] [-s suffix] distinfo [file ...]"
}
# Process optional arguments
algorithm=
+patch=
suffix=
while ${TEST} $# -gt 0; do
case "$1" in
-a) algorithm="$2"; shift 2 ;;
+ -p) patch=yes; shift ;;
-s) suffix="$2"; shift 2 ;;
--) shift; break ;;
-*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}"
@@ -149,9 +153,7 @@ fi
for file in $files; do
sfile="${file%$suffix}"
- case $file in
- patch-*|*/patch-*) sfile="${sfile##*/}" ;;
- esac
+ ${TEST} -z "$patch" || sfile="${sfile##*/}"
${TEST} "$d_file" = "($sfile)" || continue
case "$files_left" in
@@ -174,14 +176,11 @@ fi
${ECHO} 1>&2 "$self: $file does not exist"
exit 128
fi
- case $file in
- patch-*|*/patch-*)
- checksum=`${SED} -e '/[$]NetBSD.*/d' $file | ${DIGEST} $d_alg`
- ;;
- *)
+ if ${TEST} -z "$patch"; then
checksum=`${DIGEST} $d_alg < $file`
- ;;
- esac
+ else
+ checksum=`${SED} -e '/[$]NetBSD.*/d' $file | ${DIGEST} $d_alg`
+ fi
if ${TEST} "$d_checksum" = "$checksum"; then
${ECHO} "=> Checksum $d_alg OK for $sfile"
else
diff --git a/mk/checksum/checksum.mk b/mk/checksum/checksum.mk
index 490575ed562..692c52a8650 100644
--- a/mk/checksum/checksum.mk
+++ b/mk/checksum/checksum.mk
@@ -1,4 +1,4 @@
-# $NetBSD: checksum.mk,v 1.5 2007/08/14 19:08:18 jlam Exp $
+# $NetBSD: checksum.mk,v 1.6 2007/08/15 13:56:24 jlam Exp $
#
# See bsd.checksum.mk for helpful comments.
#
@@ -16,7 +16,8 @@ DO_CHECKSUM_REPEATEDLY?= no
_CHECKSUM_CMD= \
${SETENV} DIGEST=${TOOLS_DIGEST:Q} CAT=${TOOLS_CAT:Q} \
- ECHO=${TOOLS_ECHO:Q} TEST=${TOOLS_TEST:Q} \
+ ECHO=${TOOLS_ECHO:Q} SED=${TOOLS_SED:Q} \
+ TEST=${TOOLS_TEST:Q} \
${SH} ${PKGSRCDIR}/mk/checksum/checksum \
_COOKIE.checksum= ${WRKDIR}/.checksum_done