pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Use a flag to the checksum script to tell it whethe...
details: https://anonhg.NetBSD.org/pkgsrc/rev/413d55c78ab7
branches: trunk
changeset: 532276:413d55c78ab7
user: jlam <jlam%pkgsrc.org@localhost>
date: Wed Aug 15 13:56:24 2007 +0000
description:
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:
mk/checksum/checksum | 31 +++++++++++++++----------------
mk/checksum/checksum.mk | 5 +++--
mk/patch/patch.mk | 9 ++-------
3 files changed, 20 insertions(+), 25 deletions(-)
diffs (133 lines):
diff -r 0055d4853908 -r 413d55c78ab7 mk/checksum/checksum
--- a/mk/checksum/checksum Wed Aug 15 13:54:50 2007 +0000
+++ b/mk/checksum/checksum Wed Aug 15 13:56:24 2007 +0000
@@ -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 @@
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 @@
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 @@
${ECHO} 1>&2 "$self: $file does not exist"
exit 128
fi
- case $file in
- patch-*|*/patch-*)
+ if ${TEST} -z "$patch"; then
+ checksum=`${DIGEST} $d_alg < $file`
+ else
checksum=`${SED} -e '/[$]NetBSD.*/d' $file | ${DIGEST} $d_alg`
- ;;
- *)
- checksum=`${DIGEST} $d_alg < $file`
- ;;
- esac
+ fi
if ${TEST} "$d_checksum" = "$checksum"; then
${ECHO} "=> Checksum $d_alg OK for $sfile"
else
diff -r 0055d4853908 -r 413d55c78ab7 mk/checksum/checksum.mk
--- a/mk/checksum/checksum.mk Wed Aug 15 13:54:50 2007 +0000
+++ b/mk/checksum/checksum.mk Wed Aug 15 13:56:24 2007 +0000
@@ -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 @@
_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
diff -r 0055d4853908 -r 413d55c78ab7 mk/patch/patch.mk
--- a/mk/patch/patch.mk Wed Aug 15 13:54:50 2007 +0000
+++ b/mk/patch/patch.mk Wed Aug 15 13:56:24 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: patch.mk,v 1.13 2007/08/14 21:25:10 jlam Exp $
+# $NetBSD: patch.mk,v 1.14 2007/08/15 13:56:25 jlam Exp $
#
# The following variables may be set in a package Makefile and control
# how pkgsrc patches are applied.
@@ -261,11 +261,6 @@
_PKGSRC_PATCHES+= ${LOCALPATCHES}/${PKGPATH}/*
.endif
-_CHECKSUM_CMD= ${SETENV} DIGEST=${TOOLS_DIGEST:Q} CAT=${TOOLS_CAT:Q} \
- ECHO=${TOOLS_ECHO:Q} SED=${TOOLS_SED:Q} \
- TEST=${TOOLS_TEST:Q} \
- ${SH} ${PKGSRCDIR}/mk/checksum/checksum
-
pkgsrc-patch-message:
@${STEP_MSG} "Applying pkgsrc patches for ${PKGNAME}"
@@ -293,7 +288,7 @@
continue; \
fi; \
${ECHO_PATCH_MSG} "Verifying $$i"; \
- if ${_CHECKSUM_CMD} ${DISTINFO_FILE} $$i >/dev/null 2>&1; then \
+ if ${_CHECKSUM_CMD} -p ${DISTINFO_FILE} $$i >/dev/null 2>&1; then \
cksum_result=0; \
else \
cksum_result=$$?; \
Home |
Main Index |
Thread Index |
Old Index