OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH v2 5/5] make-setup-generated: optionally add GIT metadata


This isn't a full conversion to git based metadata but it allows for
local builds to add git commit and tree status to the final built
product. The normal formal build process is unaffected and uses
manually updated VERSION, REVISION and REVISION-DATE metadata.

Signed-off-by: Alex BennÃe <alex.bennee@linaro.org>
---
 Makefile                |  3 +--
 make-setup-generated.sh | 34 ++++++++++++++++++++++++++++++----
 makehtml.sh             |  2 +-
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index c426a3c..1698557 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,11 @@
 # Basic Makefile to aid automation of document building
 #
 
-
-
 .PHONY: all
 all:
 	./makeall.sh
 
+.PHONY: html
 html:
 	./makehtml.sh local
 
diff --git a/make-setup-generated.sh b/make-setup-generated.sh
index f15d148..be63bb7 100755
--- a/make-setup-generated.sh
+++ b/make-setup-generated.sh
@@ -1,17 +1,34 @@
 #! /bin/sh
+#
+# Generate version and metadata preamble for the document
+#
 
+# By default we base the version on the directory metadata
 VERSION=1.1
 DATESTR=${DATESTR:-`cat REVISION-DATE 2>/dev/null`}
-if [ x"$DATESTR" = x ]; then
-    ISODATE=`git show --format=format:'%cd' --date=iso | head -n 1`
-    DATESTR=`date -d "$DATE" +'%d %B %Y'`
+
+
+# If a second argument is passed we extract what we can from git
+# metadata (closest lightweight tag) and local tree status. This
+# allows locally generated copies to be tagged appropriately.
+#
+# The formal build process skips this.
+if ! test -z "$2"; then
+    TAG=$(git describe --dirty --tags)
+    # base date on now
+    DATESTR=$(date +'%d %B %Y')
+    COMMIT=$(git rev-parse --short HEAD)
+
+    # Finally check if we have un-committed changes in the tree
+    if ! git diff-index --quiet HEAD -- ; then
+        COMMIT="$COMMIT with local changes"
+    fi
 fi
 
 case "$1" in
     *-wd*)
 	STAGE=wd
 	STAGENAME="Working Draft"
-	WORKINGDRAFT=`basename "$1" | sed 's/.*-wd//'`
 	;;
     *-os*)
 	STAGE=os
@@ -40,6 +57,15 @@ case "$1" in
 	exit 1
 esac
 
+#
+# Finally if we are building a local draft copy append the commit
+# details to the end of the working draft
+#
+if ! test -z "$COMMIT" ; then
+    STAGEEXTRATITLE="$STAGEEXTRATITLE (@ git $COMMIT)"
+fi
+
+
 #Prepend OASIS unless already there
 case "$STAGENAME" in
 	OASIS*)
diff --git a/makehtml.sh b/makehtml.sh
index e18c350..099746c 100755
--- a/makehtml.sh
+++ b/makehtml.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 SPECDOC=${SPECDOC:-`cat REVISION`}
-./make-setup-generated.sh "$SPECDOC"
+./make-setup-generated.sh "$SPECDOC" $1
 
 cp virtio-html.tex $SPECDOC.tex
 
-- 
2.20.1



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]