[libvirt PATCH 0/2] Switch our build repo CI recipes in the ci subdirectory to meson

Erik Skultety (2): ci: Switch to meson build system ci: Drop env variables related to autotools and make ci/Makefile | 29 ++++++----------------------- ci/build.sh | 21 ++++++--------------- 2 files changed, 12 insertions(+), 38 deletions(-) -- 2.26.2

First add the meson required bits to be able to run the build. NOTE: inspired by our gitlab-ci.yml Signed-off-by: Erik Skultety <eskultet@redhat.com> --- ci/Makefile | 18 ++++++------------ ci/build.sh | 21 ++++++--------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index c7c8eb9a45..d3f14156c5 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -35,11 +35,8 @@ CI_CONFIGURE = $(CI_CONT_SRCDIR)/configure # Default to using all possible CPUs CI_SMP = $(shell getconf _NPROCESSORS_ONLN) -# Any extra arguments to pass to make -CI_MAKE_ARGS = - -# Any extra arguments to pass to configure -CI_CONFIGURE_ARGS = +# Any extra arguments to pass to ninja +CI_NINJA_ARGS = # Script containing environment preparation steps CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh @@ -224,9 +221,7 @@ ci-run-command@%: ci-prepare-tree CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \ CI_SMP="$(CI_SMP)" \ - CI_CONFIGURE="$(CI_CONFIGURE)" \ - CI_CONFIGURE_ARGS="$(CI_CONFIGURE_ARGS)" \ - CI_MAKE_ARGS="$(CI_MAKE_ARGS)" \ + CI_NINJA_ARGS="$(CI_NINJA_ARGS" \ $(CI_COMMAND) || exit 1' @test "$(CI_CLEAN)" = "1" && rm -rf $(CI_SCRATCHDIR) || : @@ -236,8 +231,8 @@ ci-shell@%: ci-build@%: $(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="$(CI_USER_HOME)/build" -ci-check@%: - $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS="check" +ci-test@%: + $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_NINJA_ARGS=test ci-list-images: @echo @@ -266,6 +261,5 @@ ci-help: @echo " CI_CLEAN=0 - do not delete '$(CI_SCRATCHDIR)' after completion" @echo " CI_REUSE=1 - re-use existing '$(CI_SCRATCHDIR)' content" @echo " CI_ENGINE=auto - container engine to use (podman, docker)" - @echo " CI_CONFIGURE_ARGS= - extra arguments passed to configure" - @echo " CI_MAKE_ARGS= - extra arguments passed to make, e.g. space delimited list of targets" + @echo " CI_NINJA_ARGS= - extra arguments passed to ninja" @echo diff --git a/ci/build.sh b/ci/build.sh index 2da84c080a..154b73917d 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -7,26 +7,17 @@ # # to make. -mkdir -p "$CI_CONT_BUILDDIR" || exit 1 -cd "$CI_CONT_BUILDDIR" +mkdir -p "$CI_CONT_SRCDIR" || exit 1 +cd "$CI_CONT_SRCDIR" export VIR_TEST_DEBUG=1 -NOCONFIGURE=1 "$CI_CONT_SRCDIR/autogen.sh" || exit 1 -# $CONFIGURE_OPTS is a env that can optionally be set in the container, -# populated at build time from the Dockerfile. A typical use case would -# be to pass --host/--target args to trigger cross-compilation -# -# This can be augmented by make local args in $CI_CONFIGURE_ARGS -"$CI_CONFIGURE" $CONFIGURE_OPTS $CI_CONFIGURE_ARGS -if test $? != 0; then - test -f config.log && cat config.log - exit 1 -fi +meson build --werror || (cat build/meson-logs/meson-log.txt && exit 1) +ninja -C build "$CI_NINJA_ARGS" +ninja -C build + find -name test-suite.log -delete -make -j"$CI_SMP" $CI_MAKE_ARGS - if test $? != 0; then \ LOGS=$(find -name test-suite.log) if test "$LOGS"; then -- 2.26.2

