[Mesa-dev] [PATCH mesa v2 1/3] git_sha1: simplify logic

Eric Engestrom eric.engestrom at intel.com
Thu Aug 16 13:20:03 UTC 2018


Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 bin/git_sha1_gen.py                  | 6 +-----
 src/Makefile.am                      | 2 +-
 src/git_sha1.h.in                    | 1 -
 src/mesa/Android.libmesa_git_sha1.mk | 2 +-
 4 files changed, 3 insertions(+), 8 deletions(-)
 delete mode 100644 src/git_sha1.h.in

diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
index 77c5fa9d2951c8e10c1c..c6240662df3f6146a57f 100755
--- a/bin/git_sha1_gen.py
+++ b/bin/git_sha1_gen.py
@@ -47,10 +47,6 @@ def write_if_different(contents):
 
 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('')
diff --git a/src/Makefile.am b/src/Makefile.am
index 9de0192b791e3ee76d9c..396865cbe550b80e760e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
index dc17f5e6614930d7d376..00000000000000000000
--- a/src/git_sha1.h.in
+++ /dev/null
@@ -1 +0,0 @@
-#define MESA_GIT_SHA1 "git- at VCS_TAG@"
diff --git a/src/mesa/Android.libmesa_git_sha1.mk b/src/mesa/Android.libmesa_git_sha1.mk
index d27923074dd289a115de..fbbbf2fe09429f92f638 100644
--- a/src/mesa/Android.libmesa_git_sha1.mk
+++ b/src/mesa/Android.libmesa_git_sha1.mk
@@ -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 $@
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list