提交 61c4172a 编写于 作者: I Ivan Pozdeev

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