On 5/26/23 16:41, Timothy Redaelli wrote: > 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, on ovs-vsctl show and the other > utilities. > > --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 <[email protected]> > --- > Makefile.am | 1 + > 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 + > utilities/ovs-dpctl-top.in | 2 +- > utilities/ovs-lib.in | 2 +- > utilities/ovs-parse-backtrace.in | 2 +- > utilities/ovs-pcap.in | 2 +- > utilities/ovs-pki.in | 2 +- > utilities/ovs-tcpdump.in | 4 ++-- > utilities/ovs-tcpundump.in | 2 +- > utilities/ovs-vlan-test.in | 2 +- > vswitchd/bridge.c | 3 ++- > 18 files changed, 35 insertions(+), 16 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index e605187b8..2f4ce9f94 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -157,6 +157,7 @@ SUFFIXES += .in > -e 's,[@]PYTHON3[@],$(PYTHON3),g' \ > -e 's,[@]RUNDIR[@],$(RUNDIR),g' \ > -e 's,[@]VERSION[@],$(VERSION),g' \ > + -e 's,[@]VERSION_SUFFIX[@],$(VERSION_SUFFIX),g' \ > -e 's,[@]localstatedir[@],$(localstatedir),g' \ > -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \ > -e 's,[@]sysconfdir[@],$(sysconfdir),g' \ > diff --git a/acinclude.m4 b/acinclude.m4 > index ac1eab790..a02f5bb00 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -470,6 +470,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 d05e544b5..3df7156da 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 96a71550d..f9e9c5b4c 100644 > --- a/lib/util.c > +++ b/lib/util.c > @@ -617,8 +617,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 33ca4910d..d3e20af5d 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
Ugh. I'm not sure how to deal with that, but with this change, for example, in Fedora the ovs python package version will become '3.1.90-1.fc38' and that is not a correct format for PEP440. IIUC, that may cause import problems. I guess, one way to avoid that is to define a separate VERSION_SUFFIX variable in the ovs/version.py and use it in version print-outs like C applications do, but keep using a pure VERSION in setup.py, for example. What do you think? Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