On Mon, Nov 09, 2020 at 11:32:45AM +0100, Erik Skultety wrote:
First add the meson required bits to be able to run the build. NOTE: inspired by our gitlab-ci.yml
Signed-off-by: Erik Skultety <eskultet@redhat.com> --- ci/Makefile | 18 ++++++------------ ci/build.sh | 21 ++++++--------------- 2 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/ci/Makefile b/ci/Makefile index c7c8eb9a45..d3f14156c5 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -35,11 +35,8 @@ CI_CONFIGURE = $(CI_CONT_SRCDIR)/configure # Default to using all possible CPUs CI_SMP = $(shell getconf _NPROCESSORS_ONLN)
-# Any extra arguments to pass to make -CI_MAKE_ARGS = - -# Any extra arguments to pass to configure -CI_CONFIGURE_ARGS = +# Any extra arguments to pass to ninja +CI_NINJA_ARGS =
# Script containing environment preparation steps CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh @@ -224,9 +221,7 @@ ci-run-command@%: ci-prepare-tree CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \ CI_SMP="$(CI_SMP)" \ - CI_CONFIGURE="$(CI_CONFIGURE)" \ - CI_CONFIGURE_ARGS="$(CI_CONFIGURE_ARGS)" \ - CI_MAKE_ARGS="$(CI_MAKE_ARGS)" \ + CI_NINJA_ARGS="$(CI_NINJA_ARGS" \ $(CI_COMMAND) || exit 1' @test "$(CI_CLEAN)" = "1" && rm -rf $(CI_SCRATCHDIR) || :
@@ -236,8 +231,8 @@ ci-shell@%: ci-build@%: $(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="$(CI_USER_HOME)/build"
-ci-check@%: - $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS="check" +ci-test@%: + $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_NINJA_ARGS=test
ci-list-images: @echo @@ -266,6 +261,5 @@ ci-help: @echo " CI_CLEAN=0 - do not delete '$(CI_SCRATCHDIR)' after completion" @echo " CI_REUSE=1 - re-use existing '$(CI_SCRATCHDIR)' content" @echo " CI_ENGINE=auto - container engine to use (podman, docker)" - @echo " CI_CONFIGURE_ARGS= - extra arguments passed to configure" - @echo " CI_MAKE_ARGS= - extra arguments passed to make, e.g. space delimited list of targets" + @echo " CI_NINJA_ARGS= - extra arguments passed to ninja" @echo diff --git a/ci/build.sh b/ci/build.sh index 2da84c080a..154b73917d 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -7,26 +7,17 @@ # # to make.
-mkdir -p "$CI_CONT_BUILDDIR" || exit 1 -cd "$CI_CONT_BUILDDIR" +mkdir -p "$CI_CONT_SRCDIR" || exit 1 +cd "$CI_CONT_SRCDIR"
export VIR_TEST_DEBUG=1 -NOCONFIGURE=1 "$CI_CONT_SRCDIR/autogen.sh" || exit 1
-# $CONFIGURE_OPTS is a env that can optionally be set in the container, -# populated at build time from the Dockerfile. A typical use case would -# be to pass --host/--target args to trigger cross-compilation -# -# This can be augmented by make local args in $CI_CONFIGURE_ARGS -"$CI_CONFIGURE" $CONFIGURE_OPTS $CI_CONFIGURE_ARGS -if test $? != 0; then - test -f config.log && cat config.log - exit 1 -fi +meson build --werror || (cat build/meson-logs/meson-log.txt && exit 1)
We need to honour "$MESON_OPTS" which is set in containers that are providing a cross-build envrionment. We should also honour a $CI_MESON_ARGS to let users pass overrides as before.
+ninja -C build "$CI_NINJA_ARGS" +ninja -C build + find -name test-suite.log -delete
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

...
-# $CONFIGURE_OPTS is a env that can optionally be set in the container, -# populated at build time from the Dockerfile. A typical use case would -# be to pass --host/--target args to trigger cross-compilation -# -# This can be augmented by make local args in $CI_CONFIGURE_ARGS -"$CI_CONFIGURE" $CONFIGURE_OPTS $CI_CONFIGURE_ARGS -if test $? != 0; then - test -f config.log && cat config.log - exit 1 -fi +meson build --werror || (cat build/meson-logs/meson-log.txt && exit 1)
We need to honour "$MESON_OPTS" which is set in containers that are providing a cross-build envrionment. We should also honour a $CI_MESON_ARGS to let users pass overrides as before.
Oops, good point. Erik

On Mon, Nov 09, 2020 at 11:32:45AM +0100, Erik Skultety wrote:
First add the meson required bits to be able to run the build. NOTE: inspired by our gitlab-ci.yml
Signed-off-by: Erik Skultety <eskultet@redhat.com> --- ci/Makefile | 18 ++++++------------ ci/build.sh | 21 ++++++--------------- 2 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/ci/Makefile b/ci/Makefile index c7c8eb9a45..d3f14156c5 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -35,11 +35,8 @@ CI_CONFIGURE = $(CI_CONT_SRCDIR)/configure # Default to using all possible CPUs CI_SMP = $(shell getconf _NPROCESSORS_ONLN)
-# Any extra arguments to pass to make -CI_MAKE_ARGS = - -# Any extra arguments to pass to configure -CI_CONFIGURE_ARGS = +# Any extra arguments to pass to ninja +CI_NINJA_ARGS =
# Script containing environment preparation steps CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh @@ -224,9 +221,7 @@ ci-run-command@%: ci-prepare-tree CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \ CI_SMP="$(CI_SMP)" \ - CI_CONFIGURE="$(CI_CONFIGURE)" \ - CI_CONFIGURE_ARGS="$(CI_CONFIGURE_ARGS)" \ - CI_MAKE_ARGS="$(CI_MAKE_ARGS)" \ + CI_NINJA_ARGS="$(CI_NINJA_ARGS" \
missing parenthesis ^ (consider it squashed)
$(CI_COMMAND) || exit 1' @test "$(CI_CLEAN)" = "1" && rm -rf $(CI_SCRATCHDIR) || :
@@ -236,8 +231,8 @@ ci-shell@%: ci-build@%: $(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="$(CI_USER_HOME)/build"
-ci-check@%: - $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS="check" +ci-test@%: + $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_NINJA_ARGS=test
ci-list-images: @echo @@ -266,6 +261,5 @@ ci-help: @echo " CI_CLEAN=0 - do not delete '$(CI_SCRATCHDIR)' after completion" @echo " CI_REUSE=1 - re-use existing '$(CI_SCRATCHDIR)' content" @echo " CI_ENGINE=auto - container engine to use (podman, docker)" - @echo " CI_CONFIGURE_ARGS= - extra arguments passed to configure" - @echo " CI_MAKE_ARGS= - extra arguments passed to make, e.g. space delimited list of targets" + @echo " CI_NINJA_ARGS= - extra arguments passed to ninja" @echo diff --git a/ci/build.sh b/ci/build.sh index 2da84c080a..154b73917d 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -7,26 +7,17 @@ # # to make.
-mkdir -p "$CI_CONT_BUILDDIR" || exit 1 -cd "$CI_CONT_BUILDDIR" +mkdir -p "$CI_CONT_SRCDIR" || exit 1 +cd "$CI_CONT_SRCDIR"
export VIR_TEST_DEBUG=1 -NOCONFIGURE=1 "$CI_CONT_SRCDIR/autogen.sh" || exit 1
-# $CONFIGURE_OPTS is a env that can optionally be set in the container, -# populated at build time from the Dockerfile. A typical use case would -# be to pass --host/--target args to trigger cross-compilation -# -# This can be augmented by make local args in $CI_CONFIGURE_ARGS -"$CI_CONFIGURE" $CONFIGURE_OPTS $CI_CONFIGURE_ARGS -if test $? != 0; then - test -f config.log && cat config.log - exit 1 -fi +meson build --werror || (cat build/meson-logs/meson-log.txt && exit 1) +ninja -C build "$CI_NINJA_ARGS" +ninja -C build
and ^this extra ninja invocation dropped
+ find -name test-suite.log -delete
-make -j"$CI_SMP" $CI_MAKE_ARGS - if test $? != 0; then \ LOGS=$(find -name test-suite.log) if test "$LOGS"; then -- 2.26.2

Previous patch switched the build to meson which supports only out-of-tree builds, so these variables are no longer needed. Signed-off-by: Erik Skultety <eskultet@redhat.com> --- ci/Makefile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index d3f14156c5..14a51dcb45 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -20,15 +20,6 @@ CI_HOST_SRCDIR = $(CI_SCRATCHDIR)/src # the $(CI_HOST_SRCDIR) directory from the host CI_CONT_SRCDIR = $(CI_USER_HOME)/libvirt -# Relative directory to perform the build in. This -# defaults to using a separate build dir, but can be -# set to empty string for an in-source tree build. -CI_VPATH = build - -# The directory holding the build output inside the -# container. -CI_CONT_BUILDDIR = $(CI_CONT_SRCDIR)/$(CI_VPATH) - # Can be overridden with mingw{32,64}-configure if desired CI_CONFIGURE = $(CI_CONT_SRCDIR)/configure @@ -217,9 +208,7 @@ ci-run-command@%: ci-prepare-tree --login \ --user="#$(CI_UID)" \ --group="#$(CI_GID)" \ - CONFIGURE_OPTS="$$CONFIGURE_OPTS" \ CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ - CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \ CI_SMP="$(CI_SMP)" \ CI_NINJA_ARGS="$(CI_NINJA_ARGS" \ $(CI_COMMAND) || exit 1' -- 2.26.2
participants (2)
-
Daniel P. Berrangé
-
Erik Skultety