Avoid git version always appearing as dirty
authorMatt Corallo <git-ldk-build@bluematt.me>
Mon, 7 Jun 2021 20:38:52 +0000 (20:38 +0000)
committerMatt Corallo <git-ldk-build@bluematt.me>
Tue, 8 Jun 2021 20:26:10 +0000 (20:26 +0000)
genbindings.py
genbindings.sh

index 43956f4339eefd0756a014baac39b3f114707869..35a3be01a2259b1a4f9ec596da93763c4eef9516 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-import sys, re, subprocess
+import os, sys, re, subprocess
 
 if len(sys.argv) < 7:
     print("USAGE: /path/to/lightning.h /path/to/bindings/output /path/to/bindings/ /path/to/bindings/output.c debug lang")
@@ -33,7 +33,9 @@ else:
 
 consts = Consts(DEBUG, target=target)
 
-local_git_version = subprocess.check_output(["git", "describe", '--tag', '--dirty']).decode("utf-8").strip()
+local_git_version = os.getenv("LDK_GARBAGECOLLECTED_GIT_OVERRIDE")
+if local_git_version is None:
+    local_git_version = subprocess.check_output(["git", "describe", '--tag', '--dirty']).decode("utf-8").strip()
 
 from bindingstypes import *
 
index b06f9c40bed55d8b6e2144319f97a9f106633d1d..cd549d792f9efb6bf7c8e9ddc8bb86e579a7f926 100755 (executable)
@@ -18,6 +18,10 @@ fi
 
 set -e
 
+if [ "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" = "" ]; then
+       export LDK_GARBAGECOLLECTED_GIT_OVERRIDE=$(git describe --tag --dirty)
+fi
+
 cp "$1/lightning-c-bindings/include/lightning.h" ./
 if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then
        # OSX sed is for some reason not compatible with GNU sed