Have version.sh check for version information in EXPORTED_VERSION (formerly GITHASH).

Multimedia / MythTV - Stuart Morgan [mythtv.org] - 2 September 2013 13:28 EDT

Have version.sh check for version information in EXPORTED_VERSION (formerly GITHASH).

This gives us usable version information for source which has been exported from git with git archive.

###

diff --git a/.gitattributes b/.gitattributes
index 554f67a..b35b040 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
-mythtv/GITHASH export-subst
-mythplugins/GITHASH export-subst
+mythtv/EXPORTED_VERSION export-subst
+mythplugins/EXPORTED_VERSION export-subst
diff --git a/mythplugins/GITHASH b/mythplugins/GITHASH
deleted file mode 100644
index 6828f88..0000000
--- a/mythplugins/GITHASH
+++ /dev/null
@@ -1 +0,0 @@
-$Format:%H$
diff --git a/mythtv/EXPORTED_VERSION b/mythtv/EXPORTED_VERSION
new file mode 100644
index 0000000..607a44e
--- /dev/null
+++ b/mythtv/EXPORTED_VERSION
@@ -0,0 +1,2 @@
+SOURCE_VERSION="$Format:%h$"
+BRANCH="$Format:%d$"
diff --git a/mythtv/GITHASH b/mythtv/GITHASH
deleted file mode 100644
index fbe9a66..0000000
--- a/mythtv/GITHASH
+++ /dev/null
@@ -1 +0,0 @@
-$Format:%d$-Exported-$Format:%h$
diff --git a/mythtv/version.sh b/mythtv/version.sh
index a8939c4..238fbff 100755
--- a/mythtv/version.sh
+++ b/mythtv/version.sh
@@ -27,12 +27,16 @@ SOURCE_VERSION=$(git describe --dirty || git describe || echo Unknown)

case "${SOURCE_VERSION}" in
exported|Unknown)
- if test -e $GITTREEDIR/VERSION ; then
+ if ! grep -q Format $GITTREEDIR/EXPORTED_VERSION; then
+ . $GITTREEDIR/EXPORTED_VERSION
+ elif test -e $GITTREEDIR/VERSION ; then
. $GITTREEDIR/VERSION
fi
;;
*)
- BRANCH=$(git branch --no-color | sed -e '/^[^\*]/d' -e 's/^\* //' -e 's/(no branch)/exported/')
+ if [ -z "${BRANCH}" ]; then
+ BRANCH=$(git branch --no-color | sed -e '/^[^\*]/d' -e 's/^\* //' -e 's/(no branch)/exported/')
+ fi
;;
esac

cc037a8 Have version.sh check for version information in EXPORTED_VERSION (formerly GITHASH).
.gitattributes | 4 ++--
mythplugins/GITHASH | 1 -
mythtv/EXPORTED_VERSION | 2 ++
mythtv/GITHASH | 1 -
mythtv/version.sh | 8 ++++++--
5 files changed, 10 insertions(+), 6 deletions(-)

Upstream: github.com


  • Share