@@ -37,11 +37,6 @@ if [ -n "$IS_OSX" ]; then
3737 " ffmpeg_opencv 10" \
3838 )
3939
40- # Contrib adds significantly to project's build time
41- if [ " $ENABLE_CONTRIB " -eq 1 ]; then
42- BREW_TIME_LIMIT=$(( BREW_TIME_LIMIT - 10 * 60 ))
43- fi
44-
4540 function generate_ffmpeg_formula {
4641 local FF=" ffmpeg"
4742 local LFF=" ffmpeg_opencv"
@@ -92,9 +87,14 @@ function pre_build {
9287
9388 if [ -n " $IS_OSX " ]; then
9489 echo " Running for OSX"
90+
91+ local CACHE_STAGE; (echo " $TRAVIS_BUILD_STAGE_NAME " | grep -qiF " final" ) || CACHE_STAGE=1
9592
96- brew update
97- brew_add_local_bottles
93+ # after the cache stage, all bottles and Homebrew metadata should be already cached locally
94+ if [ -n " $CACHE_STAGE " ]; then
95+ brew update
96+ brew_add_local_bottles
97+ fi
9898
9999 # Don't query analytical info online on `brew info`,
100100 # this takes several seconds and we don't need it
@@ -104,14 +104,25 @@ function pre_build {
104104 echo ' Installing QT4'
105105 brew tap | grep -qxF cartr/qt4 || brew tap cartr/qt4
106106 brew tap --list-pinned | grep -qxF cartr/qt4 || brew tap-pin cartr/qt4
107- brew_install_and_cache_within_time_limit qt@4 || { [ $? -gt 1 ] && return 2 || return 0; }
107+ if [ -n " $CACHE_STAGE " ]; then
108+ brew_install_and_cache_within_time_limit qt@4 || { [ $? -gt 1 ] && return 2 || return 0; }
109+ else
110+ brew install qt@4
111+ fi
108112
109113 echo ' Installing FFmpeg'
110114
111- generate_ffmpeg_formula
112- local IS_BOTTLE_AVAILABLE; _brew_is_bottle_available ffmpeg_opencv && IS_BOTTLE_AVAILABLE=1 || IS_BOTTLE_AVAILABLE=0
113- _brew_install_and_cache ffmpeg_opencv " $IS_BOTTLE_AVAILABLE "
114- # brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
115+ if [ -n " $CACHE_STAGE " ]; then
116+ generate_ffmpeg_formula
117+ brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
118+ else
119+ brew install ffmpeg_opencv
120+ fi
121+
122+ if [ -n " $CACHE_STAGE " ]; then
123+ brew_go_bootstrap_mode 0
124+ return 0
125+ fi
115126
116127 # Have to install macpython late to avoid conflict with Homebrew Python update
117128 before_install
0 commit comments