Subject: Updated diffs for unified digest/checksum file
To: None <tech-pkg@netbsd.org>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 04/08/2001 10:46:29
I discovered a slight bug in my previous diffs, in that they assumed
that $PATCH_SUM_FILE} and ${DIGEST_FILE} always exist. This is not the
case when constructing new packages.
New diffs below.
Jeremy - a digest is a specific type of book, a condensed form of the
original, a precis or summary.
Hubert - you've voted once already.
To the others out there - vote early and vote often.
Regards,
Alistair
--- bsd.pkg.mk.orig Wed Apr 4 17:32:41 2001
+++ bsd.pkg.mk Sun Apr 8 10:35:59 2001
@@ -273,8 +273,15 @@
# Miscellaneous overridable commands:
SHCOMMENT?= ${ECHO_MSG} >/dev/null '***'
+NEW_DIGEST_FILE?= ${.CURDIR}/digest
+
+.if exists(${NEW_DIGEST_FILE})
+DIGEST_FILE?= ${NEW_DIGEST_FILE}
+PATCH_SUM_FILE?= ${NEW_DIGEST_FILE}
+.else
DIGEST_FILE?= ${FILESDIR}/md5
PATCH_SUM_FILE?= ${FILESDIR}/patch-sum
+.endif
.if exists(/usr/bin/m4)
M4?= /usr/bin/m4
@@ -2477,70 +2484,47 @@
.if !target(makesum)
makesum: fetch uptodate-digest
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${FILESDIR}
- ${_PKG_SILENT}${_PKG_DEBUG}if [ -f ${DIGEST_FILE} ]; then ${RM} -f ${DIGEST_FILE}; fi
- @${ECHO} -n "$$" > ${DIGEST_FILE}; \
- ${ECHO} -n "NetBSD" >> ${DIGEST_FILE}; \
- ${ECHO} "$$" >> ${DIGEST_FILE}; \
- ${ECHO} "" >> ${DIGEST_FILE}
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${DISTDIR}; \
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ newfile=${NEW_DIGEST_FILE}.$$$$; \
+ ${ECHO} -n "$$" > $$newfile; \
+ ${ECHO} -n "NetBSD" >> $$newfile; \
+ ${ECHO} "$$" >> $$newfile; \
+ ${ECHO} "" >> $$newfile; \
+ cd ${DISTDIR}; \
for sumfile in "" ${_CKSUMFILES}; do \
if [ "X$$sumfile" = "X" ]; then continue; fi; \
- ${DIGEST} ${DIGEST_ALGORITHM} $$sumfile >> ${DIGEST_FILE}; \
- done
- ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${DIGEST} ${DIGEST_ALGORITHM} $$sumfile >> $$newfile; \
+ done; \
for ignore in "" ${_IGNOREFILES}; do \
if [ "X$$ignore" = "X" ]; then continue; fi; \
- ${ECHO} "${DIGEST_ALGORITHM} ($$ignore) = IGNORE" >> ${DIGEST_FILE}; \
- done
+ ${ECHO} "${DIGEST_ALGORITHM} ($$ignore) = IGNORE" >> $$newfile; \
+ done; \
+ if [ -f ${PATCH_SUM_FILE} ]; then \
+ ${AWK} '$$2 ~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${PATCH_SUM_FILE} >> $$newfile; \
+ fi; \
+ ${MV} $$newfile ${NEW_DIGEST_FILE}
.endif
.if !target(makepatchsum)
makepatchsum mps: uptodate-digest
${_PKG_SILENT}${_PKG_DEBUG} \
- (${MKDIR} ${FILESDIR}; \
- ${ECHO_MSG} "${_PKGSRC_IN}> Making patch checksums"; \
- if [ -f "${PATCH_SUM_FILE}" ]; then \
- ${AWK} -- '{print ; exit}' < ${PATCH_SUM_FILE} > ${PATCH_SUM_FILE}.new; \
- else \
- ${ECHO} -n "$$" > ${PATCH_SUM_FILE}.new; \
- ${ECHO} -n "NetBSD" >> ${PATCH_SUM_FILE}.new; \
- ${ECHO} "$$" >> ${PATCH_SUM_FILE}.new; \
+ newfile=${NEW_DIGEST_FILE}.$$$$; \
+ if [ -f ${DIGEST_FILE} ]; then \
+ ${AWK} '$$2 !~ /\(patch-[a-z0-9]+\)/ { print $$0 }' < ${DIGEST_FILE} >> $$newfile; \
fi; \
- ${ECHO} "" >> ${PATCH_SUM_FILE}.new; \
- havepatches=0; \
if [ -d ${PATCHDIR} ]; then \
- cd ${PATCHDIR}; \
+ (cd ${PATCHDIR}; \
for sumfile in "" patch-*; do \
if [ "X$$sumfile" = "X" ]; then continue; fi; \
if [ "X$$sumfile" = "Xpatch-*" ]; then break; fi; \
case $$sumfile in \
patch-local-*) ;; \
*.orig) continue ;; \
- *) ${ECHO} "${DIGEST_ALGORITHM} ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${DIGEST} ${DIGEST_ALGORITHM}`" >> ${PATCH_SUM_FILE}.new; \
- havepatches=1 ;; \
+ *) ${ECHO} "${DIGEST_ALGORITHM} ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${DIGEST} ${DIGEST_ALGORITHM}`" >> $$newfile;; \
esac; \
- done; \
+ done); \
fi; \
- if [ $$havepatches = 0 ]; then \
- if [ -f "${PATCH_SUM_FILE}" ]; then \
- ${ECHO} "This placeholder file is generated by the \`\`makepatchsum'' target" >> ${PATCH_SUM_FILE}.new; \
- ${ECHO} "whenever the patches directory is empty or missing. Its purpose" >> ${PATCH_SUM_FILE}.new; \
- ${ECHO} "is to ensure that the presence of any obsolete patches will cause" >> ${PATCH_SUM_FILE}.new; \
- ${ECHO} "the proper error to be emitted at build time." >> ${PATCH_SUM_FILE}.new; \
- ${ECHO_MSG} "=> placeholder patch-sum file created"; \
- else \
- ${RM} -f ${PATCH_SUM_FILE}.new; \
- ${ECHO_MSG} "=> no patch-sum file created"; \
- exit 0; \
- fi; \
- fi; \
- if cmp -s ${PATCH_SUM_FILE}.new ${PATCH_SUM_FILE}; then \
- ${RM} -f ${PATCH_SUM_FILE}.new; \
- ${ECHO_MSG} "=> patch-sum file unchanged"; \
- else \
- ${MV} ${PATCH_SUM_FILE}.new ${PATCH_SUM_FILE}; \
- fi)
+ ${MV} $$newfile ${NEW_DIGEST_FILE}
.endif
.if !target(checksum)