From 0198d9e414a31ad4be2bc2df50ef9f7443fc2769 Mon Sep 17 00:00:00 2001 From: emaste Date: Thu, 12 May 2016 18:20:27 +0000 Subject: Record TIMESTAMP in make makesum This is intended to support development and prototyping for ports reproducible build efforts which require some concept of a "last updated" time. It is being committed now so that timestamp entries will be populated "for free" as port distfiles updates happen. Submitted by: bapt (earlier version) Reviewed by: bapt, bdrewery Approved by: portmgr (bdrewery) Differential Revision: https://reviews.freebsd.org/D6031 --- Mk/bsd.port.mk | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Mk/bsd.port.mk') diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index efcf09df8cdd..08540cd275d1 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -4161,7 +4161,11 @@ checksum_init=\ makesum: check-checksum-algorithms @cd ${.CURDIR} && ${MAKE} fetch NO_CHECKSUM=yes \ DISABLE_SIZE=yes - @if [ -f ${DISTINFO_FILE} ]; then ${CAT} /dev/null > ${DISTINFO_FILE}; fi + @if [ -f ${DISTINFO_FILE} ]; then \ + if ${GREP} -q "^TIMESTAMP " ${DISTINFO_FILE}; then \ + ${GREP} -v "^TIMESTAMP " ${DISTINFO_FILE} > ${DISTINFO_FILE}.sav; \ + fi; \ + fi @( \ cd ${DISTDIR}; \ \ @@ -4172,11 +4176,16 @@ makesum: check-checksum-algorithms eval alg_executable=\$$$$alg; \ \ if [ $$alg_executable != "NO" ]; then \ - $$alg_executable $$file >> ${DISTINFO_FILE}; \ + $$alg_executable $$file >> ${DISTINFO_FILE}.new; \ fi; \ done; \ - ${ECHO_CMD} "SIZE ($$file) = `${STAT} -f \"%z\" $$file`" >> ${DISTINFO_FILE}; \ - done \ + ${ECHO_CMD} "SIZE ($$file) = `${STAT} -f \"%z\" $$file`" >> ${DISTINFO_FILE}.new; \ + done; \ + if [ ! -f ${DISTINFO_FILE}.sav ] || ! cmp -s ${DISTINFO_FILE}.sav ${DISTINFO_FILE}.new; then \ + ${ECHO_CMD} "TIMESTAMP = `date '+%s'`" > ${DISTINFO_FILE} ; \ + ${CAT} ${DISTINFO_FILE}.new >> ${DISTINFO_FILE} ; \ + fi ; \ + rm -f ${DISTINFO_FILE}.new ${DISTINFO_FILE}.sav ; \ ) .endif -- cgit