[SCM] CTDB repository - branch master updated - ctdb-1.13-338-g16a91c2

Amitay Isaacs amitay at samba.org
Tue Oct 30 01:33:06 MDT 2012


The branch, master has been updated
       via  16a91c2a4d03b46743611e2fe844bb2cef95e46a (commit)
       via  3d4838db51dd8199b9c29aebb6e7bfbd2a27b8bb (commit)
       via  f8af7d8de76e68e5c4bde15f832a31ce9107e8c7 (commit)
       via  8df7ea6b20417833792932487a082b3c71bb6837 (commit)
       via  b151f9b62299ec5b887c62cef780547a39c0ba9d (commit)
      from  9be3b23adbfc844b71bf1d4ddf0fbc3b269f15fa (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 16a91c2a4d03b46743611e2fe844bb2cef95e46a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Oct 30 11:54:52 2012 +1100

    packaging: Use maketarball.sh script to create tarball for RPM
    
    This removes the duplicate code for building tarball and reuses existing
    script.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 3d4838db51dd8199b9c29aebb6e7bfbd2a27b8bb
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Oct 30 11:52:19 2012 +1100

    packaging: Use optional argument as targetdir when creating tarball
    
    In addition, do not modify CTDB version string with extra suffix.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit f8af7d8de76e68e5c4bde15f832a31ce9107e8c7
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Oct 30 11:49:28 2012 +1100

    tool/ctdb: Always support ctdb version command, don't make it optional
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 8df7ea6b20417833792932487a082b3c71bb6837
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Oct 30 11:48:23 2012 +1100

    build: Add rules to create include/version.h when building from git tree
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit b151f9b62299ec5b887c62cef780547a39c0ba9d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Oct 30 11:47:24 2012 +1100

    packaging: Create include/version.h to define CTDB_VERSION_STRING
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                |    8 +++++++-
 packaging/RPM/ctdb.spec.in |    2 +-
 packaging/RPM/makerpms.sh  |   23 +++++------------------
 packaging/maketarball.sh   |   28 ++++++++++++++--------------
 packaging/mkversion.sh     |   14 ++++++++++++++
 tools/ctdb.c               |   11 +++--------
 6 files changed, 44 insertions(+), 42 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 3294503..fef2e45 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -63,6 +63,8 @@ SHLD=${CC} ${CFLAGS} ${LDSHFLAGS} -o $@
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) $(TALLOC_LIBS) $(TEVENT_LIBS) $(TDB_LIBS) \
 		  @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
 
+CTDB_VERSION_H = include/version.h
+
 UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util.o \
 	lib/util/util_time.o lib/util/util_file.o lib/util/fault.o lib/util/substitute.o \
 	lib/util/signal.o
@@ -112,7 +114,7 @@ DIRS = lib bin tests/bin
 
 .SUFFIXES: .c .o .h
 
