Compare commits

...

9 Commits

Author SHA1 Message Date
Kenneth Reitz 952b0bb735 v28 2013-08-14 22:02:11 -04:00
Kenneth Reitz 8b7edad8a2 bugfix for bpwatch 2013-08-14 22:01:16 -04:00
Kenneth Reitz 02787ac910 update bpwatch.zip for request_id 2013-08-14 21:19:12 -04:00
Kenneth Reitz 31e65dc58b new bpwatch 2013-07-17 17:04:37 -04:00
Kenneth Reitz 9a227e6c73 v24 2013-07-17 08:38:47 -04:00
Kenneth Reitz ddc9c24d34 deep-rm for normal builds 2013-07-17 08:34:14 -04:00
Kenneth Reitz 42488a2be7 deep-rm 2013-07-17 08:33:36 -04:00
Kenneth Reitz 839486c25b make things pretty, skip anvil build for normal runs 2013-07-17 08:25:17 -04:00
Kenneth Reitz 5d56200179 bugfix for legacy apps + usr_env_compile 2013-07-16 16:54:33 -04:00
3 changed files with 57 additions and 45 deletions
+26 -22
View File
@@ -30,16 +30,17 @@ PYTHON_EXE="/app/.heroku/python/bin/python"
PIP_VERSION="1.3.1" PIP_VERSION="1.3.1"
DISTRIBUTE_VERSION="0.6.36" DISTRIBUTE_VERSION="0.6.36"
# Setup bpwatch
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624" LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624"
BUILDPACK_VERSION=HEAD
export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json
BUILDPACK_VERSION=v28
# Support Anvil Build_IDs
[ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID [ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID
# Sanitizing environment variables.
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
bpwatch init $LOGPLEX_KEY bpwatch init $LOGPLEX_KEY
bpwatch build python $BUILDPACK_VERSION $REQUEST_ID bpwatch build python $BUILDPACK_VERSION $REQUEST_ID
@@ -48,9 +49,6 @@ TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
bpwatch start compile bpwatch start compile
# Sanitizing environment variables.
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
# We'll need to send these statics to other scripts we `source`. # We'll need to send these statics to other scripts we `source`.
export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH
@@ -63,13 +61,17 @@ TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
# Copy Anvil app dir to temporary storage... # Copy Anvil app dir to temporary storage...
bpwatch start anvil_appdir_stage bpwatch start anvil_appdir_stage
mkdir -p $TMP_APP_DIR if [ "$SLUG_ID" ]; then
deep-mv $APP_DIR $TMP_APP_DIR mkdir -p $TMP_APP_DIR
deep-mv $APP_DIR $TMP_APP_DIR
else
deep-rm $APP_DIR
fi
bpwatch stop anvil_appdir_stage bpwatch stop anvil_appdir_stage
# Copy Application code in. # Copy Application code in.
bpwatch start appdir_stage bpwatch start appdir_stage
deep-mv $BUILD_DIR $APP_DIR deep-mv $BUILD_DIR $APP_DIR
bpwatch stop appdir_stage bpwatch stop appdir_stage
# Set new context. # Set new context.
@@ -88,7 +90,7 @@ cd $BUILD_DIR
# Experimental pre_compile hook. # Experimental pre_compile hook.
bpwatch start pre_compile bpwatch start pre_compile
source $BIN_DIR/steps/hooks/pre_compile source $BIN_DIR/steps/hooks/pre_compile
bpwatch stop pre_compile bpwatch stop pre_compile
# If no requirements given, assume `setup.py develop`. # If no requirements given, assume `setup.py develop`.
@@ -108,15 +110,15 @@ mkdir -p $CACHE_DIR
# Purge "old-style" virtualenvs. # Purge "old-style" virtualenvs.
bpwatch start clear_old_venvs bpwatch start clear_old_venvs
[ -d $CACHE_DIR/$LEGACY_TRIGGER ] && rm -fr $CACHE_DIR/.heroku/bin $CACHE_DIR/.heroku/lib $CACHE_DIR/.heroku/include [ -d $CACHE_DIR/$LEGACY_TRIGGER ] && rm -fr $CACHE_DIR/.heroku/bin $CACHE_DIR/.heroku/lib $CACHE_DIR/.heroku/include
[ -d $CACHE_DIR/$VIRTUALENV_LOC ] && rm -fr $CACHE_DIR/.heroku/venv $CACHE_DIR/.heroku/src [ -d $CACHE_DIR/$VIRTUALENV_LOC ] && rm -fr $CACHE_DIR/.heroku/venv $CACHE_DIR/.heroku/src
bpwatch stop clear_old_venvs bpwatch stop clear_old_venvs
# Restore old artifacts from the cache. # Restore old artifacts from the cache.
bpwatch start restore_cache bpwatch start restore_cache
for dir in $CACHED_DIRS; do for dir in $CACHED_DIRS; do
cp -R $CACHE_DIR/$dir . &> /dev/null || true cp -R $CACHE_DIR/$dir . &> /dev/null || true
done done
bpwatch stop restore_cache bpwatch stop restore_cache
set +e set +e
@@ -193,7 +195,7 @@ hash -r
# Pylibmc support. # Pylibmc support.
# See [`bin/steps/pylibmc`](pylibmc.html). # See [`bin/steps/pylibmc`](pylibmc.html).
bpwatch start pylibmc_install bpwatch start pylibmc_install
source $BIN_DIR/steps/pylibmc source $BIN_DIR/steps/pylibmc
bpwatch stop pylibmc_install bpwatch stop pylibmc_install
# Install Mercurial if it appears to be required. # Install Mercurial if it appears to be required.
@@ -217,7 +219,7 @@ puts-step "Installing dependencies using Pip ($PIP_VERSION)"
# Django collectstatic support. # Django collectstatic support.
bpwatch start collectstatic bpwatch start collectstatic
source $BIN_DIR/steps/collectstatic source $BIN_DIR/steps/collectstatic
bpwatch stop collectstatic bpwatch stop collectstatic
# ### Finalize # ### Finalize
@@ -236,24 +238,26 @@ set-default-env PYTHONPATH /app/
# Experimental post_compile hook. # Experimental post_compile hook.
bpwatch start post_compile bpwatch start post_compile
source $BIN_DIR/steps/hooks/post_compile source $BIN_DIR/steps/hooks/post_compile
bpwatch stop post_compile bpwatch stop post_compile
# Store new artifacts in cache. # Store new artifacts in cache.
bpwatch start dump_cache bpwatch start dump_cache
for dir in $CACHED_DIRS; do for dir in $CACHED_DIRS; do
rm -rf $CACHE_DIR/$dir rm -rf $CACHE_DIR/$dir
cp -R $dir $CACHE_DIR/ cp -R $dir $CACHE_DIR/
done done
bpwatch stop dump_cache bpwatch stop dump_cache
# ### Fin. # ### Fin.
bpwatch start appdir_commit bpwatch start appdir_commit
deep-mv $BUILD_DIR $ORIG_BUILD_DIR deep-mv $BUILD_DIR $ORIG_BUILD_DIR
bpwatch stop appdir_commit bpwatch stop appdir_commit
bpwatch start anvil_appdir_commit bpwatch start anvil_appdir_commit
deep-mv $TMP_APP_DIR $APP_DIR if [ "$SLUG_ID" ]; then
deep-mv $TMP_APP_DIR $APP_DIR
fi
bpwatch stop anvil_appdir_commit bpwatch stop anvil_appdir_commit
bpwatch stop compile bpwatch stop compile
+8
View File
@@ -52,3 +52,11 @@ function deep-mv (){
rm -fr $1/!(tmp) rm -fr $1/!(tmp)
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \; find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
} }
# Does some serious deleting.
function deep-rm (){
rm -fr $1/!(tmp)
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
}
BIN
View File
Binary file not shown.