Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump actions/checkout from 2.4.0 to 3 #29

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
!contains(github.event.pull_request.labels.*.name, 'dependencies')
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3
- name: Check that CHANGELOG is touched
run: |
git fetch origin ${{ github.base_ref }} --depth 1 && \
Expand Down
3 changes: 3 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ if [ ! -f requirements.txt ] && [ ! -f Pipfile ]; then
echo "-e ." > requirements.txt
fi

# Python-ldap support.
source $BIN_DIR/steps/python-ldap

# SQLite3 support.
# This sets up and installs sqlite3 dev headers and the sqlite3 binary but not the
# libsqlite3-0 library since that exists on the stack image.
Expand Down
148 changes: 148 additions & 0 deletions bin/steps/python-ldap
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/usr/bin/env bash

# This script serves as the python-ldap build step of the
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
# compiler.
#
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
# adapter between a Python application and Heroku's runtime.
#
# This script is invoked by [`bin/compile`](/).

source $BIN_DIR/utils

python-ldap-version() {
local PYTHON_LDAP_VERSION=""
if cat requirements.txt | grep python-ldap ; then
PYTHON_LDAP_VERSION=$(cat requirements.txt | grep python-ldap | awk -F '=' '{ print $3 }')
fi

if [ ! -n $PYTHON_LDAP_VERSION ] || [ ! -f $CACHE_DIR/.python-ldap/python-ldap-${PYTHON_LDAP_VERSION}.tar.gz ]; then
mkdir tmpdir
if [ -n "$PYTHON_LDAP_VERSION" ]; then
pip install --quiet --download tmpdir python-ldap==${PYTHON_LDAP_VERSION}
else
pip install --quiet --download tmpdir python-ldap
PYTHON_LDAP_VERSION=$(ls tmpdir | grep python-ldap | sed 's/python-ldap-\(.*\)\.tar\.gz/\1/g')
fi

cp tmpdir/python-ldap-${PYTHON_LDAP_VERSION}.tar.gz $CACHE_DIR/.python-ldap/python-ldap-${PYTHON_LDAP_VERSION}.tar.gz
rm -rf tmpdir
fi
echo $PYTHON_LDAP_VERSION
}

install-python-ldap() {
local OPENLDAP_BUILD_DIR=$1

echo "Installing python-ldap ..." | indent
local PYTHON_LDAP_VERSION=$(python-ldap-version)
tar -zxvf $CACHE_DIR/.python-ldap/python-ldap-${PYTHON_LDAP_VERSION}.tar.gz > /dev/null

cd python-ldap-${PYTHON_LDAP_VERSION}
sed "s,library_dirs = \(.*\),library_dirs = $OPENLDAP_BUILD_DIR/lib \1,g" setup.cfg > setup.cfg
sed "s,include_dirs = \(.*\),include_dirs = $OPENLDAP_BUILD_DIR/include \1,g" setup.cfg > setup.cfg

set +e
/app/.heroku/python/bin/pip install . --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir | cleanup | log-output | indent
PIP_STATUS="${PIPESTATUS[0]}"
set -e

cd - > /dev/null

if [[ ! $PIP_STATUS -eq 0 ]]; then
echo
show-warnings
exit 1
fi
}

# If python-ldap exists within requirements, use vendored cryptography.
if (pip-grep -s requirements.txt python-ldap django-auth-ldap &> /dev/null) then

puts-step "Noticed python-ldap. Bootstrapping ldap."

GROFF_VERSION=${GROFF_VERSION:-1.22.3}
GROFF_URL=ftp://ftp.gnu.org/gnu/groff/groff-${GROFF_VERSION}.tar.gz
GROFF_CACHE_DIR=${CACHE_DIR}/.python-ldap/lib-groff-${GROFF_VERSION}
GROFF_BUILD_DIR=${BUILD_DIR}/.python-ldap/lib-groff-${GROFF_VERSION}

BERKLEY_DB_VERSION=${BERKLEY_DB_VERSION:-5.3.28}
BERKLEY_DB_URL=http://download.oracle.com/berkeley-db/db-${BERKLEY_DB_VERSION}.NC.tar.gz
BERKLEY_CACHE_DIR=${CACHE_DIR}/.python-ldap/lib-berkleydb-${BERKLEY_DB_VERSION}
BERKLEY_BUILD_DIR=${BUILD_DIR}/.python-ldap/lib-berkleydb-${BERKLEY_DB_VERSION}

