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

Patch FPM Build Script #302

Merged
merged 4 commits into from
Feb 21, 2024
Merged
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
50 changes: 45 additions & 5 deletions scripts/ssm-build-dual.sh → scripts/ssm-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
# Script runs well with FPM 1.14.2 on ruby 2.7.1, setuptools 51.3.3 on RHEL and Deb platforms
# Download ruby (if you're locked to 2.5, use RVM) and then run:
# sudo gem install fpm -v 1.14.2
# ./ssm-build-dual.sh (deb | rpm) <version> <iteration> <python_root_dir> e.g.
# ./ssm-build.dual.sh deb 3.4.0 1 /usr/lib/python3.6
# for RPM builds, you will also need:
# sudo yum install rpm-build | sudo apt-get install rpm
# ./ssm-build.sh (deb | rpm) <version> <iteration> <python_root_dir>
# e.g.
# ./ssm-build.sh deb 3.4.0 1 /usr/lib/python3.6
# If you're struggling finding the right version of Python to use, consider opening interpreter and:
# import site; site.getsitepackages()
# For SSM 3.4.0 and up. Versions before that would technically work, but the changelog
# then was in a Debian format that doesn't parse and fails hard if you want to build RPM.

Expand Down Expand Up @@ -116,31 +121,63 @@ FPM_CORE="fpm -s python \
# Simple Python filter for version specific FPM
if [[ ${PY_NUM:0:1} == "3" ]]; then
echo "Building $VERSION iteration $ITERATION for Python $PY_NUM as $PACK_TYPE."

# python-stomp < 5.0.0 to python-stomp, python to python3/pip3
# edited python-pip3 to python-pip
FPM_PYTHON="--depends python3 \
# slight spelling inconsistencites betwixt OS's

if [[ "$PACK_TYPE" = "deb" ]]; then
FPM_PYTHON="--depends python3 \
--depends python-pip3 \
--depends 'python-stomp' \
--depends python-ldap \
--depends libssl-dev \
--depends libsasl2-dev \
--depends openssl "

OS_EXTENSION="_all"

# Currently builds for el8
elif [[ "$PACK_TYPE" = "rpm" ]]; then
FPM_PYTHON="--depends python3 \
--depends python3-stomppy \
--depends python3-pip \
--depends python3-ldap \
--depends openssl \
--depends openssl-devel "

OS_EXTENSION="el8"
fi

elif [[ ${PY_NUM:0:1} == "2" ]]; then
echo "Building $VERSION iteration $ITERATION for Python $PY_NUM as $PACK_TYPE."

FPM_PYTHON="--depends python2.7 \
if [[ "$PACK_TYPE" = "deb" ]]; then
FPM_PYTHON="--depends python2.7 \
--depends python-pip \
--depends 'python-stomp < 5.0.0' \
--depends python-ldap \
--depends libssl-dev \
--depends libsasl2-dev \
--depends openssl "

OS_EXTENSION="_all"

# el7 and below, due to yum package versions
elif [[ "$PACK_TYPE" = "rpm" ]]; then
FPM_PYTHON="--depends python2 \
--depends python2-pip \
--depends stomppy \
--depends python-ldap \
--depends openssl \
--depends openssl-devel "

OS_EXTENSION="el7"
fi
fi

# python-bin must always be specified in modern linux
PACKAGE_VERSION="--$PACK_TYPE-changelog $SOURCE_DIR/ssm-$VERSION-$ITERATION/CHANGELOG \
--$PACK_TYPE-dist $OS_EXTENSION \
--python-bin /usr/bin/$PY_VERSION \
--python-install-lib $PYTHON_ROOT_DIR$LIB_EXTENSION \
--exclude *.pyc \
Expand All @@ -151,11 +188,14 @@ PACKAGE_VERSION="--$PACK_TYPE-changelog $SOURCE_DIR/ssm-$VERSION-$ITERATION/CHAN
BUILD_PACKAGE_COMMAND=${FPM_CORE}${FPM_PYTHON}${VERBOSE}${PACKAGE_VERSION}
eval "$BUILD_PACKAGE_COMMAND"

echo "== Generating pleaserun package =="

# When installed, use pleaserun to perform system specific service setup
fpm -s pleaserun -t "$PACK_TYPE" \
-n apel-ssm-service \
-v "$VERSION" \
--iteration "$ITERATION" \
--"$PACK_TYPE"-dist "$OS_EXTENSION" \
-m "Apel Administrators <apel-admins@stfc.ac.uk>" \
--description "Secure Stomp Messenger (SSM) Service Daemon files." \
--architecture all \
Expand Down
Loading