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