]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
build: Generate "reproducible" version strings on "clean" builds
authorKevin O'Connor <kevin@koconnor.net>
Tue, 13 Oct 2015 19:49:03 +0000 (15:49 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 15 Oct 2015 14:55:14 +0000 (10:55 -0400)
If the build environment looks "clean" then don't add the build
hostname or build time to the version string.  This makes the default
build string reproducible across builds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
scripts/buildversion.py

index 56bfcfa4bc6dd4fa83d064543a5b407e77d67bd8..c3a83b015ed73189d73e731c8e6df5355a82d4e8 100755 (executable)
@@ -92,14 +92,16 @@ def main():
     cleanbuild, toolstr = tool_versions(options.tools)
 
     ver = git_version()
+    cleanbuild = cleanbuild and ver and 'dirty' not in ver
     if not ver:
         ver = file_version()
         if not ver:
             ver = "?"
-    btime = time.strftime("%Y%m%d_%H%M%S")
-    hostname = socket.gethostname()
-    ver = "%s-%s-%s%s" % (ver, btime, hostname, options.extra)
-    write_version(outfile, ver, toolstr)
+    if not cleanbuild:
+        btime = time.strftime("%Y%m%d_%H%M%S")
+        hostname = socket.gethostname()
+        ver = "%s-%s-%s" % (ver, btime, hostname)
+    write_version(outfile, ver + options.extra, toolstr)
 
 if __name__ == '__main__':
     main()