From c9a2d670ebf21d28940ecb1f56b8afde665b4495 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 7 Mar 2012 15:48:32 -0800 Subject: [PATCH] python: Make build number format consistent with C. The C code displays the build number as the empty string when 0, and as +build otherwise. This commit updates version.py to be consistent and tests that it is in the unit tests. Signed-off-by: Ethan Jackson --- python/automake.mk | 5 ++++- python/ovs/unixctl.py | 6 +++--- tests/atlocal.in | 2 -- tests/unixctl-py.at | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/python/automake.mk b/python/automake.mk index f9d2c575..96720421 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -64,5 +64,8 @@ ALL_LOCAL += $(srcdir)/python/ovs/version.py $(srcdir)/python/ovs/version.py: config.status $(ro_shell) > $@.tmp echo 'VERSION = "$(VERSION)"' >> $@.tmp - echo 'BUILDNR = "$(BUILDNR)"' >> $@.tmp + if [ "$(BUILDNR)" != "0" ]; \ + then echo 'BUILDNR = "+build$(BUILDNR)"' >> $@.tmp; \ + else echo 'BUILDNR = ""' >> $@.tmp; \ + fi; mv $@.tmp $@ diff --git a/python/ovs/unixctl.py b/python/ovs/unixctl.py index 8921ba8c..4a591a7e 100644 --- a/python/ovs/unixctl.py +++ b/python/ovs/unixctl.py @@ -57,9 +57,9 @@ def _unixctl_help(conn, unused_argv, unused_aux): def _unixctl_version(conn, unused_argv, unused_aux): assert isinstance(conn, UnixctlConnection) - version = "%s (Open vSwitch) %s %s" % (ovs.util.PROGRAM_NAME, - ovs.version.VERSION, - ovs.version.BUILDNR) + version = "%s (Open vSwitch) %s%s" % (ovs.util.PROGRAM_NAME, + ovs.version.VERSION, + ovs.version.BUILDNR) conn.reply(version) diff --git a/tests/atlocal.in b/tests/atlocal.in index 400a5c58..1d37b59a 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -1,6 +1,4 @@ # -*- shell-script -*- -VERSION='@VERSION@' -BUILDNR='@BUILDNR@' HAVE_OPENSSL='@HAVE_OPENSSL@' HAVE_PYTHON='@HAVE_PYTHON@' PERL='@PERL@' diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at index 8317add8..52fb72a9 100644 --- a/tests/unixctl-py.at +++ b/tests/unixctl-py.at @@ -109,7 +109,7 @@ The available commands are: mv stdout expout AT_CHECK([PYAPPCTL -t test-unixctl.py help], [0], [expout]) -AT_CHECK([echo "test-unixctl.py (Open vSwitch) $VERSION $BUILDNR" > expout]) +AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout]) AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout]) AT_CHECK([PYAPPCTL -t test-unixctl.py version], [0], [expout]) -- 2.30.2