[libvirt] [PATCH 0/2] travis: fix macOS build

You can see the "working" build here: https://travis-ci.org/berrange/libvirt/builds/353816421 Yeah it still failed, but it got past the brew bit that was failing before, and now fails for genuine code problems :-) Daniel P. Berrangé (2): travis: move macOS before_install tasks into osx matrix entry travis: unlink python package before upgrading brew packages .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.14.3

The list of commands we're running for the before_install task is rather large. We have it all on one line because we're wrapping it all in a test against TRAVIS_OS_NAME env variable. By moving it into the osx matrix entry we can remove the need for the conditional shell test. This lets us put each command on a separate line making the steps clear to understand. Fortunately the 'before_install' task does not have the crazy behaviour whereby travis ignores errors and runs all commands regardless, like the 'script' task does. The first command failing will cause an immediate stop with error status. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79f30f3090..9801981eca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,11 @@ matrix: - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd" - compiler: clang os: osx + before_install: + - brew update + - brew upgrade + - brew install rpcgen yajl xz + - brew link --force python@2 script: # We can't run make distcheck/syntax-check because they # fail on macOS, but doing 'install' and 'dist' gives us @@ -99,9 +104,6 @@ env: - PATH="/usr/local/opt/gettext/bin:/usr/local/opt/rpcgen/bin:$PATH" - VIR_TEST_DEBUG=1 -before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl xz && brew link --force python@2; fi - before_script: - ./autogen.sh --prefix=$(pwd)/install-root -- 2.14.3

On Thu, 2018-03-15 at 13:33 +0000, Daniel P. Berrangé wrote:
The list of commands we're running for the before_install task is rather large. We have it all on one line because we're wrapping it all in a test against TRAVIS_OS_NAME env variable.
By moving it into the osx matrix entry we can remove the need for the conditional shell test. This lets us put each command on a separate line making the steps clear to understand.
Fortunately the 'before_install' task does not have the crazy behaviour whereby travis ignores errors and runs all commands regardless, like the 'script' task does. The first command failing will cause an immediate stop with error status.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

The 'brew upgrade' command is pulling in the python2 package which promptly fails due to clashing symlinks installed by the new python package (which is python3 based): ==> Pouring python@2-2.7.14_3.sierra.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-2 Target /usr/local/bin/2to3-2 is a symlink belonging to python. You can unlink it: brew unlink python To force the link and overwrite all conflicting files: brew link --overwrite python@2 To list all files that would be deleted: brew link --overwrite --dry-run python@2 By running 'brew unlink python' we can get rid of the python3 links that we didn't want in the first place and avoid this error. This is the working fix for what we previously attempted todo in: commit c9c9fc90ce77ac4a3079c99f42b621937b464700 Author: Daniel P. Berrangé <berrange@redhat.com> Date: Mon Mar 5 10:13:12 2018 +0000 travis: force install of python2 into $PATH on macOS Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9801981eca..d1f09f9cad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,9 +16,9 @@ matrix: os: osx before_install: - brew update + - brew unlink python - brew upgrade - brew install rpcgen yajl xz - - brew link --force python@2 script: # We can't run make distcheck/syntax-check because they # fail on macOS, but doing 'install' and 'dist' gives us -- 2.14.3

On Thu, 2018-03-15 at 13:33 +0000, Daniel P. Berrangé wrote:
The 'brew upgrade' command is pulling in the python2 package which promptly fails due to clashing symlinks installed by the new python package (which is python3 based):
==> Pouring python@2-2.7.14_3.sierra.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-2 Target /usr/local/bin/2to3-2 is a symlink belonging to python. You can unlink it: brew unlink python To force the link and overwrite all conflicting files: brew link --overwrite python@2 To list all files that would be deleted: brew link --overwrite --dry-run python@2
By running 'brew unlink python' we can get rid of the python3 links that we didn't want in the first place and avoid this error.
The behavior of homebrew with respect to linking seems completely insane to me. Why would you need to manually apply a workaround in order to upgrade an existing system? Anyway, this seems to work, so Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Mar 15, 2018 at 02:58:56PM +0100, Andrea Bolognani wrote:
On Thu, 2018-03-15 at 13:33 +0000, Daniel P. Berrangé wrote:
The 'brew upgrade' command is pulling in the python2 package which promptly fails due to clashing symlinks installed by the new python package (which is python3 based):
==> Pouring python@2-2.7.14_3.sierra.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-2 Target /usr/local/bin/2to3-2 is a symlink belonging to python. You can unlink it: brew unlink python To force the link and overwrite all conflicting files: brew link --overwrite python@2 To list all files that would be deleted: brew link --overwrite --dry-run python@2
By running 'brew unlink python' we can get rid of the python3 links that we didn't want in the first place and avoid this error.
The behavior of homebrew with respect to linking seems completely insane to me. Why would you need to manually apply a workaround in order to upgrade an existing system?
I don't think this is really intentional - it just seems like part of the giant python disaster the packagers have created for themselves...
Anyway, this seems to work, so
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
-- Andrea Bolognani / Red Hat / Virtualization
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é