svn commit: r340238 - head/sys/conf

Ed Maste emaste at FreeBSD.org
Wed Nov 7 20:36:58 UTC 2018


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


More information about the svn-src-head mailing list