pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/checksum Add a flag "-s suffix" for allowing the sp...
details: https://anonhg.NetBSD.org/pkgsrc/rev/d4b91800a40a
branches: trunk
changeset: 516310:d4b91800a40a
user: jlam <jlam%pkgsrc.org@localhost>
date: Tue Jul 18 21:39:39 2006 +0000
description:
Add a flag "-s suffix" for allowing the specified files to have a suffix
that will be removed before looking up the checksum in the distinfo file.
diffstat:
mk/checksum/checksum | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diffs (70 lines):
diff -r 083159331896 -r d4b91800a40a mk/checksum/checksum
--- a/mk/checksum/checksum Tue Jul 18 21:28:06 2006 +0000
+++ b/mk/checksum/checksum Tue Jul 18 21:39:39 2006 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: checksum,v 1.8 2006/07/17 14:32:26 jlam Exp $
+# $NetBSD: checksum,v 1.9 2006/07/18 21:39:39 jlam Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -51,6 +51,8 @@
#
# OPTIONS
# -a algorithm Only verify checksums for the specified algorithm.
+# -s suffix Strip the specified suffix from the file names
+# when searching for the checksum.
#
######################################################################
@@ -64,14 +66,16 @@
self="${0##*/}"
usage() {
- ${ECHO} 1>&2 "usage: $self [-a algorithm] distinfo [file ...]"
+ ${ECHO} 1>&2 "usage: $self [-a algorithm] [-s suffix] distinfo [file ...]"
}
# Process optional arguments
algorithm=
+suffix=
while ${TEST} $# -gt 0; do
case "$1" in
-a) algorithm="$2"; shift 2 ;;
+ -s) suffix="$2"; shift 2 ;;
--) shift; break ;;
-*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}"
usage
@@ -132,7 +136,8 @@
${TEST} -n "$tmp" || eval "_alg_${d_alg}=\"$files\""
for file in $files; do
- ${TEST} "$d_file" = "($file)" || continue
+ sfile="${file%$suffix}"
+ ${TEST} "$d_file" = "($sfile)" || continue
eval "tmp=\"\$_alg_${d_alg}\""
case "$tmp" in
@@ -149,14 +154,18 @@
eval "_alg_${d_alg}=\"$tmp\""
if ${TEST} "$d_checksum" = "IGNORE"; then
- ${ECHO} 1>&2 "$self: Ignoring checksum for $file"
+ ${ECHO} 1>&2 "$self: Ignoring checksum for $sfile"
continue
fi
+ if ${TEST} ! -f $file; then
+ ${ECHO} 1>&2 "$self: $file does not exist"
+ exit 1
+ fi
checksum=`${DIGEST} $d_alg < $file`
if ${TEST} "$d_checksum" = "$checksum"; then
- ${ECHO} "=> Checksum $d_alg OK for $file"
+ ${ECHO} "=> Checksum $d_alg OK for $sfile"
else
- ${ECHO} 1>&2 "$self: Checksum $d_alg mismatch for $file"
+ ${ECHO} 1>&2 "$self: Checksum $d_alg mismatch for $sfile"
exitcode=1
fi
break
Home |
Main Index |
Thread Index |
Old Index