From owner-svn-src-stable@freebsd.org Mon Jan 16 01:38:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8554CB1F9E; Mon, 16 Jan 2017 01:38:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C289E16E4; Mon, 16 Jan 2017 01:38:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0G1cYO6070302; Mon, 16 Jan 2017 01:38:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0G1cYM5070301; Mon, 16 Jan 2017 01:38:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701160138.v0G1cYM5070301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 16 Jan 2017 01:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r312249 - stable/11/sys/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 01:38:36 -0000 Author: emaste Date: Mon Jan 16 01:38:34 2017 New Revision: 312249 URL: https://svnweb.freebsd.org/changeset/base/312249 Log: newvers.sh: add options to eliminate kernel build metadata MFC r310112, r310114, r310273, r310279 r310112: newvers.sh: add option to eliminate kernel build metadata Build metadata (username, hostname, etc.) prevents the FreeBSD kernel from building reproducibly. Add an option to disable inclusion of that metadata but retain the release information and SVN/git VCS details. See https://reproducible-builds.org/ for additional background. r310114: newvers.sh: correct typo in comment r310273: newvers.sh: add -R option to include metadata only for unmodified src tree r310279: newvers.sh: consider as modified SVN mixed revision and other cases The newvers -R option is intended to include build metadata (e.g. user, host, time) if the build is from an unmodified VCS tree. For subversion it considered a trailing 'M' as an indication of a modified tree, and any other version string as modified. Also include mixed revision checkouts (e.g. 123:126), switched (123S) and partial (123P) working copies as modified: the revision number is insufficient to uniquely determine which source was used for the build. Modified: stable/11/sys/conf/newvers.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Mon Jan 16 00:43:57 2017 (r312248) +++ stable/11/sys/conf/newvers.sh Mon Jan 16 01:38:34 2017 (r312249) @@ -30,6 +30,18 @@ # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $FreeBSD$ +# Command line options: +# +# -r Reproducible build. Do not embed directory names, user +# names, time stamps or other dynamic information into +# the output file. This is intended to allow two builds +# done at different times and even by different people on +# different hosts to produce identical output. +# +# -R Reproducible build if the tree represents an unmodified +# checkout from a version control system. Metadata is +# included if the tree is modified. + TYPE="FreeBSD" REVISION="11.0" BRANCH="STABLE" @@ -163,8 +175,16 @@ fi if [ -n "$svnversion" ] ; then svn=`cd ${SYSDIR} && $svnversion 2>/dev/null` case "$svn" in - [0-9]*) svn=" r${svn}" ;; - *) unset svn ;; + [0-9]*[MSP]|*:*) + svn=" r${svn}" + modified=true + ;; + [0-9]*) + svn=" r${svn}" + ;; + *) + unset svn + ;; esac fi @@ -196,6 +216,7 @@ if [ -n "$git_cmd" ] ; then if $git_cmd --work-tree=${SYSDIR}/.. diff-index \ --name-only HEAD | read dummy; then git="${git}-dirty" + modified=true fi fi @@ -208,7 +229,10 @@ if [ -n "$p4_cmd" ] ; then p4opened=`cd ${SYSDIR} && $p4_cmd opened ./... 2>&1` case "$p4opened" in File*) ;; - //*) p4version="${p4version}+edit" ;; + //*) + p4version="${p4version}+edit" + modified=true + ;; esac ;; *) unset p4version ;; @@ -227,10 +251,32 @@ if [ -n "$hg_cmd" ] ; then fi fi +include_metadata=true +while getopts rR opt; do + case "$opt" in + r) + include_metadata= + ;; + R) + if [ -z "${modified}" ]; then + include_metadata= + fi + esac +done +shift $((OPTIND - 1)) + +if [ -z "${include_metadata}" ]; then + VERINFO="${VERSION} ${svn}${git}${hg}${p4version}" + VERSTR="${VERINFO}\\n" +else + VERINFO="${VERSION} #${v}${svn}${git}${hg}${p4version}: ${t}" + VERSTR="${VERINFO}\\n ${u}@${h}:${d}\\n" +fi + cat << EOF > vers.c $COPYRIGHT -#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}${hg}${p4version}: ${t}" -#define VERSTR "${VERSION} #${v}${svn}${git}${hg}${p4version}: ${t}\\n ${u}@${h}:${d}\\n" +#define SCCSSTR "@(#)${VERINFO}" +#define VERSTR "${VERSTR}" #define RELSTR "${RELEASE}" char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;