summaryrefslogtreecommitdiff
path: root/mk/patch
diff options
context:
space:
mode:
authorjlam <jlam>2007-08-14 21:25:09 +0000
committerjlam <jlam>2007-08-14 21:25:09 +0000
commit7ccba980b8a48dc960c0701f712040980cb9cc0e (patch)
tree8f3702ac58d124d22cbcb68ba130bda59f106c37 /mk/patch
parentaab596bb67953e2d464cd193de6a425ff12591a9 (diff)
downloadpkgsrc-7ccba980b8a48dc960c0701f712040980cb9cc0e.tar.gz
Teach the pkgsrc/mk/checksum/checksum script how to verify patches by
first stripping them of NetBSD RCS ID tags. Use the checksum script in the patch module to verify patch checksums instead of hand-coding a miniature version of the checksum script in the do-pkgsrc-patches target.
Diffstat (limited to 'mk/patch')
-rw-r--r--mk/patch/patch.mk33
1 files changed, 18 insertions, 15 deletions
diff --git a/mk/patch/patch.mk b/mk/patch/patch.mk
index b799b691900..772eed5caef 100644
--- a/mk/patch/patch.mk
+++ b/mk/patch/patch.mk
@@ -1,4 +1,4 @@
-# $NetBSD: patch.mk,v 1.12 2007/08/14 13:21:57 rillig Exp $
+# $NetBSD: patch.mk,v 1.13 2007/08/14 21:25:10 jlam Exp $
#
# The following variables may be set in a package Makefile and control
# how pkgsrc patches are applied.
@@ -261,6 +261,11 @@ _PKGSRC_PATCHES+= ${PATCHDIR}/patch-*
_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}"
@@ -287,22 +292,20 @@ do-pkgsrc-patch:
patch_warning "Ignoring patch file $$i: distinfo not found"; \
continue; \
fi; \
- filename=`${BASENAME} $$i`; \
- algsum=`${AWK} '(NF == 4) && ($$2 == "('$$filename')") && ($$3 == "=") {print $$1 " " $$4}' ${DISTINFO_FILE} || ${TRUE}`; \
- if ${TEST} -z "$$algsum"; then \
- patch_warning "Ignoring patch file $$i: no checksum found"; \
- continue; \
+ ${ECHO_PATCH_MSG} "Verifying $$i"; \
+ if ${_CHECKSUM_CMD} ${DISTINFO_FILE} $$i >/dev/null 2>&1; then \
+ cksum_result=0; \
+ else \
+ cksum_result=$$?; \
fi; \
- set -- $$algsum; \
- alg="$$1"; \
- recorded="$$2"; \
- calcsum=`${SED} -e '/\$$NetBSD.*/d' $$i | ${TOOLS_DIGEST} $$alg`; \
- ${ECHO_PATCH_MSG} "Verifying $$filename (using digest algorithm $$alg)"; \
- if ${TEST} "$$calcsum" != "$$recorded"; then \
- patch_warning "Ignoring patch file $$i: invalid checksum"; \
+ case "$$cksum_result" in \
+ 0) ;; \
+ 2) patch_warning "Ignoring patch file $$i: no checksum found"; \
+ continue ;; \
+ 1) patch_warning "Ignoring patch file $$i: invalid checksum"; \
fail="$$fail $$i"; \
- continue; \
- fi; \
+ continue ;; \
+ esac; \
;; \
esac; \
${ECHO_PATCH_MSG} "Applying pkgsrc patch $$i"; \