提交 e7a5b665 编写于 作者: I Ivan Pozdeev 提交者: Olli-Pekka Heinisuo

Fix/improve travis_osx_brew_cache & caching logic

* fix built bottle & metadata cleanup when bottle is missing
* -e mode for before_cache step
* faster finish when already the latest version
上级 10c7cfa6
......@@ -619,7 +619,7 @@ script: |
before_cache: |
# Cleanup dirs to be cached
set -x
set -e; set -x
if [ -n "$IS_OSX" ]; then
# When Taps is cached, this dir causes "Error: file exists" on `brew update`
......@@ -630,7 +630,7 @@ before_cache: |
brew_cache_cleanup
fi
set +x
set +x; set +e
after_success: |
# Upload wheels to pypi if requested
......
......@@ -41,6 +41,12 @@ function brew_install_and_cache_within_time_limit {
local BUILD_FROM_SOURCE INCLUDE_BUILD
if brew list --versions "$PACKAGE" && ! (brew outdated | grep -qx "$PACKAGE"); then
echo "Already installed and the latest version: $PACKAGE"
return 0
fi
_brew_is_bottle_available "$PACKAGE" || BUILD_FROM_SOURCE=1
[ -n "$BUILD_FROM_SOURCE" ] && INCLUDE_BUILD="--include-build" || true
......@@ -152,7 +158,7 @@ function brew_add_local_bottles {
)
fi
if [ -n "$BOTTLE" ]; then rm "$BOTTLE"; fi
if [ -n "$BOTTLE" -a -n "$BOTTLE_EXISTS" ]; then rm "$BOTTLE"; fi
rm -f "$BOTTLE_LINK"
rm "$JSON"
......@@ -295,17 +301,14 @@ function _brew_is_bottle_available {
function _brew_install_and_cache {
# Install bottle or make and cache bottle.
# assumes that deps were already installed.
# assumes that deps were already installed
# and not already the latest version
local PACKAGE;PACKAGE="${1:?}"
local USE_BOTTLE;USE_BOTTLE="${2:?}"
local VERB
if brew list --versions "$PACKAGE"; then
if ! (brew outdated | grep -qx "$PACKAGE"); then
echo "Already the latest version: $PACKAGE"
return 0
fi
VERB=upgrade
else
VERB=install
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册