From 18c404f72d655912747568d3fa6613b1da39effd Mon Sep 17 00:00:00 2001 From: Ed Morley <edmorley@users.noreply.github.com> Date: Fri, 5 May 2017 20:54:59 +0100 Subject: [PATCH] Restore the build cache prior to running bin/pre_compile (#372) So that any changes made to `.heroku/` within pre_compile (such as installing additional libraries required for the later pip install) are not clobbered by the cache being copied over afterwards. Fixes #320. --- bin/compile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/bin/compile b/bin/compile index e499dbd7..5f8a2f7b 100755 --- a/bin/compile +++ b/bin/compile @@ -92,6 +92,20 @@ if [[ ! -f Procfile ]]; then puts-warn 'Learn more: https://devcenter.heroku.com/articles/procfile' fi +# Prepare the cache. +mkdir -p $CACHE_DIR + +# Restore old artifacts from the cache. +mkdir -p .heroku + +cp -R $CACHE_DIR/.heroku/python .heroku/ &> /dev/null || true +cp -R $CACHE_DIR/.heroku/python-stack .heroku/ &> /dev/null || true +cp -R $CACHE_DIR/.heroku/python-version .heroku/ &> /dev/null || true +cp -R $CACHE_DIR/.heroku/vendor .heroku/ &> /dev/null || true +if [[ -d $CACHE_DIR/.heroku/src ]]; then + cp -R $CACHE_DIR/.heroku/src .heroku/ &> /dev/null || true +fi + # Experimental pre_compile hook. source $BIN_DIR/steps/hooks/pre_compile @@ -115,21 +129,6 @@ if [ ! -f runtime.txt ]; then echo $DEFAULT_PYTHON_VERSION > runtime.txt fi -# Prepare the cache. -mkdir -p $CACHE_DIR - -# Restore old artifacts from the cache. -mkdir -p .heroku - -cp -R $CACHE_DIR/.heroku/python .heroku/ &> /dev/null || true -cp -R $CACHE_DIR/.heroku/python-stack .heroku/ &> /dev/null || true -cp -R $CACHE_DIR/.heroku/python-version .heroku/ &> /dev/null || true -cp -R $CACHE_DIR/.heroku/vendor .heroku/ &> /dev/null || true -if [[ -d $CACHE_DIR/.heroku/src ]]; then - cp -R $CACHE_DIR/.heroku/src .heroku/ &> /dev/null || true -fi - - mkdir -p $(dirname $PROFILE_PATH) mkdir -p /app/.heroku/src -- GitLab