Improve build.sh logging and try to fix version detection method
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Benjamin Renard 2022-04-27 19:42:37 +02:00
parent ac9a35bfe1
commit c89ea4ab4c

View file

@ -6,16 +6,19 @@ QUIET_ARG=""
# Enter source directory
cd $( dirname $0 )
# Clean previous build
echo "Clean previous build..."
rm -fr dist deb_dist
# Set version in pyproject.toml
VERSION="$( git describe --tags )"
echo "Detect version using git describe..."
VERSION="$( git describe --tags --always )"
echo "Set version in setup.py using sed..."
sed -i "s/^version *=.*$/version = '$VERSION'/" setup.py
if [ -d venv ]
then
VENV=$( realpath venv )
echo "Use existing virtualenv $VENV to install build dependencies"
TEMP_VENV=0
else
VENV=$(mktemp -d)
@ -30,7 +33,7 @@ $VENV/bin/python3 -m pip install stdeb GitPython wheel $QUIET_ARG
echo "Build wheel package..."
$VENV/bin/python3 setup.py bdist_wheel
# Check gitdch is installed
echo "Check gitdch is installed..."
GITDCH=$(which gitdch)
set -e
if [ -z "$GITDCH" ]
@ -41,6 +44,7 @@ then
GITDCH=$TMP_GITDCH/gitdch/gitdch
else
TMP_GITDCH=""
echo "Use existing installation of gitdch ($GITDCH)"
fi
echo "Build debian source package using stdeb sdist_dsc command..."
@ -57,7 +61,7 @@ find deb_dist/ -maxdepth 1 -type f ! -name '*.orig.tar.gz' -delete
echo "Enter in debian package directory..."
cd deb_dist/mylib-$VERSION
echo "Generate EE debian codename..."
echo "Retreive debian codename using lsb_release..."
DEBIAN_CODENAME=$( lsb_release -c -s )
[ $( lsb_release -r -s ) -ge 9 ] && DEBIAN_CODENAME="${DEBIAN_CODENAME}-ee"