From cab9eb16c9bb34b8b0b798b7d14cd55113eb6999 Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Mon, 20 Jul 2020 16:04:06 +0200
Subject: [PATCH] Added wrapper data to metadata file

---
 App/tools/driver.makefile | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/App/tools/driver.makefile b/App/tools/driver.makefile
index 14381ce1..7384ea04 100644
--- a/App/tools/driver.makefile
+++ b/App/tools/driver.makefile
@@ -174,6 +174,10 @@ export ARCH_FILTER
 export EXCLUDE_ARCHS
 export MAKE_FIRST
 
+export ${PRJ}_E3_GIT_URL
+export ${PRJ}_E3_GIT_DESC
+export ${PRJ}_E3_GIT_STATUS
+
 # Some shell commands:
 RMDIR = rm -rf
 LN = ln -s
@@ -506,9 +510,13 @@ export BINS
 
 export CFG
 
-${PRJ}_GIT_HASH := $(shell git rev-parse --short HEAD)
-export ${PRJ}_GIT_HASH
-${PRJ}_GIT_STATUS := $(shell git status --porcelain | grep -v "\.Makefile" | sed 's/\(.*\)/  - \1/')
+# These variables are written into a .yaml file in the installed module directory to keep track of 
+# metadata for which module was compiled.
+
+${PRJ}_GIT_DESC := $(shell git describe --tags 2> /dev/null | git rev-parse HEAD)
+export ${PRJ}_GIT_DESC
+# The sed is a bit hacky here, but it's needed to add a prefix to each line which make doesn't seem to do well.
+${PRJ}_GIT_STATUS := $(shell git status --porcelain | grep -v "\.Makefile" | sed 's/^/  - /')
 export ${PRJ}_GIT_STATUS
 
 else # in O.*
@@ -1003,7 +1011,11 @@ ${EXPORTFILE}: $(filter-out $(basename ${EXPORTFILE})$(OBJ),${LIBOBJS})
 
 
 ${METAFILE}:
-	@echo "module_git_hash: $(${PRJ}_GIT_HASH)" > $@
+	@echo "wrapper_url: $(${PRJ}_E3_GIT_URL)" > $@
+	@echo "wrapper_git_desc: $(${PRJ}_E3_GIT_DESC)" >> $@
+	@echo "wrapper_diffs:" >> $@
+	@echo "$(${PRJ}_E3_GIT_STATUS)" >> $@
+	@echo "module_git_desc: $(${PRJ}_GIT_DESC)" >> $@
 	@echo "module_diffs:" >> $@
 	@echo "$(${PRJ}_GIT_STATUS)" >> $@
 
-- 
GitLab