Index: head/CHANGES =================================================================== --- head/CHANGES +++ head/CHANGES @@ -22,6 +22,16 @@ WANT_BDB_VER=XX should be replaced by USES=bdb:XX. +20160512: +AUTHOR: emaste@FreeBSD.org + + "make makesum" now writes the current timestamp to distinfo when it is run. + This is done to support development and prototyping efforts for reproducible + package builds, which require some concept of a "last updated" time. + + The TIMESTAMP can currently be ignored for ports that have no distinfo, and + for updates done without using "make makesum." + 20160414: AUTHOR: mat@FreeBSD.org Index: head/Mk/bsd.port.mk =================================================================== --- head/Mk/bsd.port.mk +++ head/Mk/bsd.port.mk @@ -4161,7 +4161,11 @@ 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 @@ 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