git_sha1: simplify logic
authorEric Engestrom <eric.engestrom@intel.com>
Thu, 16 Aug 2018 13:02:44 +0000 (14:02 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 16 Aug 2018 16:38:31 +0000 (17:38 +0100)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
bin/git_sha1_gen.py
src/Makefile.am
src/git_sha1.h.in [deleted file]
src/mesa/Android.libmesa_git_sha1.mk

index 77c5fa9d2951c8e10c1c2a17d13fdf2cf69582eb..c6240662df3f6146a57f82e7a1a084473bff9e9e 100755 (executable)
@@ -47,10 +47,6 @@ args = parser.parse_args()
 
 git_sha1 = os.environ.get('MESA_GIT_SHA1_OVERRIDE', get_git_sha1())[:10]
 if git_sha1:
-    git_sha1_h_in_path = os.path.join(os.path.dirname(sys.argv[0]),
-                                      '..', 'src', 'git_sha1.h.in')
-    with open(git_sha1_h_in_path, 'r') as git_sha1_h_in:
-        new_sha1 = git_sha1_h_in.read().replace('@VCS_TAG@', git_sha1)
-        write_if_different(new_sha1)
+    write_if_different('#define MESA_GIT_SHA1 "git-' + git_sha1 + '"')
 else:
     write_if_different('')
index 9de0192b791e3ee76d9cfb7e225bac7fb167a679..396865cbe550b80e760ecb5953afe8dc22406841 100644 (file)
@@ -20,7 +20,7 @@
 # IN THE SOFTWARE.
 
 .PHONY: git_sha1.h
-git_sha1.h: $(top_srcdir)/src/git_sha1.h.in
+git_sha1.h:
        @echo "updating $@"
        @$(PYTHON2) $(top_srcdir)/bin/git_sha1_gen.py --output $@
 
diff --git a/src/git_sha1.h.in b/src/git_sha1.h.in
deleted file mode 100644 (file)
index dc17f5e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define MESA_GIT_SHA1 "git-@VCS_TAG@"
index d27923074dd289a115de2db9a3707ce23cff22c6..fbbbf2fe09429f92f63882ac2efb9453e4c93219 100644 (file)
@@ -43,7 +43,7 @@ $(intermediates)/dummy.c:
 
 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, git_sha1.h)
 
-$(intermediates)/git_sha1.h: $(MESA_TOP)/src/git_sha1.h.in $(wildcard $(MESA_TOP)/.git/logs/HEAD)
+$(intermediates)/git_sha1.h: $(wildcard $(MESA_TOP)/.git/logs/HEAD)
        @mkdir -p $(dir $@)
        @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git"
        $(hide) $(MESA_PYTHON2) $(MESA_TOP)/bin/git_sha1_gen.py --output $@