diff options
27 files changed, 87 insertions, 59 deletions
diff --git a/configure.ac b/configure.ac index c7ad92d8c9..f25058c8ca 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,7 @@ else AC_MSG_RESULT("tarball") fi -# Export KEA_SRCID to config.h +# Export KEA_SRCID to a C++ header. # This will be either package version or "tarball" or "git abcd". # We do not want to put this in a config.h, because it messes up ccache # horribly. When building different branches, the commit-id is different @@ -1823,16 +1823,13 @@ AC_CONFIG_FILES([tools/path_replacer.sh], AC_CONFIG_FILES([tools/extract_bnf.sh], [chmod +x tools/extract_bnf.sh]) - -AC_OUTPUT - -dnl Print the results -dnl - EXTENDED_VERSION=${PACKAGE_VERSION} if test "$KEA_SRCID" != ""; then EXTENDED_VERSION="${EXTENDED_VERSION} ($KEA_SRCID)" fi +AC_SUBST(EXTENDED_VERSION) + +AC_OUTPUT # By default the following variables are defined: # - prefix = /usr/local @@ -1850,6 +1847,7 @@ fi libdir_real="$(eval echo ${libdir})" libdir_real="$(eval echo ${libdir_real})" +# Print the report. cat > config.report << END Kea source configure results: diff --git a/doc/sphinx/arm/ddns.rst b/doc/sphinx/arm/ddns.rst index bab8c96a65..df9a4ec7a1 100644 --- a/doc/sphinx/arm/ddns.rst +++ b/doc/sphinx/arm/ddns.rst @@ -133,6 +133,8 @@ directly. It accepts the following command-line switches: - ``-v`` - displays the Kea version and exits. +- ``-V`` - displays the extended Kea version and exits. + - ``-W`` - displays the Kea configuration report and exits. The report is a copy of the ``config.report`` file produced by ``./configure``; it is embedded in the executable binary. diff --git a/doc/sphinx/arm/shell.rst b/doc/sphinx/arm/shell.rst index 62a9900c69..377145a3ce 100644 --- a/doc/sphinx/arm/shell.rst +++ b/doc/sphinx/arm/shell.rst @@ -66,7 +66,9 @@ Other switches are: - ``-h`` - prints a help message. -- ``-v`` - prints the software version. +- ``-v`` - displays the Kea version. + +- ``-V`` - displays the extended Kea version. See :ref:`shell-tls` for new command-line arguments associated with TLS/HTTPS support. diff --git a/doc/sphinx/man/kea-admin.8.rst b/doc/sphinx/man/kea-admin.8.rst index 05f5d16db3..ee628bb6d3 100644 --- a/doc/sphinx/man/kea-admin.8.rst +++ b/doc/sphinx/man/kea-admin.8.rst @@ -111,7 +111,10 @@ Arguments ``lease-dump``. ``-v|--version`` - Prints the ``kea-admin`` version and quits. + Displays the Kea version. + +``-V`` + Displays the extended Kea version. ``-4`` Directs ``kea-admin`` to lease-dump the DHCPv4 leases. Incompatible with diff --git a/doc/sphinx/man/kea-ctrl-agent.8.rst b/doc/sphinx/man/kea-ctrl-agent.8.rst index 815c0e3b90..03aeccd44e 100644 --- a/doc/sphinx/man/kea-ctrl-agent.8.rst +++ b/doc/sphinx/man/kea-ctrl-agent.8.rst @@ -34,10 +34,10 @@ Arguments The arguments are as follows: ``-v`` - Displays the version. + Displays the Kea version. ``-V`` - Displays the extended version. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-dhcp-ddns.8.rst b/doc/sphinx/man/kea-dhcp-ddns.8.rst index ecaf3fde01..eba83ac439 100644 --- a/doc/sphinx/man/kea-dhcp-ddns.8.rst +++ b/doc/sphinx/man/kea-dhcp-ddns.8.rst @@ -31,10 +31,10 @@ Arguments The arguments are as follows: ``-v`` - Displays the version. + Displays the Kea version. ``-V`` - Displays the extended version. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-dhcp4.8.rst b/doc/sphinx/man/kea-dhcp4.8.rst index 6bc42f46ea..eec7dcba44 100644 --- a/doc/sphinx/man/kea-dhcp4.8.rst +++ b/doc/sphinx/man/kea-dhcp4.8.rst @@ -29,10 +29,10 @@ Arguments The arguments are as follows: ``-v`` - Displays the version. + Displays the Kea version. ``-V`` - Displays the extended version. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-dhcp6.8.rst b/doc/sphinx/man/kea-dhcp6.8.rst index d18e7b6b13..d42f3e1fde 100644 --- a/doc/sphinx/man/kea-dhcp6.8.rst +++ b/doc/sphinx/man/kea-dhcp6.8.rst @@ -29,10 +29,10 @@ Arguments The arguments are as follows: ``-v`` - Displays the version. + Displays the Kea version. ``-V`` - Displays the extended version. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-lfc.8.rst b/doc/sphinx/man/kea-lfc.8.rst index d00e97d40a..16d36e3ed4 100644 --- a/doc/sphinx/man/kea-lfc.8.rst +++ b/doc/sphinx/man/kea-lfc.8.rst @@ -73,10 +73,10 @@ The arguments are as follows: if one of the processes was interrupted before completing its task. ``-v`` - Causes the version stamp to be printed. + Displays the Kea version. ``-V`` - Causes a longer form of the version stamp to be printed. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-netconf.8.rst b/doc/sphinx/man/kea-netconf.8.rst index d9cf92e9dc..30adfbe3f8 100644 --- a/doc/sphinx/man/kea-netconf.8.rst +++ b/doc/sphinx/man/kea-netconf.8.rst @@ -30,10 +30,10 @@ Arguments The arguments are as follows: ``-v`` - Displays the version. + Displays the Kea version. ``-V`` - Displays the extended version. + Displays the extended Kea version. ``-W`` Displays the configuration report. diff --git a/doc/sphinx/man/kea-shell.8.rst b/doc/sphinx/man/kea-shell.8.rst index d46af789a3..b591a062a9 100644 --- a/doc/sphinx/man/kea-shell.8.rst +++ b/doc/sphinx/man/kea-shell.8.rst @@ -38,7 +38,7 @@ The arguments are as follows: Displays help regarding command-line parameters. ``-v`` - Displays the version. + Displays the Kea version. ``--host`` Specifies the host to connect to. The Control Agent must be running at the diff --git a/doc/sphinx/man/keactrl.8.rst b/doc/sphinx/man/keactrl.8.rst index ca188e631a..5b5e432022 100644 --- a/doc/sphinx/man/keactrl.8.rst +++ b/doc/sphinx/man/keactrl.8.rst @@ -87,7 +87,10 @@ Options built. This is the default. ``-v|--version`` - Prints the ``keactrl`` version and quits. + Displays the Kea version. + +``-V`` + Displays the extended Kea version. Documentation ~~~~~~~~~~~~~ diff --git a/doc/sphinx/man/perfdhcp.8.rst b/doc/sphinx/man/perfdhcp.8.rst index 465d6f051f..74d0c11e97 100644 --- a/doc/sphinx/man/perfdhcp.8.rst +++ b/doc/sphinx/man/perfdhcp.8.rst @@ -287,7 +287,10 @@ Options releasing it. ``-v`` - Prints the version of this program. + Displays the Kea version. + +``-V`` + Displays the extended Kea version. ``-W exit-wait-time`` Specifies the exit-wait-time parameter, which causes ``perfdhcp`` to wait for diff --git a/src/bin/admin/kea-admin.in b/src/bin/admin/kea-admin.in index 12bcd5a39a..283e446c47 100644 --- a/src/bin/admin/kea-admin.in +++ b/src/bin/admin/kea-admin.in @@ -32,7 +32,8 @@ exec_prefix="@exec_prefix@" export exec_prefix BASENAME=$(basename ${0}) SCRIPTS_DIR_DEFAULT="@datarootdir@/@PACKAGE@/scripts" -VERSION="@PACKAGE_VERSION@" +PACKAGE_VERSION="@PACKAGE_VERSION@" +EXTENDED_VERSION="@EXTENDED_VERSION@" assume_yes=0 @@ -99,7 +100,7 @@ PARAMETERS: Parameters are optional in general, but may be required -i or --input to specify the name of file from which leases will be uploaded -o or --output to specify the name of file to which leases will be dumped -y or --yes - assume yes on overwriting temporary files -' "${BASENAME}" "${VERSION}" "${BASENAME}" "${SCRIPTS_DIR_DEFAULT}" +' "${BASENAME}" "${PACKAGE_VERSION}" "${BASENAME}" "${SCRIPTS_DIR_DEFAULT}" } ### Logging functions ### @@ -819,8 +820,13 @@ if test "${command}" = "--help" ; then fi # Check if this is a simple question about version. -if test "${command}" = "-v" || test "${command}" = "--version" ; then - echo "${VERSION}" +if test "${command}" = "-v" || test "${command}" = "--version"; then + echo "${PACKAGE_VERSION}" + exit 0 +fi + +if test "${command}" = "-V"; then + echo "${EXTENDED_VERSION}" exit 0 fi diff --git a/src/bin/d2/d2_controller.cc b/src/bin/d2/d2_controller.cc index 0d0d816791..448a6ddb20 100644 --- a/src/bin/d2/d2_controller.cc +++ b/src/bin/d2/d2_controller.cc @@ -144,14 +144,5 @@ D2Controller::parseFile(const std::string& file_name) { D2Controller::~D2Controller() { } -std::string -D2Controller::getVersionAddendum() { - std::stringstream stream; - // Currently the only dependency D2 adds to base is cryptolink - stream << isc::cryptolink::CryptoLink::getVersion() << std::endl; - return (stream.str()); - -} - } // end namespace isc::d2 } // end namespace isc diff --git a/src/bin/d2/d2_controller.h b/src/bin/d2/d2_controller.h index 6f61735828..ffd1210e30 100644 --- a/src/bin/d2/d2_controller.h +++ b/src/bin/d2/d2_controller.h @@ -53,10 +53,6 @@ public: /// @note Does not throw. void deregisterCommands(); -protected: - /// @brief Returns version info specific to D2 - virtual std::string getVersionAddendum(); - private: /// @brief Creates an instance of the DHCP-DDNS specific application /// process. This method is invoked during the process initialization diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index f504f4cbfc..1a63a305b5 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -4832,7 +4832,7 @@ Dhcpv4Srv::getVersion(bool extended) { tmp << VERSION; if (extended) { - tmp << endl << EXTENDED_VERSION << endl; + tmp << " (" << EXTENDED_VERSION << ")" << endl; tmp << "premium: " << PREMIUM_EXTENDED_VERSION << endl; tmp << "linked with:" << endl; tmp << "- " << Logger::getVersion() << endl; diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index bef647b151..fe8e34e63a 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -4653,7 +4653,7 @@ Dhcpv6Srv::getVersion(bool extended) { tmp << VERSION; if (extended) { - tmp << endl << EXTENDED_VERSION << endl; + tmp << " (" << EXTENDED_VERSION << ")" << endl; tmp << "premium: " << PREMIUM_EXTENDED_VERSION << endl; tmp << "linked with:" << endl; tmp << "- " << Logger::getVersion() << endl; diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in index 22a3f9af4a..cccfdac303 100644 --- a/src/bin/keactrl/keactrl.in +++ b/src/bin/keactrl/keactrl.in @@ -21,7 +21,8 @@ # used. set -eu -VERSION="@PACKAGE_VERSION@" +PACKAGE_VERSION="@PACKAGE_VERSION@" +EXTENDED_VERSION="@EXTENDED_VERSION@" # Set the have_netconf flag to know if netconf is available. if test '@HAVE_NETCONF@' = 'yes'; then @@ -338,8 +339,13 @@ if [ -z "${command}" ]; then fi # Check if this is a simple question about version. -if test "${command}" = "-v" || test "${command}" = "--version" ; then - echo "${VERSION}" +if test "${command}" = "-v" || test "${command}" = "--version"; then + echo "${PACKAGE_VERSION}" + exit 0 +fi + +if test "${command}" = "-V"; then + echo "${EXTENDED_VERSION}" exit 0 fi @@ -576,7 +582,7 @@ ${args}" 1 exit 0 ;; version) - echo "keactrl: ${VERSION}" + echo "keactrl: ${PACKAGE_VERSION}" run_conditional "dhcp4" "print_version kea-dhcp4 ${dhcp4_srv}" 0 run_conditional "dhcp6" "print_version kea-dhcp6 ${dhcp6_srv}" 0 run_conditional "dhcp_ddns" "print_version kea-dhcp-ddns ${dhcp_ddns_srv}" 0 diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc index d73e8baec4..4aa06514b5 100644 --- a/src/bin/lfc/lfc_controller.cc +++ b/src/bin/lfc/lfc_controller.cc @@ -329,7 +329,7 @@ LFCController::getVersion(const bool extended) const{ db_version = Memfile_LeaseMgr::getDBVersion(Memfile_LeaseMgr::V6); } - version_stream << std::endl << EXTENDED_VERSION; + version_stream << " (" << EXTENDED_VERSION << ")"; if (!db_version.empty()) { db_version = "backend: " + db_version; version_stream << std::endl << db_version; diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc index 068065156b..85d58a2d1b 100644 --- a/src/bin/perfdhcp/command_options.cc +++ b/src/bin/perfdhcp/command_options.cc @@ -5,6 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include <config.h> +#include <kea_version.h> #include <perfdhcp/command_options.h> @@ -207,7 +208,7 @@ CommandOptions::parse(int argc, char** const argv, bool print_cmd_line) { // Reset values of class members reset(); - // Informs if program has been run with 'h' or 'v' option. + // Informs if program has been run with 'h', 'v' or 'V' option. bool help_or_version_mode = initialize(argc, argv, print_cmd_line); if (!help_or_version_mode) { validate(); @@ -245,7 +246,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { // In this section we collect argument values from command line // they will be tuned and validated elsewhere while((opt = getopt_long(argc, argv, - "huv46A:r:t:R:b:n:p:d:D:l:P:a:L:N:M:s:iBc1" + "huvV46A:r:t:R:b:n:p:d:D:l:P:a:L:N:M:s:iBc1" "J:T:X:O:o:E:S:I:x:W:w:e:f:F:g:C:y:Y:", long_options, &opt_long_index)) != -1) { stream << " -"; @@ -562,6 +563,10 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { version(); return (true); + case 'V': + extendedVersion(); + return (true); + case 'w': wrapped_ = nonEmptyString("command for wrapped mode:" " -w<command> must be specified"); @@ -1365,7 +1370,8 @@ Options: -u: Enable checking address uniqueness. Lease valid lifetime should not be shorter than test duration and clients should not request address more than once without releasing it first. --v: Report the version number of this program. +-v: Display the Kea version. +-V: Display the extended Kea version. -W<time>: Specifies exit-wait-time parameter, that makes perfdhcp wait for <time> us after an exit condition has been met to receive all packets without sending any new packets. Expressed in microseconds. @@ -1442,7 +1448,12 @@ The exit status is: void CommandOptions::version() const { - std::cout << "VERSION: " << VERSION << std::endl; + std::cout << VERSION << std::endl; +} + +void +CommandOptions::extendedVersion() const { + cout << VERSION << " (" << EXTENDED_VERSION << ")" << endl; } diff --git a/src/bin/perfdhcp/command_options.h b/src/bin/perfdhcp/command_options.h index d47f6a1d96..f9840b12ba 100644 --- a/src/bin/perfdhcp/command_options.h +++ b/src/bin/perfdhcp/command_options.h @@ -445,10 +445,11 @@ public: static void usage(); /// \brief Print program version. - /// - /// Prints perfdhcp version. void version() const; + /// @brief Print extended program version. + void extendedVersion() const; + private: /// \brief Initializes class members based on the command line. /// diff --git a/src/bin/shell/kea-shell.in b/src/bin/shell/kea-shell.in index 30988619d7..f4e8292423 100644 --- a/src/bin/shell/kea-shell.in +++ b/src/bin/shell/kea-shell.in @@ -29,6 +29,7 @@ from kea_conn import CARequest # CAResponse VERSION = "@PACKAGE_VERSION@" +EXTENDED_VERSION = "@EXTENDED_VERSION@" def timeout_handler(signum, frame): @@ -81,12 +82,17 @@ def shell_body(): help='command to be executed. If not specified, ' '"list-commands" is used') parser.add_argument('-v', action="store_true", help="Prints version") + parser.add_argument('-V', action="store_true", help="Prints extended version") cmd_args = parser.parse_args() if cmd_args.v: print(VERSION) sys.exit(0) + if cmd_args.V: + print(EXTENDED_VERSION) + sys.exit(0) + # Ok, now it's time to put the parameters parsed into the structure to be # used by the connection. params = CARequest() diff --git a/src/lib/process/cfgrpt/tests/config_report_unittests.cc b/src/lib/process/cfgrpt/tests/config_report_unittests.cc index b5e8f5b0e8..d6b4b2d03f 100644 --- a/src/lib/process/cfgrpt/tests/config_report_unittests.cc +++ b/src/lib/process/cfgrpt/tests/config_report_unittests.cc @@ -23,5 +23,6 @@ TEST(ConfigReportTest, getConfigReport) { // Verify that it is not empty and does contain the // extended version number ASSERT_FALSE(cfgReport.empty()); - EXPECT_NE(std::string::npos, cfgReport.find(EXTENDED_VERSION, 0)); + EXPECT_NE(std::string::npos, cfgReport.find(VERSION)); + EXPECT_NE(std::string::npos, cfgReport.find(EXTENDED_VERSION)); } diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index 0bfc353f9d..b5f7e14184 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -863,11 +863,11 @@ DControllerBase::getVersion(bool extended) { tmp << VERSION; if (extended) { - tmp << std::endl << EXTENDED_VERSION << std::endl; + tmp << " (" << EXTENDED_VERSION << ")" << std::endl; tmp << "premium: " << PREMIUM_EXTENDED_VERSION << std::endl; tmp << "linked with:" << std::endl; tmp << "- " << isc::log::Logger::getVersion() << std::endl; - tmp << getVersionAddendum(); + tmp << "- " << isc::cryptolink::CryptoLink::getVersion(); } return (tmp.str()); diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h index 0bbefda958..91b777b786 100644 --- a/src/lib/process/d_controller.h +++ b/src/lib/process/d_controller.h @@ -608,7 +608,7 @@ protected: /// version text returned when DControllerBase::getVersion(true) is /// invoked. /// @return a string containing additional version info - virtual std::string getVersionAddendum() { return (""); } + virtual std::string getVersionAddendum() { return (std::string()); } /// @brief Deals with other (i.e. not application name) global objects. /// diff --git a/src/lib/process/tests/d_controller_unittests.cc b/src/lib/process/tests/d_controller_unittests.cc index e52cbab9db..31989de9e5 100644 --- a/src/lib/process/tests/d_controller_unittests.cc +++ b/src/lib/process/tests/d_controller_unittests.cc @@ -446,7 +446,6 @@ TEST_F(DStubControllerTest, getVersion) { text = controller_->getVersion(true); EXPECT_NE(std::string::npos, text.find(VERSION)); EXPECT_NE(std::string::npos, text.find(EXTENDED_VERSION)); - EXPECT_NE(std::string::npos, text.find(controller_->getVersionAddendum())); } // Tests that the SIGTERM triggers a normal shutdown. |