[Beignet] [PATCH 56/57] Add git sha generator.
junyan.he at inbox.com
junyan.he at inbox.com
Sun Jun 11 05:50:42 UTC 2017
From: Junyan He <junyan.he at intel.com>
We add git repo info for each beignet runtime building.
Signed-off-by: Junyan He <junyan.he at intel.com>
---
runtime/git_sha1.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100755 runtime/git_sha1.sh
diff --git a/runtime/git_sha1.sh b/runtime/git_sha1.sh
new file mode 100755
index 0000000..f44f078
--- /dev/null
+++ b/runtime/git_sha1.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+SOURCE_DIR=$1
+FILE=$2
+
+touch ${SOURCE_DIR}/${FILE}_tmp
+if test -d ${SOURCE_DIR}/../.git; then
+ if which git > /dev/null; then
+ git --git-dir=${SOURCE_DIR}/../.git log -n 1 --oneline | \
+ sed 's/^\([^ ]*\) .*/#define BEIGNET_GIT_SHA1 "git-\1"/' \
+ > ${SOURCE_DIR}/${FILE}_tmp
+ fi
+fi
+
+#updating ${SOURCE_DIR}/${FILE}
+if ! cmp -s ${SOURCE_DIR}/${FILE}_tmp ${SOURCE_DIR}/${FILE}; then
+ mv ${SOURCE_DIR}/${FILE}_tmp ${SOURCE_DIR}/${FILE}
+else
+ rm ${SOURCE_DIR}/${FILE}_tmp
+fi
--
2.7.4
More information about the Beignet
mailing list