Add --with-version-suffix as a configure option for downstream
CentOS/RHEL compatibility. Because their packages are built from stable
branches rather than exact release tags, this allows the exact commits
included in a build to be accurately reflected in the version string.

Now when checking the version of OVN components, this suffix will
be present.

This commit mirrors the same option which was recently added to OVS.

An example of how to use this when configuring is:
./configure --with-version-suffix=-33.el9

Reported-at: https://issues.redhat.com/browse/FDP-1904
Signed-off-by: Rosemarie O'Riorden <[email protected]>
---
 Makefile.am                 |  3 ++-
 acinclude.m4                | 11 +++++++++++
 configure.ac                |  1 +
 include/ovn/version.h.in    |  2 +-
 rhel/ovn-fedora.spec.in     |  1 +
 utilities/ovn-lib.in        |  2 +-
 utilities/ovn_detrace.py.in |  2 +-
 7 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 50c0fbcd2..4d62da3c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,7 @@ AM_CFLAGS = -Wstrict-prototypes
 AM_CFLAGS += $(WARNING_FLAGS)
 AM_CFLAGS += $(OVS_CFLAGS)
 
-AM_DISTCHECK_CONFIGURE_FLAGS = --with-ovs-source=$(PWD)/ovs
+AM_DISTCHECK_CONFIGURE_FLAGS = --with-ovs-source=$(PWD)/ovs 
--with-version-suffix="$(VERSION_SUFFIX)"
 
 if NDEBUG
 AM_CPPFLAGS += -DNDEBUG
@@ -186,6 +186,7 @@ SUFFIXES += .in
            -e 's,[@]OVN_RUNDIR[@],$(OVN_RUNDIR),g' \
            -e 's,[@]OVSBUILDDIR[@],$(OVSBUILDDIR),g' \
            -e 's,[@]VERSION[@],$(VERSION),g' \
+           -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \
            -e 's,[@]OVSVERSION[@],$(OVSVERSION),g' \
            -e 's,[@]localstatedir[@],$(localstatedir),g' \
            -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
diff --git a/acinclude.m4 b/acinclude.m4
index 73a2a51be..82070dc52 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -388,3 +388,14 @@ AC_DEFUN([OVN_ENABLE_VIF_PLUG], [
                 [Build built-in VIF plug providers])
     fi
 ])
+
+dnl Append a version suffix.
+AC_DEFUN([OVN_CHECK_VERSION_SUFFIX], [
+  AC_ARG_WITH([version-suffix],
+              [AS_HELP_STRING([--with-version-suffix=ver_suffix],
+                              [Specify a string that will be appended
+                               to OVN version])])
+  AC_DEFINE_UNQUOTED([VERSION_SUFFIX], ["$with_version_suffix"],
+                     [Package version suffix])
+  AC_SUBST([VERSION_SUFFIX], [$with_version_suffix])
+])
diff --git a/configure.ac b/configure.ac
index 0898b5123..657769609 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,7 @@ OVS_ENABLE_WERROR
 OVS_ENABLE_SPARSE
 
 OVS_CHECK_PRAGMA_MESSAGE
+OVN_CHECK_VERSION_SUFFIX
 OVN_CHECK_OVS
 OVN_CHECK_VIF_PLUG_PROVIDER
 OVN_ENABLE_VIF_PLUG
diff --git a/include/ovn/version.h.in b/include/ovn/version.h.in
index e27415ba1..5f88931b7 100644
--- a/include/ovn/version.h.in
+++ b/include/ovn/version.h.in
@@ -19,7 +19,7 @@
 #define OVN_VERSION_H 1
 
 #define OVN_PACKAGE_STRING  "@PACKAGE_STRING@"
-#define OVN_PACKAGE_VERSION "@PACKAGE_VERSION@"
+#define OVN_PACKAGE_VERSION "@PACKAGE_VERSION@@VERSION_SUFFIX@"
 
 #define OVN_LIB_VERSION     @LT_CURRENT@
 #define OVN_LIB_REVISION    @LT_REVISION@
diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
index a1ab46ebe..1e15b468d 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -161,6 +161,7 @@ cd -
 %endif
         --enable-ssl \
         --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
+        --with-version-suffix=-%{release} \
         PYTHON3=%{__python3}
 
 make %{?_smp_mflags}
diff --git a/utilities/ovn-lib.in b/utilities/ovn-lib.in
index 151af6885..5a0766816 100644
--- a/utilities/ovn-lib.in
+++ b/utilities/ovn-lib.in
@@ -39,7 +39,7 @@ else
     ovn_dbdir='@DBDIR@'
 fi
 
-VERSION='@VERSION@'
+VERSION='@VERSION@@VERSION_SUFFIX@'
 
 DAEMON_CWD=/
 
diff --git a/utilities/ovn_detrace.py.in b/utilities/ovn_detrace.py.in
index 0c8b9dc72..77934da2f 100755
--- a/utilities/ovn_detrace.py.in
+++ b/utilities/ovn_detrace.py.in
@@ -36,7 +36,7 @@ except Exception:
 
 
 argv0 = sys.argv[0]
-version = "@VERSION@"
+version = "@VERSION@@VERSION_SUFFIX@"
 DB_CONNECTION_ERR = ('The connection to {0} DB is not available,'
                      ' {0} information will be missing from the detrace.')
 
-- 
2.52.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to