Compare commits

..

4 commits

Author SHA1 Message Date
Benjamin Renard
698fd52a03
build.sh: add some commit exclusion regex on computing Debian changelog 2023-07-10 13:07:34 +02:00
Benjamin Renard
71a49f7b2f
build.sh: fix python package version 2023-07-10 13:06:01 +02:00
Benjamin Renard
e38e5b10a7
build.sh: fix dpkg-source / quilt 'version does not contain a revision' error 2023-07-10 12:47:33 +02:00
Benjamin Renard
3a443e1fa5
build.sh: fix handling git safe protection 2023-07-10 12:46:44 +02:00

View file

@ -9,11 +9,27 @@ cd $( dirname $0 )
echo "Clean previous build..." echo "Clean previous build..."
rm -fr dist deb_dist rm -fr dist deb_dist
if [ -n "$CI" -a $UID -eq 0 ]
then
echo "CI environment detected, set current directory as git safe for root"
git config --global --add safe.directory $(pwd)
fi
echo "Detect version using git describe..." echo "Detect version using git describe..."
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )" VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )"
echo "Set version=$VERSION in setup.py using sed..." echo "Computing python version..."
sed -i "s/^version *=.*$/version = '$VERSION'/" setup.py if [ $( echo "$VERSION"|grep -c "-" ) -gt 0 ]
then
echo "Development version detected ($VERSION), compute custom python dev version"
PY_VERSION="$( echo "$VERSION"|sed 's/-\([0-9]\)\+-.*$/.dev\1/' )"
else
echo "Clean tagged version detected, use it"
PY_VERSION="$VERSION"
fi
echo "Set version=$PY_VERSION in setup.py using sed..."
sed -i "s/^version *=.*$/version = '$PY_VERSION'/" setup.py
if [ -d venv ] if [ -d venv ]
then then
@ -72,6 +88,10 @@ else
echo "Use debian codename from environment ($DEBIAN_CODENAME)" echo "Use debian codename from environment ($DEBIAN_CODENAME)"
fi fi
# Compute debian package version
DEB_VERSION_SUFFIX="-1"
DEB_VERSION="$VERSION$DEB_VERSION_SUFFIX"
echo "Generate debian changelog using gitdch..." echo "Generate debian changelog using gitdch..."
GITDCH_ARGS=('--verbose') GITDCH_ARGS=('--verbose')
[ -n "$QUIET_ARG" ] && GITDCH_ARGS=('--warning') [ -n "$QUIET_ARG" ] && GITDCH_ARGS=('--warning')
@ -87,11 +107,18 @@ then
fi fi
$GITDCH \ $GITDCH \
--package-name mylib \ --package-name mylib \
--version "${VERSION}" \ --version "${DEB_VERSION}" \
--version-suffix "${DEB_VERSION_SUFFIX}" \
--code-name $DEBIAN_CODENAME \ --code-name $DEBIAN_CODENAME \
--output debian/changelog \ --output debian/changelog \
--release-notes ../../dist/release_notes.md \ --release-notes ../../dist/release_notes.md \
--path ../../ \ --path ../../ \
--exclude "^CI: " \
--exclude "\.?woodpecker(\.yml)?" \
--exclude "build(\.sh)?" \
--exclude "tests(\.sh)?" \
--exclude "README(\.md)?" \
--exclude "^Merge branch " \
"${GITDCH_ARGS[@]}" "${GITDCH_ARGS[@]}"
echo "Add custom package name for dependencies..." echo "Add custom package name for dependencies..."