Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2018 20:36:57 +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: r340238 - head/sys/conf
Message-ID:  <201811072036.wA7KavGZ011233@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed Nov  7 20:36:57 2018
New Revision: 340238
URL: https://svnweb.freebsd.org/changeset/base/340238

Log:
  newvers.sh: avoid regenerating vers.c if content unchanged
  
  When reproducible build mode is enabled vers.c may be unchanged between
  successive builds.  In this case avoid changing the file's metadata so
  that it does not cause dependent targets to be rebuilt.
  
  Sponsored by:	The FreeBSD Foundation
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D17892

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Wed Nov  7 20:31:36 2018	(r340237)
+++ head/sys/conf/newvers.sh	Wed Nov  7 20:36:57 2018	(r340238)
@@ -328,7 +328,7 @@ else
 	VERSTR="${VERINFO}\\n    ${u}@${h}:${d}\\n"
 fi
 
-cat << EOF > vers.c
+vers_content_new=$(cat << EOF
 $COPYRIGHT
 #define SCCSSTR "@(#)${VERINFO}"
 #define VERSTR "${VERSTR}"
@@ -342,5 +342,10 @@ char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 
 int osreldate = ${RELDATE};
 char kern_ident[] = "${i}";
 EOF
+)
+vers_content_old=$(cat vers.c 2>/dev/null || true)
+if [ "$vers_content_new" != "$vers_content_old" ]; then
+	echo "$vers_content_new" > vers.c
+fi
 
 echo $((v + 1)) > version



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