From b86764a6a4cb0d3cf54646051aa492baed8a6da5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 30 May 2024 10:50:12 +1200 Subject: [PATCH 1/2] build: Add --vendor-name --vendor-patch-revision options to ./configure These options are for packagers and vendors to set so that when Samba developers are debugging an issue, we know exactly which package is in use, and so have an idea if any patches have been applied. This is included in the string that a Samba backtrace gives, as part of the PANIC message. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15654 REF: https://lists.samba.org/archive/samba-technical/2024-May/138992.html Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall (cherry picked from commit 651fb94c374c7f84405d960a9e0a0fd7fcb285dd) --- buildtools/wafsamba/samba_version.py | 5 +++++ wscript | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 31103e0f8c4..576168f5723 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -253,6 +253,11 @@ def samba_version_file(version_file, path, env=None, is_install=True): print("Failed to parse line %s from %s" % (line, version_file)) raise + if "SAMBA_VERSION_VENDOR_SUFFIX" in env: + version_dict["SAMBA_VERSION_VENDOR_SUFFIX"] = env.SAMBA_VERSION_VENDOR_SUFFIX + if "SAMBA_VERSION_VENDOR_PATCH" in env: + version_dict["SAMBA_VERSION_VENDOR_PATCH"] = str(env.SAMBA_VERSION_VENDOR_PATCH) + return SambaVersion(version_dict, path, env=env, is_install=is_install) diff --git a/wscript b/wscript index 95ddd9ef5ba..4b183fd375c 100644 --- a/wscript +++ b/wscript @@ -140,7 +140,27 @@ def options(opt): dest='with_smb1server', help=("Build smbd with SMB1 support (default=yes).")) + opt.add_option('--vendor-name', + help=('Specify a vendor (or packager) name to include in the version string'), + type="string", + dest='SAMBA_VERSION_VENDOR_SUFFIX', + default=None) + + opt.add_option('--vendor-patch-revision', + help=('Specify a vendor (or packager) patch revision number include in the version string (requires --vendor-name)'), + type="int", + dest='SAMBA_VERSION_VENDOR_PATCH', + default=None) + def configure(conf): + if Options.options.SAMBA_VERSION_VENDOR_SUFFIX: + conf.env.SAMBA_VERSION_VENDOR_SUFFIX = Options.options.SAMBA_VERSION_VENDOR_SUFFIX + + if Options.options.SAMBA_VERSION_VENDOR_PATCH: + if not Options.options.SAMBA_VERSION_VENDOR_SUFFIX: + raise conf.fatal('--vendor-patch-revision requires --vendor-version') + conf.env.SAMBA_VERSION_VENDOR_PATCH = Options.options.SAMBA_VERSION_VENDOR_PATCH + version = samba_version.load_version(env=conf.env) conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1) -- 2.25.1 From efe6133e7a17f8f7a1cb7d0969edd9a2ffc81f1c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 30 May 2024 21:13:01 +1200 Subject: [PATCH 2/2] script/autobuild.py: Add test for --vendor-name and --vendor-patch-revision BUG: https://bugzilla.samba.org/show_bug.cgi?id=15654 Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall RN: We have added new options --vendor-name and --vendor-patch-revision arguments to ./configure to allow distributions and packagers to put their name in the Samba version string so that when debugging Samba the source of the binary is obvious. [abartlet@samba.org adapted to 4.20 still having the seperate LDB build system from commit 72112d4814eb3872016c1168c477531be835a1f9] --- script/autobuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/autobuild.py b/script/autobuild.py index 85043032d73..7777c35cf12 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -888,9 +888,10 @@ tasks = { ("ldb-make", "cd lib/ldb && make"), ("ldb-install", "cd lib/ldb && make install"), - ("nondevel-configure", samba_libs_envvars + " ./configure ${PREFIX}"), + ("nondevel-configure", samba_libs_envvars + " ./configure --vendor-name=autobuild-TEST-STRING --vendor-patch-revision=5 ${PREFIX}"), ("nondevel-make", "make -j"), ("nondevel-check", "./bin/smbd -b | grep WITH_NTVFS_FILESERVER && exit 1; exit 0"), + ("nondevel-check", "./bin/smbd --version | grep -e '-autobuild-TEST-STRING-5' && exit 0; exit 1"), ("nondevel-no-libtalloc", "find ./bin | grep -v 'libtalloc-report' | grep 'libtalloc' && exit 1; exit 0"), ("nondevel-no-libtdb", "find ./bin | grep -v 'libtdb-wrap' | grep 'libtdb' && exit 1; exit 0"), ("nondevel-no-libtevent", "find ./bin | grep -v 'libtevent-util' | grep 'libtevent' && exit 1; exit 0"), -- 2.25.1