From 2f9359ae89622c2d95ef243d13251a310e94a199 Mon Sep 17 00:00:00 2001 From: quantimnot Date: Tue, 5 Oct 2021 02:55:36 -0400 Subject: [PATCH] Make compiler build more reproducible Removed the compile time from the version output. Added Git commit's author's datetime in UTC timezone. Fixes #18508 See https://reproducible-builds.org/docs/timestamps/ See https://reproducible-builds.org/docs/source-date-epoch/ --- compiler/commands.nim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/commands.nim b/compiler/commands.nim index a8caad9163..99e224e34a 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -43,8 +43,8 @@ type const HelpMessage = "Nim Compiler Version $1 [$2: $3]\n" & - "Compiled at $4\n" & "Copyright (c) 2006-" & copyrightYear & " by Andreas Rumpf\n" + gitCommit {.strdefine.} = gorge("TZ=UTC git log -n 1 --date=iso-local --format='%H (%cd)'").strip proc genFeatureDesc[T: enum](t: typedesc[T]): string {.compileTime.} = result = "" @@ -91,10 +91,7 @@ proc writeVersionInfo(conf: ConfigRef; pass: TCmdLinePass) = CPU[conf.target.hostCPU].name, CompileDate]), {msgStdout}) - const gitHash {.strdefine.} = gorge("git log -n 1 --format=%H").strip - # xxx move this logic to std/private/gitutils - when gitHash.len == 40: - msgWriteln(conf, "git hash: " & gitHash, {msgStdout}) + msgWriteln(conf, "git commit: " & gitCommit, {msgStdout}) msgWriteln(conf, "active boot switches:" & usedRelease & usedDanger & usedTinyC & useLinenoise &