ctdb-build: Calculate correct version when building from tarball
authorAmitay Isaacs <amitay@gmail.com>
Fri, 23 Oct 2015 02:05:20 +0000 (13:05 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 30 Oct 2015 01:00:27 +0000 (02:00 +0100)
When building standalone ctdb from git repo, samba_version_file correctly
includes git sha in VERSION string.  When building standalone ctdb from
tarball, samba_version_file puts UNKNOWN in the VERSION string.

Use the packaged include/ctdb_version.h file to set the correct git sha.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/packaging/mkversion.sh
ctdb/server/ctdb_daemon.c
ctdb/tools/ctdb.c

index e4a37adb654930c747f1203349f19905d8f4942e..54dc2cd15fa05708559350225728bbc8584c4787 100755 (executable)
@@ -61,10 +61,21 @@ case "$TAG" in
        ;;
 esac
 
+else
+
+    # If building from tarball, Samba version creation will create
+    # VERSION with UNKNOWN git hash.
+    case "$VERSION" in
+        *UNKNOWN)
+           if [ -f ../include/ctdb_version.h ] ; then
+               VERSION=$(awk -F \" '/CTDB_VERSION_STRING/ {print $2}' ../include/ctdb_version.h)
+           fi
+           ;;
+    esac
 fi
 
 cat > "$OUTPUT" <<EOF
-/* This file is auto-genrated by packaging/mkversion.sh */
+/* This file is auto-generated by packaging/mkversion.sh */
 
 #define CTDB_VERSION_STRING "$VERSION"
 
index 3598c580ac4039a8bbe9f16b0e292700c11b24e3..7371b05b1d92f2ff11a8acecd480a2628f53c16a 100644 (file)
@@ -34,7 +34,7 @@
 #include "lib/util/debug.h"
 #include "lib/util/samba_util.h"
 
-#include "../include/ctdb_version.h"
+#include "ctdb_version.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
 #include "ctdb_logging.h"
index 4c6f8226713961f18f7f44b433a004361e10b69a..976fe6178f897b1c03afa837692ce10573ca2f88 100644 (file)
@@ -38,7 +38,7 @@
 #include "lib/util/time.h"
 
 #include "ctdb_logging.h"
-#include "../include/ctdb_version.h"
+#include "ctdb_version.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"