-all: showflags dirs $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(CTDB_LIB_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
+all: showflags dirs $(CTDB_VERSION_H) $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(CTDB_LIB_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
 
 showflags:
 	@echo 'ctdb will be compiled with flags:'
@@ -138,6 +140,10 @@ showlayout::
 dirs:
 	@mkdir -p $(DIRS)
 
+$(CTDB_VERSION_H):
+	@echo Generating $@
+	@./packaging/mkversion.sh
+
 bin/ctdbd: $(CTDB_SERVER_OBJ)
 	@echo Linking $@
 	@$(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ) $(LIB_FLAGS)
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index b0555c7..50287ab 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -71,7 +71,7 @@ export CC
 ## always run autogen.sh
 ./autogen.sh
 
-CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE -DCTDB_VERS=\"%{version}-%{release}\"" ./configure \
+CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE" ./configure \
 %if %with_included_talloc
 	--with-included-talloc \
 %endif
diff --git a/packaging/RPM/makerpms.sh b/packaging/RPM/makerpms.sh
index 254abde..c216185 100755
--- a/packaging/RPM/makerpms.sh
+++ b/packaging/RPM/makerpms.sh
@@ -52,7 +52,7 @@ mkdir -p `rpm --eval %_rpmdir`/noarch
 mkdir -p `rpm --eval %_rpmdir`/i386
 mkdir -p `rpm --eval %_rpmdir`/x86_64
 
-VERSION=$(${TOPDIR}/packaging/mkversion.sh)
+VERSION=$(${TOPDIR}/packaging/mkversion.sh ${TOPDIR}/include/version.h)
 if [ -z "$VERSION" ]; then
     exit 1
 fi
@@ -61,23 +61,10 @@ sed -e s/@VERSION@/$VERSION/g \
 	< ${DIRNAME}/${SPECFILE_IN} \
 	> ${DIRNAME}/${SPECFILE}
 
-VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
-
-if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
-	GZIP="gzip -9 --rsyncable"
-else
-	GZIP="gzip -9"
-fi
-
-pushd ${TOPDIR}
-echo -n "Creating ctdb-${VERSION}.tar.gz ... "
-git archive --prefix=ctdb-${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/ctdb-${VERSION}.tar.gz
-RC=$?
-popd
-echo "Done."
-if [ $RC -ne 0 ]; then
-        echo "Build failed!"
-        exit 1
+${TOPDIR}/packaging/maketarball.sh ${SRCDIR}
+if [ $? -ne 0 ]; then
+	echo "Build failed!"
+	exit 1
 fi
 
 # At this point the SPECDIR and SRCDIR vaiables must have a value!
diff --git a/packaging/maketarball.sh b/packaging/maketarball.sh
index 677e1e7..221fede 100755
--- a/packaging/maketarball.sh
+++ b/packaging/maketarball.sh
@@ -20,23 +20,22 @@
 
 #
 # Create CTDB source tarball of the current git branch HEAD.
-# The version is extracted from the spec file...
-# The first extra argument will be added as an additional version.
+# The version is calculated from git tag in mkversion.sh.
+# Optional argument is the directory to which tarball is copied.
 #
 
 DIRNAME=$(dirname $0)
 TOPDIR=${DIRNAME}/..
 
+TARGETDIR="$1"
+if [ -z "${TARGETDIR}" ]; then
+    TARGETDIR="."
+fi
+
 TAR_PREFIX_TMP="ctdb-tmp"
 SPECFILE=/tmp/${TAR_PREFIX_TMP}/packaging/RPM/ctdb.spec
 SPECFILE_IN=${SPECFILE}.in
-
-EXTRA_SUFFIX="$1"
-
-VERSION=$(${TOPDIR}/packaging/mkversion.sh)
-if [ -z "$VERSION" ]; then
-    exit 1
-fi
+VERSION_H=/tmp/${TAR_PREFIX_TMP}/include/version.h
 
 if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
 	GZIP="gzip -9 --rsyncable"
@@ -54,14 +53,15 @@ if [ $RC -ne 0 ]; then
 	exit 1
 fi
 
+VERSION=$(${TOPDIR}/packaging/mkversion.sh ${VERSION_H})
+if [ -z "$VERSION" ]; then
+    exit 1
+fi
+
 sed -e s/@VERSION@/${VERSION}/g \
 	< ${SPECFILE_IN} \
 	> ${SPECFILE}
 
-if [ "x${EXTRA_SUFFIX}" != "x" ]; then
-	VERSION="${VERSION}-${EXTRA_SUFFIX}"
-fi
-
 TAR_PREFIX="ctdb-${VERSION}"
 TAR_BASE="ctdb-${VERSION}"
 
@@ -113,7 +113,7 @@ rm -rf ${TAR_PREFIX}
 
 popd
 
-mv /tmp/${TAR_GZ_BALL} .
+mv /tmp/${TAR_GZ_BALL} ${TARGETDIR}/
 
 echo "Done."
 exit 0
diff --git a/packaging/mkversion.sh b/packaging/mkversion.sh
index 7d12f68..18b432a 100755
--- a/packaging/mkversion.sh
+++ b/packaging/mkversion.sh
@@ -22,6 +22,12 @@
 # Common code to generate CTDB version string
 #
 
+OUTPUT=$1
+
+if [ -z "$OUTPUT" ]; then
+    OUTPUT="include/version.h"
+fi
+
 # We use tags and determine the version, as follows:
 # ctdb-0.9.1  (First release of 0.9).
 # ctdb-0.9.23 (23rd minor release of the 112 version)
@@ -47,4 +53,12 @@ case "$TAG" in
 	echo Invalid tag "$TAG" >&2
 	;;
 esac
+
+cat > "$OUTPUT" <<EOF
+/* This file is auto-genrated by packaging/mkversion.sh */
+
+#define CTDB_VERSION_STRING "$VERSION"
+
+EOF
+
 echo $VERSION
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 7c8afd8..d132cae 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -25,6 +25,7 @@
 #include "system/locale.h"
 #include "popt.h"
 #include "cmdline.h"
+#include "../include/version.h"
 #include "../include/ctdb.h"
 #include "../include/ctdb_client.h"
 #include "../include/ctdb_private.h"
@@ -56,15 +57,11 @@ static struct {
 #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0)
 #define LONGTIMELIMIT() timeval_current_ofs(options.timelimit*10, 0)
 
-#ifdef CTDB_VERS
 static int control_version(struct ctdb_context *ctdb, int argc, const char **argv)
 {
-#define STR(x) #x
-#define XSTR(x) STR(x)
-	printf("CTDB version: %s\n", XSTR(CTDB_VERS));
+	printf("CTDB version: %s\n", CTDB_VERSION_STRING);
 	return 0;
 }
-#endif
 
 #define CTDB_NOMEM_ABORT(p) do { if (!(p)) {				\
 		DEBUG(DEBUG_ALERT,("ctdb fatal error: %s\n",		\
@@ -5786,9 +5783,7 @@ static const struct {
 	const char *msg;
 	const char *args;
 } ctdb_commands[] = {
-#ifdef CTDB_VERS
-	{ "version",         control_version,           true,	false,  "show version of ctdb" },
-#endif
+	{ "version",         control_version,           true,	true,   "show version of ctdb" },
 	{ "status",          control_status,            true,	false,  "show node status" },
 	{ "uptime",          control_uptime,            true,	false,  "show node uptime" },
 	{ "ping",            control_ping,              true,	false,  "ping all nodes" },


-- 
CTDB repository


More information about the samba-cvs mailing list