* [XEN PATCH 0/2] build: attempt to "fix" GitLab CI job "debian-unstable-gcc-arm64"
@ 2021-09-08 9:54 Anthony PERARD
2021-09-08 9:54 ` [XEN PATCH 1/2] build: set policy filename on make command line Anthony PERARD
2021-09-08 9:54 ` [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION) Anthony PERARD
0 siblings, 2 replies; 7+ messages in thread
From: Anthony PERARD @ 2021-09-08 9:54 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Anthony PERARD, Wei Liu,
Julien Grall, Ian Jackson, Stefano Stabellini, Daniel De Graaf,
George Dunlap, Daniel P. Smith
Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.fix-flask-policy.mk-v1
Well, that job fails with weird failure:
make[6]: Entering directory '/builds/xen-project/xen/tools/flask/policy'
make[6]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
/builds/xen-project/xen/tools/flask/policy/Makefile.common:115: *** target pattern contains no '%'. Stop.
make[6]: Leaving directory '/builds/xen-project/xen/tools/flask/policy'
This is because we do $(shell $(MAKE) xenversion) and that sometime produce
more than just "4.16-unstable", which lead to makefile parsing failure.
Maybe `make -j80` is too much.
But you can have the same kind of failure when running `make --debug=a` or
`remake --trace` with flask policy generation enabled.
This patch series fixes build of "xen" (first patch), but only workaround with
a probably not good enough patch for build of the "tools".
Anthony PERARD (2):
build: set policy filename on make command line
build: add --full to version.sh to guess $(XEN_FULLVERSION)
tools/flask/policy/Makefile.common | 2 +-
version.sh | 15 ++++++++++++++-
xen/xsm/flask/Makefile | 2 +-
3 files changed, 16 insertions(+), 3 deletions(-)
--
Anthony PERARD
^ permalink raw reply [flat|nested] 7+ messages in thread
* [XEN PATCH 1/2] build: set policy filename on make command line
2021-09-08 9:54 [XEN PATCH 0/2] build: attempt to "fix" GitLab CI job "debian-unstable-gcc-arm64" Anthony PERARD
@ 2021-09-08 9:54 ` Anthony PERARD
2021-09-08 12:20 ` Jan Beulich
2021-09-08 9:54 ` [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION) Anthony PERARD
1 sibling, 1 reply; 7+ messages in thread
From: Anthony PERARD @ 2021-09-08 9:54 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Anthony PERARD, Daniel De Graaf,
Daniel P. Smith
In order to avoid flask/Makefile.common calling `make xenversion`, we
override POLICY_FILENAME with the value we are going to use anyway.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
xen/xsm/flask/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 637159ad8276..093ee50bf1c8 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -42,7 +42,7 @@ FLASK_BUILD_DIR := $(CURDIR)
POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
policy.bin: FORCE
- $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/tools/flask/policy FLASK_BUILD_DIR=$(FLASK_BUILD_DIR)
+ $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/tools/flask/policy FLASK_BUILD_DIR=$(FLASK_BUILD_DIR) POLICY_FILENAME=$(POLICY_SRC)
cmp -s $(POLICY_SRC) $@ || cp $(POLICY_SRC) $@
.PHONY: clean
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION)
2021-09-08 9:54 [XEN PATCH 0/2] build: attempt to "fix" GitLab CI job "debian-unstable-gcc-arm64" Anthony PERARD
2021-09-08 9:54 ` [XEN PATCH 1/2] build: set policy filename on make command line Anthony PERARD
@ 2021-09-08 9:54 ` Anthony PERARD
2021-09-08 12:27 ` Jan Beulich
1 sibling, 1 reply; 7+ messages in thread
From: Anthony PERARD @ 2021-09-08 9:54 UTC (permalink / raw)
To: xen-devel
Cc: Andrew Cooper, Jan Beulich, Anthony PERARD, Daniel De Graaf,
Daniel P. Smith, Ian Jackson, Wei Liu, George Dunlap,
Julien Grall, Stefano Stabellini
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@citrix.com>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [XEN PATCH 1/2] build: set policy filename on make command line
2021-09-08 9:54 ` [XEN PATCH 1/2] build: set policy filename on make command line Anthony PERARD
@ 2021-09-08 12:20 ` Jan Beulich
0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2021-09-08 12:20 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Andrew Cooper, Daniel De Graaf, Daniel P. Smith, xen-devel
On 08.09.2021 11:54, Anthony PERARD wrote:
> In order to avoid flask/Makefile.common calling `make xenversion`, we
> override POLICY_FILENAME with the value we are going to use anyway.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
> --- a/xen/xsm/flask/Makefile
> +++ b/xen/xsm/flask/Makefile
> @@ -42,7 +42,7 @@ FLASK_BUILD_DIR := $(CURDIR)
> POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
>
> policy.bin: FORCE
> - $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/tools/flask/policy FLASK_BUILD_DIR=$(FLASK_BUILD_DIR)
> + $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/tools/flask/policy FLASK_BUILD_DIR=$(FLASK_BUILD_DIR) POLICY_FILENAME=$(POLICY_SRC)
I expect that you wouldn't mind me wrapping this overly long line
some, while committing?
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION)
2021-09-08 9:54 ` [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION) Anthony PERARD
@ 2021-09-08 12:27 ` Jan Beulich
2021-09-09 11:10 ` Anthony PERARD
0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2021-09-08 12:27 UTC (permalink / raw)
To: Anthony PERARD
Cc: Andrew Cooper, Daniel De Graaf, Daniel P. Smith, Ian Jackson,
Wei Liu, George Dunlap, Julien Grall, Stefano Stabellini,
xen-devel
On 08.09.2021 11:54, Anthony PERARD wrote:
> --- 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)
Shell scripts better get invoked by "$(SHELL) <script>", to avoid
depending on the script actually being marked as executable (which is
impossible on some file systems).
> --- 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
I guess you want to clear EXTRAVERSION either prior to the "if" or
in an "else".
With these addressed:
Acked-by: Jan Beulich <jbeulich@suse.com>
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION)
2021-09-08 12:27 ` Jan Beulich
@ 2021-09-09 11:10 ` Anthony PERARD
2021-09-09 11:43 ` Jan Beulich
0 siblings, 1 reply; 7+ messages in thread
From: Anthony PERARD @ 2021-09-09 11:10 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Daniel De Graaf, Daniel P. Smith, Ian Jackson,
Wei Liu, George Dunlap, Julien Grall, Stefano Stabellini,
xen-devel
On Wed, Sep 08, 2021 at 02:27:17PM +0200, Jan Beulich wrote:
> On 08.09.2021 11:54, Anthony PERARD wrote:
> > --- 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)
>
> Shell scripts better get invoked by "$(SHELL) <script>", to avoid
> depending on the script actually being marked as executable (which is
> impossible on some file systems).
>
> > --- 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
>
> I guess you want to clear EXTRAVERSION either prior to the "if" or
> in an "else".
Actually, I'm thinking of writing this instead:
if $opt_full; then
extraversion=$(grep "export XEN_EXTRAVERSION" $1 | sed 's/^.* ?=\s\+//; s/\$([^)]*)//g; s/ //g')
: ${XEN_EXTRAVERSION:=${extraversion}${XEN_VENDORVERSION}}
else
unset XEN_EXTRAVERSION
fi
This would takes care of cases where a packager add XEN_EXTRAVERSION or
XEN_VENDORVERSION to the environment, and I think would produce the same
result as `make xenversion` in that case.
But that leaves the case of running e.g. "make XEN_VENDORVERSION=-neat
xenversion" out, hopefully, no one does that. Otherwise, we might need
"export" or a new macro in the build system (and that would still leave
out someone having "xen/xen-version" file).
:-( I think I just found a package overriding XEN_VENDORVERSION with a
command line argument, the AUR package. So ./version.sh needs help from
the build system:
Maybe
XEN_FULLVERSION=$(shell env XEN_EXTRAVERSION=$(XEN_EXTRAVERSION) XEN_VENDORVERSION=$(XEN_VENDORVERSION) $(SHELL) $(XEN_ROOT)/version.sh --full $(XEN_ROOT)/xen/Makefile)
or probably just exporting those two var in Config.mk or tools/Rules.mk.
Cheers,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION)
2021-09-09 11:10 ` Anthony PERARD
@ 2021-09-09 11:43 ` Jan Beulich
0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2021-09-09 11:43 UTC (permalink / raw)
To: Anthony PERARD
Cc: Andrew Cooper, Daniel De Graaf, Daniel P. Smith, Ian Jackson,
Wei Liu, George Dunlap, Julien Grall, Stefano Stabellini,
xen-devel
On 09.09.2021 13:10, Anthony PERARD wrote:
> :-( I think I just found a package overriding XEN_VENDORVERSION with a
> command line argument, the AUR package. So ./version.sh needs help from
> the build system:
>
> Maybe
>
> XEN_FULLVERSION=$(shell env XEN_EXTRAVERSION=$(XEN_EXTRAVERSION) XEN_VENDORVERSION=$(XEN_VENDORVERSION) $(SHELL) $(XEN_ROOT)/version.sh --full $(XEN_ROOT)/xen/Makefile)
>
> or probably just exporting those two var in Config.mk or tools/Rules.mk.
Either sounds okay to me, fwiw.
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-09 11:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 9:54 [XEN PATCH 0/2] build: attempt to "fix" GitLab CI job "debian-unstable-gcc-arm64" Anthony PERARD
2021-09-08 9:54 ` [XEN PATCH 1/2] build: set policy filename on make command line Anthony PERARD
2021-09-08 12:20 ` Jan Beulich
2021-09-08 9:54 ` [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION) Anthony PERARD
2021-09-08 12:27 ` Jan Beulich
2021-09-09 11:10 ` Anthony PERARD
2021-09-09 11:43 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.