Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 May 2016 18:20:27 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r415078 - in head: . Mk
Message-ID:  <201605121820.u4CIKROJ004026@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste (src committer)
Date: Thu May 12 18:20:27 2016
New Revision: 415078
URL: https://svnweb.freebsd.org/changeset/ports/415078

Log:
  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

Modified:
  head/CHANGES
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Thu May 12 17:59:43 2016	(r415077)
+++ head/CHANGES	Thu May 12 18:20:27 2016	(r415078)
@@ -22,6 +22,16 @@ AUTHOR: mat@FreeBSD.org
 
   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
 

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Thu May 12 17:59:43 2016	(r415077)
+++ head/Mk/bsd.port.mk	Thu May 12 18:20:27 2016	(r415078)
@@ -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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605121820.u4CIKROJ004026>