OPENLDAP_VERSION=${OPENLDAP_VERSION:-2.4.43}
OPENLDAP_URL=http://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${OPENLDAP_VERSION}.tgz
OPENLDAP_CACHE_DIR=${CACHE_DIR}/.python-ldap/lib-openldap-${OPENLDAP_VERSION}
OPENLDAP_BUILD_DIR=${BUILD_DIR}/.python-ldap/lib-openldap-${OPENLDAP_VERSION}

mkdir -p $CACHE_DIR/.python-ldap
mkdir -p $BUILD_DIR/.python-ldap

if [ ! -d $GROFF_CACHE_DIR ]; then
echo "Downloading Groff ${GROFF_VERSION} ..." | indent
curl -s -L -o groff.tar.gz $GROFF_URL
echo "Unpacking ..." | indent
tar -zxvf groff.tar.gz > /dev/null
rm groff.tar.gz
mv groff-${GROFF_VERSION} $CACHE_DIR/.python-ldap/groff
echo "Configuring ..." | indent
cd $CACHE_DIR/.python-ldap/groff
./configure --prefix=$GROFF_CACHE_DIR > /dev/null
echo "Compiling ..." | indent
make PROCESSEDEXAMPLEFILES="" > /dev/null
echo "Installing ..." | indent
make PROCESSEDEXAMPLEFILES="" install > /dev/null
cd - > /dev/null
fi

cp -R $GROFF_CACHE_DIR $GROFF_BUILD_DIR
export PATH=${GROFF_BUILD_DIR}/bin:${PATH}
echo "Groff enabled." | indent

if [ ! -d $BERKLEY_CACHE_DIR ]; then
echo "Downloading BerkleyDB ${BERKLEY_DB_VERSION} ..." | indent
curl -s -L -o berkleydb.tar.gz $BERKLEY_DB_URL
echo "Unpacking ..." | indent
tar -zxvf berkleydb.tar.gz > /dev/null
rm berkleydb.tar.gz
mv db-${BERKLEY_DB_VERSION}.NC $CACHE_DIR/.python-ldap/berkleydb
echo "Configuring ..." | indent
cd $CACHE_DIR/.python-ldap/berkleydb/build_unix
../dist/configure --prefix=$BERKLEY_CACHE_DIR > /dev/null
echo "Compiling ..." | indent
make > /dev/null
echo "Installing ..." | indent
make install > /dev/null
cd - > /dev/null
fi

cp -R $BERKLEY_CACHE_DIR $BERKLEY_BUILD_DIR
export LD_LIBRARY_PATH=${BERKLEY_BUILD_DIR}/lib:${LD_LIBRARY_PATH}
echo "BerkleyDB enabled." | indent

if [ ! -d $OPENLDAP_CACHE_DIR ]; then
echo "Downloading Open LDAP ${OPENLDAP_VERSION} ..." | indent
curl -s -L -o openldap.tgz $OPENLDAP_URL
echo "Unpacking ..." | indent
tar -zxvf openldap.tgz > /dev/null
rm openldap.tgz
mv openldap-${OPENLDAP_VERSION} $CACHE_DIR/.python-ldap/openldap
echo "Configuring ..." | indent
cd $CACHE_DIR/.python-ldap/openldap
LDFLAGS="-L$BERKLEY_BUILD_DIR/lib ${LDFLAGS}" CPPFLAGS="-I$BERKLEY_BUILD_DIR/include ${CPPFLAGS}" ./configure --enable-bdb --enable-crypt --with-tls=openssl --prefix=$OPENLDAP_CACHE_DIR > /dev/null
echo "Compiling ..." | indent
make depend > /dev/null
make > /dev/null
echo "Installing ..." | indent
make install > /dev/null
cd - > /dev/null
fi

cp -R $OPENLDAP_CACHE_DIR $OPENLDAP_BUILD_DIR
echo "Open LDAP enabled." | indent

install-python-ldap $OPENLDAP_BUILD_DIR
fi