Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2015 12:17:09 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r291691 - head/sys/conf
Message-ID:  <201512031217.tB3CH9m8084553@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Dec  3 12:17:09 2015
New Revision: 291691
URL: https://svnweb.freebsd.org/changeset/base/291691

Log:
  newvers: Honour SOURCE_DATE_EPOCH as a build reproducibility measure
  
  One reason the kernel does not build reproducibly is that it includes
  a timestamp in the version string. SOURCE_DATE_EPOCH provides a standard
  method to address this: it should be set to the last modification time
  of the source, and build processes use the specified timestamp instead
  of the "current" date and time.
  
  This change uses SOURCE_DATE_EPOCH if it is set; how it gets set needs
  to be addressed elsewhere.
  
  Reviewed by:	bapt
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Thu Dec  3 11:45:12 2015	(r291690)
+++ head/sys/conf/newvers.sh	Thu Dec  3 12:17:09 2015	(r291691)
@@ -97,7 +97,15 @@ then
 fi
 
 touch version
-v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
+v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`}
+if [ -n "$SOURCE_DATE_EPOCH" ]; then
+	if ! t=`date -r $SOURCE_DATE_EPOCH 2>/dev/null`; then
+		echo "Invalid SOURCE_DATE_EPOCH" >&2
+		exit 1
+	fi
+else
+	t=`date`
+fi
 i=`${MAKE:-make} -V KERN_IDENT`
 compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep -w 'version')
 



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