From f80d385b1c29fbb8230487fb46f63afe7def1e09 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Mon, 10 Nov 2025 16:28:41 +0200 Subject: [PATCH] [#4159] Fix duplicate version --- meson.build | 5 +---- src/bin/admin/kea-admin.in | 2 +- src/bin/admin/meson.build | 5 +---- src/bin/keactrl/keactrl.in | 2 +- src/bin/keactrl/meson.build | 5 +---- src/bin/shell/kea-shell.in | 2 +- src/bin/shell/meson.build | 5 +---- src/lib/log/compiler/message.cc | 14 ++++++++++++-- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/meson.build b/meson.build index 92fce53153..f274985ddc 100644 --- a/meson.build +++ b/meson.build @@ -618,10 +618,7 @@ elif fs.is_dir('.git') else SOURCE_OF_INSTALLATION = 'tarball' endif -conf_data.set( - 'EXTENDED_VERSION', - f'"@PROJECT_VERSION@ (@SOURCE_OF_INSTALLATION@)"', -) +conf_data.set('EXTENDED_VERSION', f'"@SOURCE_OF_INSTALLATION@"') if PROJECT_VERSION.split('.')[1].to_int() % 2 == 0 package_version_type = 'stable' diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in index 76c42ad9f2..2c0616f97f 100755 --- a/src/bin/admin/kea-admin.in +++ b/src/bin/admin/kea-admin.in @@ -848,7 +848,7 @@ if test "${command}" = "-v" || test "${command}" = "--version"; then fi if test "${command}" = "-V"; then - echo "${EXTENDED_VERSION}" + echo "${PACKAGE_VERSION} (${EXTENDED_VERSION})" exit 0 fi diff --git a/src/bin/admin/meson.build b/src/bin/admin/meson.build index e990a48852..23a375afc8 100644 --- a/src/bin/admin/meson.build +++ b/src/bin/admin/meson.build @@ -5,10 +5,7 @@ kea_admin_conf_data.set('datarootdir', f'${prefix}/@DATADIR@') kea_admin_conf_data.set('PACKAGE', 'kea') kea_admin_conf_data.set('PACKAGE_NAME', 'kea') kea_admin_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION) -kea_admin_conf_data.set( - 'EXTENDED_VERSION', - PROJECT_VERSION + f' (@SOURCE_OF_INSTALLATION@)', -) +kea_admin_conf_data.set('EXTENDED_VERSION', SOURCE_OF_INSTALLATION) if TESTS_OPT.enabled() kea_admin_conf_data.set('abs_top_builddir', TOP_BUILD_DIR) else diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in index da108d89fc..d0c0be7311 100755 --- a/src/bin/keactrl/keactrl.in +++ b/src/bin/keactrl/keactrl.in @@ -356,7 +356,7 @@ if test "${command}" = "-v" || test "${command}" = "--version"; then fi if test "${command}" = "-V"; then - echo "${EXTENDED_VERSION}" + echo "${PACKAGE_VERSION} (${EXTENDED_VERSION})" exit 0 fi diff --git a/src/bin/keactrl/meson.build b/src/bin/keactrl/meson.build index 0b5b860844..0159324870 100644 --- a/src/bin/keactrl/meson.build +++ b/src/bin/keactrl/meson.build @@ -9,10 +9,7 @@ if NETCONF_DEP.found() else keactrl_conf_data.set('HAVE_NETCONF', 'no') endif -keactrl_conf_data.set( - 'EXTENDED_VERSION', - PROJECT_VERSION + f' (@SOURCE_OF_INSTALLATION@)', -) +keactrl_conf_data.set('EXTENDED_VERSION', SOURCE_OF_INSTALLATION) keactrl_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION) keactrl_conf_data.set('runstatedir', '${prefix}/' + LOCALSTATEDIR + '/run') keactrl_conf_data.set('localstatedir', '${prefix}/' + LOCALSTATEDIR) diff --git a/src/bin/shell/kea-shell.in b/src/bin/shell/kea-shell.in index 445ed56838..d2ea6ca3e8 100755 --- a/src/bin/shell/kea-shell.in +++ b/src/bin/shell/kea-shell.in @@ -96,7 +96,7 @@ def shell_body(): sys.exit(0) if cmd_args.V: - print(EXTENDED_VERSION) + print(f'{VERSION} ({EXTENDED_VERSION})') sys.exit(0) # Ok, now it's time to put the parameters parsed into the structure to be diff --git a/src/bin/shell/meson.build b/src/bin/shell/meson.build index 273293d850..1a1c38944a 100644 --- a/src/bin/shell/meson.build +++ b/src/bin/shell/meson.build @@ -1,10 +1,7 @@ kea_shell_conf_data = configuration_data() kea_shell_conf_data.set('PYTHON', PYTHON.full_path()) kea_shell_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION) -kea_shell_conf_data.set( - 'EXTENDED_VERSION', - PROJECT_VERSION + f' (@SOURCE_OF_INSTALLATION@)', -) +kea_shell_conf_data.set('EXTENDED_VERSION', SOURCE_OF_INSTALLATION) kea_shell_conf_data.set('PKGPYTHONDIR', PKGPYTHONDIR) configure_file( diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc index 981f7385bb..9b1126d342 100644 --- a/src/lib/log/compiler/message.cc +++ b/src/lib/log/compiler/message.cc @@ -1,10 +1,11 @@ -// Copyright (C) 2011-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #include #include @@ -68,6 +69,11 @@ version() { cout << VERSION << "\n"; } +void +extended_version() { + cout << VERSION << " (" << EXTENDED_VERSION << ")\n"; +} + /// \brief Print Usage /// /// Prints program usage to stdout. @@ -439,7 +445,7 @@ errorDuplicates(MessageReader& reader) { int main(int argc, char* argv[]) { - const char* soptions = "hvpd:"; // Short options + const char* soptions = "hvVpd:"; // Short options optind = 1; // Ensure we start a new scan int opt; // Value of the option @@ -460,6 +466,10 @@ main(int argc, char* argv[]) { version(); return (0); + case 'V': + extended_version(); + return (0); + default: // A message will have already been output about the error. return (1); -- 2.47.3