From d0327929abfbf1d42ab522d969d23ebb9845d179 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Thu, 6 Aug 2020 16:13:54 +0000 Subject: [PATCH] pkgbase: Add a new variable PKG_TIMESTAMP libarchive uses the SOURCE_DATE_EPOCH env variable to set the date of file in an archive, this is useful for reproducibility. Add a variable name PKG_TIMESTAMP that take a epoch time and set SOURCE_DATE_EPOCH to this. By default it is the current time so no changes here. --- Makefile.inc1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 94fd5ef5c515..e0992e2acb4f 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -545,6 +545,13 @@ PKG_VERSION= ${_REVISION}${EXTRA_REVISION} .endif .endif # !defined(PKG_VERSION) +.if !defined(PKG_TIMESTAMP) +TIMEEPOCHNOW= %s +SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} +.else +SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} +.endif + .if !defined(_MKSHOWCONFIG) _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \ -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE @@ -1831,6 +1838,7 @@ create-packages-kernel: _pkgbootstrap _repodir .PHONY ${MAKE} -f Makefile.inc1 \ DESTDIR=${KSTAGEDIR} \ PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \ + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ create-kernel-packages create-packages: .PHONY create-packages-world create-packages-kernel @@ -1847,6 +1855,7 @@ create-world-packages: _pkgbootstrap .PHONY done > ${WSTAGEDIR}/packages.mk ${_+_}@cd ${.CURDIR}; \ ${MAKE} -f Makefile.inc1 create-world-packages-jobs \ + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ .MAKE.JOB.PREFIX= .if make(create-world-packages-jobs)