From: Jameson Graef Rollins <jrollins@finestructure.net>
Date: Sun, 22 Feb 2009 17:07:34 +0000 (-0500)
Subject: Fix how version number is saved/retrieved.  Version is now stored in
X-Git-Tag: monkeysphere_0.24~61
X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e71c7bb4dff26178f714cd0fcdbb3058effa4066;p=monkeysphere.git

Fix how version number is saved/retrieved.  Version is now stored in
VERSION file, which is created in the tarball target.  This is then
installed at /usr/share/monkeysphere/VERSION, and cat'ed when the
version number is requested by the front-end ui.  No more manual
setting of version number required (to avoid future problems, aka
"0.23.1").  This system is also more flexible, as the VERSION file
could potentially hold more info than just the release number.
---

diff --git a/Makefile b/Makefile
index 71df92b..0284a8a 100755
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ tarball: clean
 	mkdir -p monkeysphere-$(MONKEYSPHERE_VERSION)/doc
 	ln -s ../../website/getting-started-user.mdwn ../../website/getting-started-admin.mdwn ../../doc/TODO ../../doc/MonkeySpec monkeysphere-$(MONKEYSPHERE_VERSION)/doc
 	ln -s ../COPYING ../etc ../Makefile ../man ../src ../tests monkeysphere-$(MONKEYSPHERE_VERSION)
+	echo $(MONKEYSPHERE_VERSION) > monkeysphere-$(MONKEYSPHERE_VERSION)/VERSION
 	tar -ch --exclude='*~' monkeysphere-$(MONKEYSPHERE_VERSION) | gzip -n > monkeysphere_$(MONKEYSPHERE_VERSION).orig.tar.gz
 	rm -rf monkeysphere-$(MONKEYSPHERE_VERSION)
 
@@ -50,6 +51,7 @@ install: all installman
 	mkdir -p $(DESTDIR)$(PREFIX)/share/monkeysphere/m $(DESTDIR)$(PREFIX)/share/monkeysphere/mh $(DESTDIR)$(PREFIX)/share/monkeysphere/ma $(DESTDIR)$(PREFIX)/share/monkeysphere/transitions
 	mkdir -p $(DESTDIR)$(ETCPREFIX)/etc/monkeysphere
 	mkdir -p $(DESTDIR)$(PREFIX)/share/doc/monkeysphere
+	install -m 0644 VERSION $(DESTDIR)$(PREFIX)/share/monkeysphere
 	install src/monkeysphere src/keytrans/openpgp2ssh src/keytrans/pem2openpgp $(DESTDIR)$(PREFIX)/bin
 	install src/monkeysphere-host src/monkeysphere-authentication $(DESTDIR)$(PREFIX)/sbin
 	install -m 0644 src/share/common $(DESTDIR)$(PREFIX)/share/monkeysphere
diff --git a/packaging/debian/changelog b/packaging/debian/changelog
index 96b719b..58a80a3 100644
--- a/packaging/debian/changelog
+++ b/packaging/debian/changelog
@@ -1,3 +1,10 @@
+monkeysphere (0.24~pre-1) UNRELEASED; urgency=low
+
+  * New upstream release:
+    - Fixed how version information is stored/retrieved.
+
+ -- Jameson Graef Rollins <jrollins@finestructure.net>  Sun, 22 Feb 2009 12:02:06 -0500
+
 monkeysphere (0.23.1-1) unstable; urgency=low
 
   * New Upstrem "Brown Paper Bag" Release:
diff --git a/src/monkeysphere b/src/monkeysphere
index 371983f..6db4827 100755
--- a/src/monkeysphere
+++ b/src/monkeysphere
@@ -239,7 +239,7 @@ case $COMMAND in
 	;;
 
     'version'|'v')
-	echo "$VERSION"
+	version
 	;;
 
     '--help'|'help'|'-h'|'h'|'?')
diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication
index 497470d..c009653 100755
--- a/src/monkeysphere-authentication
+++ b/src/monkeysphere-authentication
@@ -199,7 +199,7 @@ case $COMMAND in
 	;;
 
     'version'|'v')
-	echo "$VERSION"
+	version
 	;;
 
     '--help'|'help'|'-h'|'h'|'?')
diff --git a/src/monkeysphere-host b/src/monkeysphere-host
index 1b0de0c..c454354 100755
--- a/src/monkeysphere-host
+++ b/src/monkeysphere-host
@@ -315,7 +315,7 @@ case $COMMAND in
 	;;
 
     'version'|'v')
-	echo "$VERSION"
+	version
 	;;
 
     '--help'|'help'|'-h'|'h'|'?')
diff --git a/src/share/common b/src/share/common
index 0c26a91..b2dcd35 100644
--- a/src/share/common
+++ b/src/share/common
@@ -20,9 +20,6 @@
 SYSCONFIGDIR=${MONKEYSPHERE_SYSCONFIGDIR:-"/etc/monkeysphere"}
 export SYSCONFIGDIR
 
-# monkeysphere version
-VERSION=0.23.1
-
 # default log level
 LOG_LEVEL="INFO"
 
@@ -41,6 +38,11 @@ PROMPT="true"
 ########################################################################
 ### UTILITY FUNCTIONS
 
+# output version info
+version() {
+    cat "${SYSSHAREDIR}/VERSION"
+}
+
 # failure function.  exits with code 255, unless specified otherwise.
 failure() {
     [ "$1" ] && echo "$1" >&2
diff --git a/tests/basic b/tests/basic
index 9308e21..b1fe9ed 100755
--- a/tests/basic
+++ b/tests/basic
@@ -138,22 +138,6 @@ export SOCKET="$TEMPDIR"/ssh-socket
 # *anything* with any running X11 session.
 export DISPLAY=monkeys
 
-## make sure that the version number matches the debian changelog
-## (don't bother if this is being run from the tests).
-
-if [ -f "$TESTDIR"/../packaging/debian/changelog ]; then
-    echo
-    echo "##################################################"
-    echo "### checking version string match..."
-    repver=$(monkeysphere version)
-    debver=$(head -n1 "$TESTDIR"/../packaging/debian/changelog | sed 's/.*(\([^-]*\)-.*/\1/')
-    if [ "$repver" = "$debver" ] ; then
-	echo "Versions match!"
-    else
-	printf "reported version string (%s) does not match debian changelog (%s)\n" "$repver" "$debver"
-	exit 1
-    fi
-fi
 
 ######################################################################
 ### CONFIGURE ENVIRONMENTS
diff --git a/utils/preparing-release b/utils/preparing-release
index 3c7ded5..dd9d224 100644
--- a/utils/preparing-release
+++ b/utils/preparing-release
@@ -3,9 +3,6 @@
  * make sure that packaging/debian/changelog has a reasonable version
    number.
 
- * make sure that src/share/common contains the upstream part of that
-   version number in the VERSION= line
-
  * make tarball
 
  * make releasenote