Subject: Re: change to makepatchsum
To: Simon Burge <simonb@netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 10/06/1999 05:41:44
On Wed, 6 Oct 1999, Simon Burge wrote:
> Matthias Scheler wrote:
>
> > In article <199910060458.OAA02762@balrog.supp.cpr.itg.telecom.com.au>,
> > Simon Burge <simonb@netbsd.org> writes:
> > > Anyone not happy with the following change to makepatchsum, so that it
> > > doesn't update the patchsum file if none of the sums change?
> >
> > Looks nice. But it could print out a message.
>
> For both cases, or just when the patch-sum did change?
Presumably, when the patch-sum *did* *not* change.
I've revisited the idea of making a patch-sum file when there are no
patches, and integrated it with your patch. The message in the
resulting patch-sum file is reasonably self-explanatory. As follows
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.352
diff -c -r1.352 bsd.pkg.mk
*** bsd.pkg.mk 1999/10/05 22:18:05 1.352
--- bsd.pkg.mk 1999/10/06 10:37:21
***************
*** 1808,1832 ****
.if !target(makepatchsum)
makepatchsum:
! ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${FILESDIR}
! ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PATCH_SUM_FILE}
! ${_PKG_SILENT}(${_PKG_DEBUG} \
if [ -d ${PATCHDIR} ]; then \
cd ${PATCHDIR}; \
! ${ECHO} -n "$$" > ${PATCH_SUM_FILE}; \
! ${ECHO} -n "NetBSD" >> ${PATCH_SUM_FILE}; \
! ${ECHO} "$$" >> ${PATCH_SUM_FILE}; \
! ${ECHO} "" >> ${PATCH_SUM_FILE}; \
! for sumfile in "" patch-*; do \
! if [ "X$$sumfile" = X"" ]; then continue; fi; \
case $$sumfile in \
patch-local-*) ;; \
*.orig) continue ;; \
*) \
! ${ECHO} "MD5 ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${MD5}`" >> ${PATCH_SUM_FILE}; \
esac; \
done; \
! fi)
.endif
.if !target(checksum)
--- 1808,1845 ----
.if !target(makepatchsum)
makepatchsum:
! ${_PKG_SILENT}${_PKG_DEBUG} \
! (${MKDIR} ${FILESDIR}; \
! ${ECHO} -n "$$" > ${PATCH_SUM_FILE}.new; \
! ${ECHO} -n "NetBSD" >> ${PATCH_SUM_FILE}.new; \
! ${ECHO} "$$" >> ${PATCH_SUM_FILE}.new; \
! ${ECHO} "" >> ${PATCH_SUM_FILE}.new; \
if [ -d ${PATCHDIR} ]; then \
cd ${PATCHDIR}; \
! for sumfile in patch-*; do \
! if [ ! -f $$sumfile ]; then continue; fi; \
case $$sumfile in \
patch-local-*) ;; \
*.orig) continue ;; \
*) \
! ${ECHO} "MD5 ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${MD5}`" >> ${PATCH_SUM_FILE}.new; \
esac; \
done; \
! fi; \
! if [ `${AWK} -- '{nlines++} END {print nlines}' < ${PATCH_SUM_FILE}.new` = 2 ]; 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; \
! fi; \
! if [ -f "${PATCH_SUM_FILE}" ]; then \
! tail +2 ${PATCH_SUM_FILE} > .patchsumold; \
! tail +2 ${PATCH_SUM_FILE}.new > .patchsumnew; \
! fi; \
! ((cmp -s .patchsumold .patchsumnew && \
! ${ECHO_MSG} patch-sum file unchanged\!) || \
! ${MV} ${PATCH_SUM_FILE}.new ${PATCH_SUM_FILE}); \
! rm -f .patchsumold .patchsumnew ${PATCH_SUM_FILE}.new)
.endif
.if !target(checksum)