common: Simplify REPO_VERSION_CMD in Make.rules

bzr version-info supports directly printing the bare revno to stdout so
we should use that instead of parsing the default verbose output.

This change simplifies the shell snippet used to assign the
REPO_VERSION_CMD make variable. It was also tested to work with the bzr
present in Ubuntu 12.04.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Tyler Hicks 2016-01-27 15:46:40 -06:00
parent 5e0eb13842
commit 8516aa9b5a

View file

@ -45,7 +45,7 @@ define nl
endef
REPO_VERSION_CMD=([ -x /usr/bin/bzr ] && /usr/bin/bzr version-info . 2> /dev/null || awk '{ print "revno: "$2 }' common/.stamp_rev) | awk '/^revno:/ { print $2 }'
REPO_VERSION_CMD=[ -x /usr/bin/bzr ] && /usr/bin/bzr version-info --custom --template="{revno}" . 2> /dev/null || awk '{ print $2 }' common/.stamp_rev
ifndef PYTHON_VERSIONS
PYTHON_VERSIONS = $(call map, pathsearch, python2 python3)
@ -66,7 +66,7 @@ version:
.PHONY: repo_version
.SILENT: repo_version
repo_version:
$(value REPO_VERSION_CMD)
echo $(shell $(value REPO_VERSION_CMD))
.PHONY: pod_clean
ifndef VERBOSE