From 947d6ede20880bfe430c630871490cac8dc5ebb9 Mon Sep 17 00:00:00 2001 From: James Elford Date: Fri, 14 Apr 2017 08:18:55 +0100 Subject: [PATCH 1/3] Do not build OpenSSL with a prefix then move it elsewhere This causes linking failures on most platforms because the pkg-configs are still pointing to the location specified in prefix (as they should). This should address #1051 but I'll add a regression test in the next commit --- ci/run-docker.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 30d36ee8be..a6944f9142 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -147,17 +147,14 @@ esac install=`pwd`/target/$TARGET/openssl/openssl-install/$OPENSSL_VERS -if [ -e $install ]; then + +if [ -L $install -a -d $install-final ]; then + # $install is the "right" place for the build. See below for why it's a symlink echo 'Using cached OpenSSL static libs' else # Clean up any builds of previous versions from the cache rm -rf $(dirname $install)/* - # If the build fails half way through it will be difficult to distinguish when the next run sees - # the cached version, so finalize the build atomically. We're linking statically so don't need to - # worry about using a different prefix at install time. - final_install_path=$install - install=$install-partial mkdir -p target/$TARGET/openssl out=`pwd`/target/$TARGET/openssl/openssl-$OPENSSL_VERS.tar.gz @@ -173,8 +170,14 @@ else make -j4 && \ make install) - mv $install $final_install_path - install=$final_install_path + # Travis will cache the parent directory. That's fine, but want a way of marking the + # install "complete". In this setup, if the build fails there will be no -final and + # the whole thing starts again (which is fine). + # The same reasoning is why to cache the install-target directory rather than + # the build directory in the first place (make should be able to sort itself out in + # that case, but that's relying on intuitive timestamps in the presence of caching etc) + mv $install $install-final + ln -s $install-final $install fi # Variables to the openssl-sys crate to link statically against the OpenSSL we From e1b9ebce3a69e7249141a316b9234355f9388b58 Mon Sep 17 00:00:00 2001 From: James Elford Date: Fri, 14 Apr 2017 08:31:06 +0100 Subject: [PATCH 2/3] Include a regression test for the case when rustup is built without SSL This is the test suggested by @malbarbo in his PR: https://github.com/rust-lang-nursery/rustup.rs/pull/1054 --- ci/build-run-docker.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ci/build-run-docker.sh b/ci/build-run-docker.sh index 1186c7faa2..419ca28de4 100644 --- a/ci/build-run-docker.sh +++ b/ci/build-run-docker.sh @@ -22,3 +22,12 @@ docker run \ -e SKIP_TESTS=$SKIP_TESTS \ -it $DOCKER \ ci/run-docker.sh + +# check that rustup-init was built with ssl support +# see https://github.com/rust-lang-nursery/rustup.rs/issues/1051 +out=$(nm target/$TARGET/release/rustup-init | grep Curl_ssl_init) + +if [ -z "$out" ]; then + echo "error: Missing ssl support!!!!" >&2 + exit 1 +fi \ No newline at end of file From 3b7ada118bd8f4adf237109bcbf697a60de58cd1 Mon Sep 17 00:00:00 2001 From: James Elford Date: Fri, 14 Apr 2017 13:29:27 +0100 Subject: [PATCH 3/3] Run ssl-check in sub-shell to avoid bombing out from set -ex --- ci/build-run-docker.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ci/build-run-docker.sh b/ci/build-run-docker.sh index 419ca28de4..cebbb04159 100644 --- a/ci/build-run-docker.sh +++ b/ci/build-run-docker.sh @@ -25,9 +25,7 @@ docker run \ # check that rustup-init was built with ssl support # see https://github.com/rust-lang-nursery/rustup.rs/issues/1051 -out=$(nm target/$TARGET/release/rustup-init | grep Curl_ssl_init) - -if [ -z "$out" ]; then - echo "error: Missing ssl support!!!!" >&2 +if ! (nm target/$TARGET/release/rustup-init | grep Curl_ssl_version &> /dev/null); then + echo "Missing ssl support!!!!" >&2 exit 1 -fi \ No newline at end of file +fi