From 0896d6a0c4bdedab5ea91a3048d2ab38c08c3315 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 1 Aug 2016 12:45:18 +0100 Subject: [PATCH 1/4] Fix files without blank newline --- bin/steps/mercurial | 2 +- bin/steps/pip-uninstall | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/steps/mercurial b/bin/steps/mercurial index 505aad6..c7d7bf1 100755 --- a/bin/steps/mercurial +++ b/bin/steps/mercurial @@ -3,4 +3,4 @@ if (grep -Fiq "hg+" requirements.txt) then bpwatch start mercurial_install /app/.heroku/python/bin/pip install mercurial | cleanup | indent bpwatch stop mercurial_install -fi \ No newline at end of file +fi diff --git a/bin/steps/pip-uninstall b/bin/steps/pip-uninstall index 7c536e2..3e41d1b 100755 --- a/bin/steps/pip-uninstall +++ b/bin/steps/pip-uninstall @@ -15,4 +15,4 @@ if [[ -f .heroku/python/requirements-declared.txt ]]; then fi fi bpwatch stop pip_uninstall -set -e \ No newline at end of file +set -e From a259143c0bdd15d5d3aa8ae472b615e1d029cbd0 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 1 Aug 2016 12:36:46 +0100 Subject: [PATCH 2/4] Avoid repetition of vendor library environment variable setting Since we need to set it regardless of whether the vendored library existed previously or not. --- bin/steps/cryptography | 8 +++----- bin/steps/gdal | 8 +++----- bin/steps/geo-libs | 8 +++----- bin/steps/pylibmc | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/bin/steps/cryptography b/bin/steps/cryptography index f85d2d4..b82f388 100755 --- a/bin/steps/cryptography +++ b/bin/steps/cryptography @@ -22,16 +22,14 @@ bpwatch start libffi_install # If a package using cffi exists within requirements, use vendored libffi. if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] PyNaCl pyOpenSSL PyOpenSSL requests[security] misaka &> /dev/null) then - if [ -d ".heroku/vendor/lib/libffi-3.1.1" ]; then - export LIBFFI=$(pwd)/vendor - else + if [ ! -d ".heroku/vendor/lib/libffi-3.1.1" ]; then echo "-----> Noticed cffi. Bootstrapping libffi." mkdir -p .heroku/vendor # Download and extract libffi into target vendor directory. curl $VENDORED_LIBFFI -s | tar zxv -C .heroku/vendor &> /dev/null - - export LIBFFI=$(pwd)/vendor fi + + export LIBFFI=$(pwd)/vendor fi bpwatch stop libffi_install diff --git a/bin/steps/gdal b/bin/steps/gdal index 2ebe12e..39f3bd3 100755 --- a/bin/steps/gdal +++ b/bin/steps/gdal @@ -22,16 +22,14 @@ bpwatch start gdal_install # If GDAL exists within requirements, use vendored gdal. if (pip-grep -s requirements.txt GDAL gdal pygdal &> /dev/null) then - if [ -f ".heroku/vendor/bin/gdalserver" ]; then - export GDAL=$(pwd)/vendor - else + if [ ! -f ".heroku/vendor/bin/gdalserver" ]; then echo "-----> Noticed GDAL. Bootstrapping gdal." mkdir -p .heroku/vendor # Download and extract cryptography into target vendor directory. curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null - - export GDAL=$(pwd)/vendor fi + + export GDAL=$(pwd)/vendor fi bpwatch stop gdal_install diff --git a/bin/steps/geo-libs b/bin/steps/geo-libs index 4a1148f..7c5fc3f 100755 --- a/bin/steps/geo-libs +++ b/bin/steps/geo-libs @@ -24,18 +24,16 @@ bpwatch start geo_libs_install # If GDAL exists within requirements, use vendored gdal. if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then - if [ -f ".heroku/vendor/bin/gdalserver" ]; then - export GDAL=$(pwd)/vendor - else + if [ ! -f ".heroku/vendor/bin/gdalserver" ]; then echo "-----> Bootstrapping gdal, geos, proj." mkdir -p .heroku/vendor # Download and extract cryptography into target vendor directory. curl $VENDORED_GDAL -s | tar zxv -C .heroku/vendor &> /dev/null curl $VENDORED_GEOS -s | tar zxv -C .heroku/vendor &> /dev/null curl $VENDORED_PROJ -s | tar zxv -C .heroku/vendor &> /dev/null - - export GDAL=$(pwd)/vendor fi + + export GDAL=$(pwd)/vendor fi bpwatch stop geo_libs_install diff --git a/bin/steps/pylibmc b/bin/steps/pylibmc index f3f13c6..1ae6914 100755 --- a/bin/steps/pylibmc +++ b/bin/steps/pylibmc @@ -21,16 +21,14 @@ bpwatch start pylibmc_install # If pylibmc exists within requirements, use vendored libmemcached. if (pip-grep -s requirements.txt pylibmc &> /dev/null) then - if [ -d ".heroku/vendor/lib/sasl2" ]; then - export LIBMEMCACHED=$(pwd)/vendor - else + if [ ! -d ".heroku/vendor/lib/sasl2" ]; then echo "-----> Noticed pylibmc. Bootstrapping libmemcached." mkdir -p .heroku/vendor # Download and extract libmemcached into target vendor directory. curl $VENDORED_MEMCACHED -s | tar zxv -C .heroku/vendor &> /dev/null - - export LIBMEMCACHED=$(pwd)/vendor fi + + export LIBMEMCACHED=$(pwd)/vendor fi bpwatch stop pylibmc_install From 5438aab12146a9a1addce263789fd2cd62df1de7 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 1 Aug 2016 12:43:00 +0100 Subject: [PATCH 3/4] Make libffi vendoring check for existing directory in correct location For both the cedar and cedar-14 stacks, the libffi directory is named `libffi-3.1` not `libffi-3.1.1`, so the existing library wouldn't be detected, causing it to be re-downloaded during every compile. --- bin/steps/cryptography | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/steps/cryptography b/bin/steps/cryptography index b82f388..7569a69 100755 --- a/bin/steps/cryptography +++ b/bin/steps/cryptography @@ -22,7 +22,7 @@ bpwatch start libffi_install # If a package using cffi exists within requirements, use vendored libffi. if (pip-grep -s requirements.txt bcrypt cffi cryptography django[bcrypt] Django[bcrypt] PyNaCl pyOpenSSL PyOpenSSL requests[security] misaka &> /dev/null) then - if [ ! -d ".heroku/vendor/lib/libffi-3.1.1" ]; then + if [ ! -d ".heroku/vendor/lib/libffi-3.1" ]; then echo "-----> Noticed cffi. Bootstrapping libffi." mkdir -p .heroku/vendor # Download and extract libffi into target vendor directory. From aef7b65b9543a4fb5b742f21af40a4a030c59ae0 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 1 Aug 2016 12:45:05 +0100 Subject: [PATCH 4/4] Don't skip the geo-libs vendoring step if only gdalserver present Since if someone previously had `GDAL` in their requirements file, they would already have the gdalserver binary present from `bin/steps/gdal` but be missing the proj and geos vendor files. By checking for `proj` instead, we ensure that the vendoring isn't incorrectly skipped in this case. --- bin/steps/geo-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/steps/geo-libs b/bin/steps/geo-libs index 7c5fc3f..f458861 100755 --- a/bin/steps/geo-libs +++ b/bin/steps/geo-libs @@ -24,7 +24,7 @@ bpwatch start geo_libs_install # If GDAL exists within requirements, use vendored gdal. if [[ "$BUILD_WITH_GEO_LIBRARIES" ]]; then - if [ ! -f ".heroku/vendor/bin/gdalserver" ]; then + if [ ! -f ".heroku/vendor/bin/proj" ]; then echo "-----> Bootstrapping gdal, geos, proj." mkdir -p .heroku/vendor # Download and extract cryptography into target vendor directory.