From 3334bab3cdafd2f22530525a9768e69a70f25b22 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 Jun 2017 12:15:25 +0200 Subject: [PATCH 1/3] ctdb-build: use a fixed ctdb_version.h using SAMBA_VERSION_STRING This way we don't get constant rebuild as SAMBA_VERSION_STRING is "4.7.0pre1.DEVELOPERBUILD" for the binaries under bin/ instead of "4.7.0pre1.GIT.59e51f6". BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789 Signed-off-by: Stefan Metzmacher Reviewed-by: Martin Schwenke (cherry picked from commit 05c28fee21c0cc986cb8301f4199595cdb13faee) --- ctdb/.gitignore | 1 - ctdb/include/ctdb_version.h | 3 +++ ctdb/wscript | 15 --------------- 3 files changed, 3 insertions(+), 16 deletions(-) create mode 100644 ctdb/include/ctdb_version.h diff --git a/ctdb/.gitignore b/ctdb/.gitignore index a634aeb8b45..f0534b3afd1 100644 --- a/ctdb/.gitignore +++ b/ctdb/.gitignore @@ -27,7 +27,6 @@ tests/takeover/ctdb_takeover.pyc tests/eventscripts/var tests/eventscripts/etc/iproute2 tests/eventscripts/etc-ctdb/policy_routing -include/ctdb_version.h packaging/RPM/ctdb.spec doc/*.[1-7] doc/*.[1-7].html diff --git a/ctdb/include/ctdb_version.h b/ctdb/include/ctdb_version.h new file mode 100644 index 00000000000..cf27179aff8 --- /dev/null +++ b/ctdb/include/ctdb_version.h @@ -0,0 +1,3 @@ +#include "version.h" + +#define CTDB_VERSION_STRING SAMBA_VERSION_STRING diff --git a/ctdb/wscript b/ctdb/wscript index c2f1956a916..975235941cb 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -340,15 +340,6 @@ def configure(conf): else: Logs.info(" %s: no" % (m)) -def gen_ctdb_version(task): - fp = open(task.outputs[0].bldpath(task.env), 'w') - fp.write('/* This file is auto-generated from waf */\n') - fp.write('#include "version.h"\n') - fp.write('\n') - fp.write('#define CTDB_VERSION_STRING "%s"\n' % get_version_string()) - fp.close() - - def build(bld): if bld.env.standalone_ctdb: # enable building of public headers in the build tree @@ -357,12 +348,6 @@ def build(bld): if bld.env.standalone_ctdb: bld.SAMBA_MKVERSION('version.h', '%s/VERSION' % vdir) - t = bld.SAMBA_GENERATOR('ctdb-version-header', - target='include/ctdb_version.h', - rule=gen_ctdb_version, - dep_vars=['VERSION']) - t.env.VERSION = get_version_string() - bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig' bld.RECURSE('lib/replace') -- 2.20.1 From 885257d3ba8530c2229f48c4ec4721fa2aa060d2 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 7 Mar 2019 17:53:25 +1100 Subject: [PATCH 2/3] ctdb-build: Drop creation of .distversion in tarball BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit 148306674d0e4706adca3e5dcbb779c51a2c03da) --- ctdb/wscript | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ctdb/wscript b/ctdb/wscript index 975235941cb..3c162e1a39c 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -1166,14 +1166,6 @@ def manpages(ctx): def distonly(ctx): samba_dist.DIST_FILES('VERSION:VERSION', extend=True) - version = get_version() - - distfile = open('.distversion', 'w') - for field in version.vcs_fields: - distfile.write('%s=%s\n' % (field, str(version.vcs_fields[field]))) - distfile.close() - samba_dist.DIST_FILES('ctdb/.distversion:.distversion', extend=True) - t = 'ctdb.spec' sed_expr1 = 's/@VERSION@/%s/g' % get_version_string() sed_expr2 = 's/@RELEASE@/%s/g' % '1' -- 2.20.1 From 53c3224f10cafb51b63a9ff00d99ea46d1f0b87a Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 15 Mar 2019 12:14:27 +1100 Subject: [PATCH 3/3] ctdb-version: Simplify version string usage There is no need to write SAMBA_VERSION_STRING as CTDB_VERSION_STRING. Wherever required use SAMBA_VERSION_STRING directly. Avoids the confusion with two version.h files. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Fri Mar 15 06:31:50 UTC 2019 on sn-devel-144 (cherry picked from commit edd4a23d7632af51f4d7b4287917b7fa0dced963) --- ctdb/common/version.c | 20 -------------------- ctdb/common/version.h | 18 ------------------ ctdb/include/ctdb_version.h | 3 --- ctdb/server/ctdb_daemon.c | 4 ++-- ctdb/tools/ctdb.c | 4 ++-- ctdb/wscript | 2 +- 6 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 ctdb/common/version.c delete mode 100644 ctdb/common/version.h delete mode 100644 ctdb/include/ctdb_version.h diff --git a/ctdb/common/version.c b/ctdb/common/version.c deleted file mode 100644 index e34e98c09ef..00000000000 --- a/ctdb/common/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - CTDB version string - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -*/ - -#include "ctdb_version.h" - -const char ctdb_version_string[] = CTDB_VERSION_STRING; diff --git a/ctdb/common/version.h b/ctdb/common/version.h deleted file mode 100644 index 1cf1c5d0cab..00000000000 --- a/ctdb/common/version.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - CTDB version string - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -*/ - -extern const char ctdb_version_string[]; diff --git a/ctdb/include/ctdb_version.h b/ctdb/include/ctdb_version.h deleted file mode 100644 index cf27179aff8..00000000000 --- a/ctdb/include/ctdb_version.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "version.h" - -#define CTDB_VERSION_STRING SAMBA_VERSION_STRING diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index aac331dd1dd..a8691388d4a 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -36,7 +36,7 @@ #include "lib/util/blocking.h" #include "lib/util/become_daemon.h" -#include "common/version.h" +#include "version.h" #include "ctdb_private.h" #include "ctdb_client.h" @@ -1237,7 +1237,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork) ctdb->ctdbd_pid = getpid(); DEBUG(DEBUG_ERR, ("Starting CTDBD (Version %s) as PID: %u\n", - ctdb_version_string, ctdb->ctdbd_pid)); + SAMBA_VERSION_STRING, ctdb->ctdbd_pid)); ctdb_create_pidfile(ctdb); /* create a unix domain stream socket to listen to */ diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index ee64566ba04..0fbe54c9f83 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -30,7 +30,7 @@ #include #include -#include "common/version.h" +#include "version.h" #include "lib/util/debug.h" #include "lib/util/samba_util.h" #include "lib/util/sys_rw.h" @@ -718,7 +718,7 @@ static int run_helper(TALLOC_CTX *mem_ctx, const char *command, static int control_version(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, int argc, const char **argv) { - printf("%s\n", ctdb_version_string); + printf("%s\n", SAMBA_VERSION_STRING); return 0; } diff --git a/ctdb/wscript b/ctdb/wscript index 3c162e1a39c..4adf60046c3 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -412,7 +412,7 @@ def build(bld): pidfile.c run_proc.c hash_count.c run_event.c event_script.c - sock_client.c version.c + sock_client.c cmdline.c path.c conf.c line.c '''), deps='''samba-util sys_rw tevent-util -- 2.20.1