[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION)



Running $(MAKE) like that in a $(shell ) while parsing the Makefile
doesn't work reliably. In some case, make will complain with
"jobserver unavailable: using -j1.  Add '+' to parent make rule.",
which will be part of "$(make xenversion)" output.

It isn't possible to distinguish between the output produced by
the target "xenversion" and `make`'s own output.

Instead of running make, this patch "improve" `version.sh` to try to
guess the output of `make xenversion`. This only works as long as
$(XEN_VENDORVERSION) isn't set, or $(XEN_EXTRAVERSION) isn't
overridden.

This fix GitLab CI's build job "debian-unstable-gcc-arm64" on which
$(shell $(MAKE) xenversion) in "flask/policy/Makefile.common" reliably
produce more output than just the xenversion.

This patch also allows to run for example `make --debug=a` without
breaking the build when flask policy is enabled.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/flask/policy/Makefile.common |  2 +-
 version.sh                         | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/tools/flask/policy/Makefile.common 
b/tools/flask/policy/Makefile.common
index bea5ba4b6a40..7f470cd02861 100644
--- a/tools/flask/policy/Makefile.common
+++ b/tools/flask/policy/Makefile.common
@@ -35,7 +35,7 @@ OUTPUT_POLICY ?= $(BEST_POLICY_VER)
 #
 ########################################
 
-POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C 
$(XEN_ROOT)/xen xenversion --no-print-directory)
+POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(XEN_ROOT)/version.sh 
--full $(XEN_ROOT)/xen/Makefile)
 POLICY_LOADPATH = /boot
 
 # List of policy versions supported by the hypervisor
diff --git a/version.sh b/version.sh
index e894ee7e0469..abd19ce79ac8 100755
--- a/version.sh
+++ b/version.sh
@@ -1,5 +1,18 @@
 #!/bin/sh
 
+opt_full=false
+while [ $# -gt 1 ]; do
+    case "$1" in
+        --full) opt_full=true ;;
+        *) break ;;
+    esac
+    shift
+done
+
 MAJOR=`grep "export XEN_VERSION" $1 | sed 's/.*=//g' | tr -s " "`
 MINOR=`grep "export XEN_SUBVERSION" $1 | sed 's/.*=//g' | tr -s " "`
-printf "%d.%d" $MAJOR $MINOR
+
+if $opt_full; then
+    EXTRAVERSION=$(grep "export XEN_EXTRAVERSION" $1 | sed 's/^.* ?=\s\+//; 
s/\$([^)]*)//g; s/ //g')
+fi
+printf "%d.%d%s" $MAJOR $MINOR $EXTRAVERSION
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.