Subject: Proposal: "make makepatchsum" to make files/patch-sum even for empty
To: None <tech-pkg@NetBSD.ORG>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 09/30/1999 07:23:07
The problem this addresses, is that if the patches directory and
files/patch-sum files are removed, a user with an improperly supped
tree will not be able to detect it (PR 8514). The "warning" is because
the committer gets to be judicious about committing the empty
placeholder file. It's only useful after a "patches" directory is
removed. A new package that never had any patches wouldn't need it.

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.349
diff -c -r1.349 bsd.pkg.mk
*** bsd.pkg.mk	1999/09/29 15:13:26	1.349
--- bsd.pkg.mk	1999/09/30 12:21:31
***************
*** 1801,1817 ****
  
  .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 ;;				\
--- 1801,1822 ----
  
  .if !target(makepatchsum)
  makepatchsum:
! 	${_PKG_SILENT}${_PKG_DEBUG}					\
! 		(${MKDIR} ${FILESDIR};					\
! 		${RM} -f ${PATCH_SUM_FILE};				\
! 		${ECHO} -n "$$" > ${PATCH_SUM_FILE};			\
! 		${ECHO} -n "NetBSD" >> ${PATCH_SUM_FILE};		\
! 		${ECHO} "$$" >> ${PATCH_SUM_FILE};			\
! 		${ECHO} "" >> ${PATCH_SUM_FILE})
  	${_PKG_SILENT}(${_PKG_DEBUG}					\
  	if [ -d ${PATCHDIR} ]; then					\
  		cd ${PATCHDIR};						\
! 		for sumfile in patch-*; do				\
! 			if [ "X$$sumfile" = "Xpatch-*" ]; then		\
! 				${ECHO} "PLACEHOLDER -- patches directory is empty or missing" >> ${PATCH_SUM_FILE}; \
! 				${ECHO_MSG} "No patches found! Empty patch-sum file created."; \
! 				continue;				\
! 			fi;						\
  			case $$sumfile in				\
  			patch-local-*) ;;				\
  			*.orig) continue ;;				\
***************
*** 1819,1824 ****
--- 1824,1832 ----
  				${ECHO} "MD5 ($$sumfile) = `${SED} -e '/\$$NetBSD.*/d' $$sumfile | ${MD5}`" >> ${PATCH_SUM_FILE}; \
  			esac;						\
  		done;							\
+ 	else								\
+ 		${ECHO} "PLACEHOLDER -- patches directory is empty or missing" >> ${PATCH_SUM_FILE}; \
+ 		${ECHO_MSG} "No patches found! Empty patch-sum file created."; \
  	fi)
  .endif