diff mbox series

[ovs-dev,v2] rhel: make the version, displayed to the user, customizable

Message ID f5ab5f00f8bdcb9ec4bf5715861774519920a544.1668006310.git.tredaelli@redhat.com
State Changes Requested
Headers show
Series [ovs-dev,v2] rhel: make the version, displayed to the user, customizable | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation fail test: fail

Commit Message

Timothy Redaelli Nov. 9, 2022, 3:05 p.m. UTC
Since on CentOS/RHEL the builds are based on stable branches and not on
tags for debugging purpose it's better to have the downstream version as
version so it's easier to know which commits are included in a build.

This commit adds --with-version-suffix as ./configure option in
order to set an OVS version suffix that should be shown to the user via
ovs-vsctl -V and, so, also on database and on ovs-vsctl show.

--with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
the version be aligned with the downstream one.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 acinclude.m4                     | 13 +++++++++++++
 configure.ac                     |  1 +
 include/openvswitch/version.h.in |  2 +-
 lib/ovsdb-error.c                |  2 +-
 lib/util.c                       |  5 +++--
 ovsdb/ovsdb-server.c             |  3 ++-
 python/automake.mk               |  2 +-
 rhel/openvswitch-fedora.spec.in  |  1 +
 vswitchd/bridge.c                |  3 ++-
 9 files changed, 25 insertions(+), 7 deletions(-)

Comments

Aaron Conole Dec. 1, 2022, 6:17 p.m. UTC | #1
Timothy Redaelli <tredaelli@redhat.com> writes:

> Since on CentOS/RHEL the builds are based on stable branches and not on
> tags for debugging purpose it's better to have the downstream version as
> version so it's easier to know which commits are included in a build.
>
> This commit adds --with-version-suffix as ./configure option in
> order to set an OVS version suffix that should be shown to the user via
> ovs-vsctl -V and, so, also on database and on ovs-vsctl show.
>
> --with-version-suffix is used in Fedora/CentOS/RHEL spec file in order to have
> the version be aligned with the downstream one.
>
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---

I don't see any changes made to the python utilities side (which was a
concern Ilya expressed).  Do you think we should do this?  It seems like
it should be simple enough:

  -@VERSION@
  +@VERSION@@VERSION_SUFFIX@

WDYT?
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index aa9af5506..09d528675 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -440,6 +440,19 @@  AC_DEFUN([OVS_CHECK_DPDK], [
   AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
 ])
 
+dnl Append a version suffix
+
+AC_DEFUN([OVS_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+              [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+                              [Specify a version suffix that will be appended
+                               to OVS version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+                     [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+  ])
+])
+
 dnl Checks for net/if_dl.h.
 dnl
 dnl (We use this as a proxy for checking whether we're building on FreeBSD
diff --git a/configure.ac b/configure.ac
index adfd9f006..6c977351d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@  OVS_CHECK_LINUX_SCTP_CT
 OVS_CHECK_LINUX_VIRTIO_TYPES
 OVS_CHECK_DPDK
 OVS_CHECK_PRAGMA_MESSAGE
+OVS_CHECK_VERSION_SUFFIX
 AC_SUBST([CFLAGS])
 AC_SUBST([OVS_CFLAGS])
 AC_SUBST([OVS_LDFLAGS])
diff --git a/include/openvswitch/version.h.in b/include/openvswitch/version.h.in
index 23d8fde4f..231f61e30 100644
--- a/include/openvswitch/version.h.in
+++ b/include/openvswitch/version.h.in
@@ -19,7 +19,7 @@ 
 #define OPENVSWITCH_VERSION_H 1
 
 #define OVS_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVS_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVS_LIB_VERSION     @LT_CURRENT@
 #define OVS_LIB_REVISION    @LT_REVISION@
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index a75ad36b7..65bbfe876 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -150,7 +150,7 @@  ovsdb_internal_error(struct ovsdb_error *inner_error,
         ds_put_char(&ds, ')');
     }
 
-    ds_put_format(&ds, " (%s %s)", program_name, VERSION);
+    ds_put_format(&ds, " (%s %s)", program_name, VERSION VERSION_SUFFIX);
 
     if (inner_error) {
         char *s = ovsdb_error_to_string_free(inner_error);
diff --git a/lib/util.c b/lib/util.c
index 1195c7982..be350ab66 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -614,8 +614,9 @@  ovs_set_program_name(const char *argv0, const char *version)
     program_name = basename;
 
     free(program_version);
-    if (!strcmp(version, VERSION)) {
-        program_version = xasprintf("%s (Open vSwitch) "VERSION"\n",
+    if (!strcmp(version, VERSION VERSION_SUFFIX)) {
+        program_version = xasprintf("%s (Open vSwitch) "VERSION
+                                    VERSION_SUFFIX"\n",
                                     program_name);
     } else {
         program_version = xasprintf("%s %s\n"
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 7a6bfe0a0..b43d739e8 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -424,7 +424,8 @@  main(int argc, char *argv[])
         /* ovsdb-server is usually a long-running process, in which case it
          * makes plenty of sense to log the version, but --run makes
          * ovsdb-server more like a command-line tool, so skip it.  */
-        VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
+        VLOG_INFO("%s (Open vSwitch) %s", program_name,
+                  VERSION VERSION_SUFFIX);
     }
 
     unixctl_command_register("exit", "", 0, 0, ovsdb_server_exit, &exiting);
diff --git a/python/automake.mk b/python/automake.mk
index d00911828..81fbc12d2 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -124,7 +124,7 @@  ovs-uninstall-local:
 ALL_LOCAL += $(srcdir)/python/ovs/version.py
 $(srcdir)/python/ovs/version.py: config.status
 	$(AM_V_GEN)$(ro_shell) > $(@F).tmp && \
-	echo 'VERSION = "$(VERSION)"' >> $(@F).tmp && \
+	echo 'VERSION = "$(VERSION)$(VERSION_SUFFIX)"' >> $(@F).tmp && \
 	if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp $@; fi
 
 ALL_LOCAL += $(srcdir)/python/ovs/dirs.py
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 67268cb78..df296ea08 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -176,6 +176,7 @@  This package provides IPsec tunneling support for OVS tunnels.
         --disable-static \
         --enable-shared \
         --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
+        --with-version-suffix=-%{release} \
         PYTHON3=%{__python3}
 
 build-aux/dpdkstrip.py \
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 25ce45e3d..a5409b221 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3321,7 +3321,8 @@  bridge_run(void)
 
             vlog_enable_async();
 
-            VLOG_INFO_ONCE("%s (Open vSwitch) %s", program_name, VERSION);
+            VLOG_INFO_ONCE("%s (Open vSwitch) %s", program_name,
+                           VERSION VERSION_SUFFIX);
         }
     }