[Openchrome-devel] [PATCH] add git branch to the version string

Xavier Bachelot xavier
Mon Feb 20 13:04:39 PST 2012


Add the git branch to the generated version.h file.

---
 src/Makefile.am |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index a5a6c6c..6d7eb2d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -95,17 +95,21 @@ endif
 via_driver.lo: version.h
 version.h: $(openchrome_drv_la_SOURCES)
 	@if [ -d ../.git ]; then \
-	    echo '#define BUILDCOMMENT "(developement build, at revision '\
-        "`git log -1 --pretty=format:%h | head -1`"')"' > $@.tmp; \
-    else \
-        if [ -d .svn ]; then \
+	        echo '#define BUILDCOMMENT "(developement build, branch' \
+	              "`git branch -v | sed 's/no branch/no_branch/' | \
+	               awk '/^\*/ { print $$2 }'`" \
+	              'at revision' \
+	              "`git log -1 --pretty=format:%h | head -1`"')"' \
+	             > $@.tmp; \
+	    else \
+	        if [ -d .svn ]; then \
 	        echo '#define BUILDCOMMENT "(development build, at revision '\
 	        "`svnversion -nc .. | sed -e s/^[^:]*://`"')"' > $@.tmp; \
-        else \
+	        else \
 	        date +'#define BUILDCOMMENT "(development build, compiled on %c)"' \
-        	> $@.tmp; \
+	        	> $@.tmp; \
 	    fi; \
-    fi
+	fi
  	@chmod 666 $@.tmp
 	@mv $@.tmp $@
-- 
1.7.6.5

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Attached Message Part
Url: http://wiki.openchrome.org/pipermail/openchrome-devel/attachments/20120220/fa0804bd/AttachedMessagePart.ksh



More information about the Openchrome-devel mailing list