git: 16354ca2d8c4 - stable/12 - newvers.sh: avoid regenerating vers.c if content unchanged
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Sep 2022 19:13:30 UTC
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=16354ca2d8c45e2e72bffbb61d99f5fe3858b6de commit 16354ca2d8c45e2e72bffbb61d99f5fe3858b6de Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2018-11-07 20:36:57 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2022-09-06 19:11:09 +0000 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 (cherry picked from commit 179460e1481ef98aa6824681ee472b0764c9d9a0) --- sys/conf/newvers.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 18ada43e0cbc..542dae42b567 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -285,7 +285,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}" @@ -299,5 +299,10 @@ char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = 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