aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-04-22 11:34:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-04-22 11:39:25 -0400
commit947ffe706d5dc9a250a7de40b3afa975bc853fb0 (patch)
treed6c9b501c35708df836261318e5abad8c0cf78b0 /scripts
parentacd94909bc8b95c5f96f34a0f15e603b69b83246 (diff)
downloadkutter-947ffe706d5dc9a250a7de40b3afa975bc853fb0.tar.gz
kutter-947ffe706d5dc9a250a7de40b3afa975bc853fb0.tar.xz
kutter-947ffe706d5dc9a250a7de40b3afa975bc853fb0.zip
buildcommands: Don't attach hostname and build date to version on a clean build
Most builds will be direclty from git - removing the hostname and build date should permit reproducible binaries in that common case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildcommands.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/buildcommands.py b/scripts/buildcommands.py
index a26ee95d..5cd2f9d3 100644
--- a/scripts/buildcommands.py
+++ b/scripts/buildcommands.py
@@ -466,14 +466,18 @@ def git_version():
logging.debug("Got git version: %s" % (repr(ver),))
return ver
-def build_version(extra):
+def build_version(extra, cleanbuild):
version = git_version()
if not version:
+ cleanbuild = False
version = "?"
- btime = time.strftime("%Y%m%d_%H%M%S")
- hostname = socket.gethostname()
- version = "%s-%s-%s%s" % (version, btime, hostname, extra)
- return version
+ elif 'dirty' in version:
+ cleanbuild = False
+ if not cleanbuild:
+ btime = time.strftime("%Y%m%d_%H%M%S")
+ hostname = socket.gethostname()
+ version = "%s-%s-%s" % (version, btime, hostname)
+ return version + extra
# Run "tool --version" for each specified tool and extract versions
def tool_versions(tools):
@@ -515,7 +519,7 @@ class HandleVersions:
data['build_versions'] = self.toolstr
def generate_code(self, options):
cleanbuild, self.toolstr = tool_versions(options.tools)
- self.version = build_version(options.extra)
+ self.version = build_version(options.extra, cleanbuild)
sys.stdout.write("Version: %s\n" % (self.version,))
return "\n// version: %s\n// build_versions: %s\n" % (
self.version, self.toolstr)