[libvirt] [PATCH v2 0/6] travis: Various cleanups and fixes

Changes from [v1]: * keep DOCKER_CMD around instead of removing it completely, which will help once we introduce MinGW builds; * the last two patches are new. [v1] https://www.redhat.com/archives/libvir-list/2018-June/msg00579.html Andrea Bolognani (6): travis: Skip macOS upgrade travis: Don't duplicate Docker invocation travis: Introduce MACOS_CMD travis: Rename DOCKER_CMD to LINUX_CMD travis: Fix error path travis: Skip first compilation for Linux builds .travis.yml | 74 ++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 40 deletions(-) -- 2.17.1

Upgrading takes quite a bit of time, doesn't offer any real value and causes a lot of grief. Let's just skip it. We need to install xz explicitly now, since it's required to make dist and no longer being dragged in by Python 3. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac0d48a606..f99e1cd6e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,10 +43,8 @@ matrix: env: - PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH" before_install: - - brew uninstall python mercurial postgis sfcgal cgal gdal - brew update - - brew upgrade - - brew install python ccache rpcgen yajl + - brew install ccache rpcgen xz yajl before_script: - ./autogen.sh --prefix=$(pwd)/install-root script: -- 2.17.1

All variable parts are taken from the environment, so we can exploit inheritance and avoid duplication. This will become more important as we start building on additional platforms. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index f99e1cd6e6..4afaca313b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,31 +12,11 @@ matrix: env: - IMAGE=ubuntu:18.04 - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd" - script: - - docker run - --privileged - -v $(pwd):/build - -w /build - -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG" - -e PACKAGES="$PACKAGES" - -e DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" - "$IMAGE" - /bin/sh -xc "$DOCKER_CMD" - services: - docker env: - IMAGE=ubuntu:16.04 - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart" - script: - - docker run - --privileged - -v $(pwd):/build - -w /build - -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG" - -e PACKAGES="$PACKAGES" - -e DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" - "$IMAGE" - /bin/sh -xc "$DOCKER_CMD" - compiler: clang language: c os: osx @@ -57,6 +37,17 @@ matrix: - find -name test-suite.log | xargs cat - echo '=== LOG FILE(S) END ===' +script: + - docker run + --privileged + -v $(pwd):/build + -w /build + -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG" + -e PACKAGES="$PACKAGES" + -e DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS" + "$IMAGE" + /bin/sh -xc "$DOCKER_CMD" + git: submodules: true -- 2.17.1

It mirrors the existing DOCKER_CMD, both in how it's defined as part of the environment and how it's called by passing it directly to the shell. In addition to making the configuration more consistent, this also allows us to move from having the macOS build script divided into four steps, some of which have slightly different semantics and the relationship between which is not immediately obvious without consulting the documentation, to a single straightforward shell invocation. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4afaca313b..ec45d78303 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,20 +22,8 @@ matrix: os: osx env: - PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH" - before_install: - - brew update - - brew install ccache rpcgen xz yajl - before_script: - - ./autogen.sh --prefix=$(pwd)/install-root script: - # We can't run make distcheck/syntax-check because they - # fail on macOS, but doing 'install' and 'dist' gives us - # some useful coverage - - make -j3 && make -j3 install && make -j3 dist - after_failure: - - echo '=== LOG FILE(S) START ===' - - find -name test-suite.log | xargs cat - - echo '=== LOG FILE(S) END ===' + /bin/sh -xc "$MACOS_CMD" script: - docker run @@ -68,6 +56,22 @@ env: exit 1 ) " + # We can't run 'distcheck' or 'syntax-check' because they fail on + # macOS, but doing 'install' and 'dist' gives us some useful coverage + - MACOS_CMD=" + brew update && + brew install ccache rpcgen xz yajl && + ./autogen.sh --prefix=\$(pwd)/install-root && + make -j3 && + make -j3 install && + make -j3 dist || + ( + echo '=== LOG FILE(S) START ===' + find -name test-suite.log | xargs cat + echo '=== LOG FILE(S) END ===' + exit 1 + ) + " # Please keep this list sorted alphabetically - PACKAGES=" augeas-tools -- 2.17.1

The new name is arguably more informative, especially now that we have MACOS_CMD and knowing that MINGW_CMD will be introduced later on. We still use DOCKER_CMD when calling Docker, and we assign the actual script on a per-image basis. Having this separation will help us when we introduce MinGW builds. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec45d78303..a902d203ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,11 +12,13 @@ matrix: env: - IMAGE=ubuntu:18.04 - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd" + - DOCKER_CMD="$LINUX_CMD" - services: - docker env: - IMAGE=ubuntu:16.04 - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart" + - DOCKER_CMD="$LINUX_CMD" - compiler: clang language: c os: osx @@ -42,7 +44,7 @@ git: env: global: - VIR_TEST_DEBUG=1 - - DOCKER_CMD=" + - LINUX_CMD=" apt-get update && apt-get install -y \$PACKAGES && ./autogen.sh && -- 2.17.1

Without a proper separator, all commands in the error path end up being interpreted as a single command, which is not what we want. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a902d203ff..1e2e307ac5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,9 +52,9 @@ env: make -j3 syntax-check && make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=\"\$DISTCHECK_CONFIGURE_FLAGS\" || ( - echo '=== LOG FILE(S) START ===' - find -name test-suite.log | xargs cat - echo '=== LOG FILE(S) END ===' + echo '=== LOG FILE(S) START ==='; + find -name test-suite.log | xargs cat; + echo '=== LOG FILE(S) END ==='; exit 1 ) " @@ -68,9 +68,9 @@ env: make -j3 install && make -j3 dist || ( - echo '=== LOG FILE(S) START ===' - find -name test-suite.log | xargs cat - echo '=== LOG FILE(S) END ===' + echo '=== LOG FILE(S) START ==='; + find -name test-suite.log | xargs cat; + echo '=== LOG FILE(S) END ==='; exit 1 ) " -- 2.17.1

We already perform a full build as part of distcheck, so we can speed things up a bit by skipping the first compilation. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e2e307ac5..a4a0bbb072 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,6 @@ env: apt-get update && apt-get install -y \$PACKAGES && ./autogen.sh && - make -j3 && make -j3 syntax-check && make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=\"\$DISTCHECK_CONFIGURE_FLAGS\" || ( -- 2.17.1

On Thu, Jun 14, 2018 at 06:53:33PM +0200, Andrea Bolognani wrote:
Changes from [v1]:
* keep DOCKER_CMD around instead of removing it completely, which will help once we introduce MinGW builds;
* the last two patches are new.
[v1] https://www.redhat.com/archives/libvir-list/2018-June/msg00579.html
Andrea Bolognani (6): travis: Skip macOS upgrade travis: Don't duplicate Docker invocation travis: Introduce MACOS_CMD travis: Rename DOCKER_CMD to LINUX_CMD travis: Fix error path travis: Skip first compilation for Linux builds
.travis.yml | 74 ++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 40 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé