updated debian build & upload scripts

This commit is contained in:
Daniel Pavel 2013-07-06 14:47:07 +02:00
parent 94d07eed53
commit e697a2d6cf
6 changed files with 83 additions and 44 deletions

View File

@ -2,16 +2,17 @@
set -e
DEVSCRIPTS="${HOME}/.devscripts"
. "${DEVSCRIPTS}"
export DEBFULLNAME="Daniel Pavel"
export DEBMAIL=${DEBMAIL:-daniel.pavel+debian@gmail.com}
export DEBSIGN_KEYID=${DEBSIGN_KEYID:-0B34B1A7}
DISTRIBUTION=${DISTRIBUTION:-debian}
DIST_RELEASE=${DIST_RELEASE:-unstable}
cd "$(dirname "$0")/.."
UDEV_RULES="$PWD/rules.d"
DEBIAN_FILES="$PWD/packaging/debian"
DIST="$PWD/dist/$DISTRIBUTION"
export DIST_RELEASE=${DIST_RELEASE:-UNRELEASED}
DIST_TARGET="$PWD/dist/$DISTRIBUTION"
#
# build a python sdist package
@ -25,22 +26,29 @@ BUILD_DIR="$TMPDIR/build-$DISTRIBUTION"
python "setup.py" sdist --dist-dir="$BUILD_DIR" --formats=gztar
cd "$BUILD_DIR"
# guess the version of the built sdist
S=$(ls -1t solaar-*.tar.gz | tail -n 1)
test -r "$S"
VERSION=${S#solaar-}
VERSION=${VERSION%.tar.gz}
# check the last version built
LAST=$(head -n 1 "$DEBIAN_FILES/changelog" | grep -o ' ([0-9.-]*) ')
LAST=${LAST# (}
LAST=${LAST%) }
LAST_VERSION=$(echo "$LAST" | cut -d- -f 1)
LAST_BUILD=$(echo "$LAST" | cut -d- -f 2)
if test -n "$BUILD_EXTRA"; then
if test "$BUILD_EXTRA"; then
# when building for a distro other than Debian, keep the same build number,
# just append the BUILD_EXTRA to it
BUILD_NUMBER=$LAST_BUILD
elif dpkg --compare-versions "$VERSION" gt "$LAST_VERSION"; then
# the version increased, this is the first build for this version
BUILD_NUMBER=1
else
# increase the build number
BUILD_NUMBER=$(($LAST_BUILD + 1))
fi
@ -48,12 +56,16 @@ tar xfz "$S"
mv "$S" solaar_$VERSION.orig.tar.gz
#
# finally build the package
# preparing to build the package
#
cd solaar-$VERSION
cp -a "$DEBIAN_FILES" .
# udev rules, if not already set
test -s debian/solaar.udev || cp -a "$UDEV_RULES"/??-*.rules debian/solaar.udev
# generate the changelog with the right version number and release
cat >debian/changelog <<_CHANGELOG
solaar ($VERSION-$BUILD_NUMBER$BUILD_EXTRA) $DIST_RELEASE; urgency=low
@ -62,17 +74,26 @@ solaar ($VERSION-$BUILD_NUMBER$BUILD_EXTRA) $DIST_RELEASE; urgency=low
-- $DEBFULLNAME <$DEBMAIL> $(date -R)
_CHANGELOG
# if this is the main (Debian) build, update the changelog
test "$BUILD_EXTRA" || cp -a debian/changelog "$DEBIAN_FILES"/changelog
# other distros may have extra files to place in debian/
test "$DEBIAN_FILES_EXTRA" && cp -a $DEBIAN_FILES_EXTRA/* debian/
/usr/bin/debuild ${DEBUILD_ARGS:-$@} \
--lintian-opts --profile $DISTRIBUTION
# set the right maintainer email address
sed -i -e "s/^Maintainer: .*$/Maintainer: $DEBFULLNAME <$DEBMAIL>/" debian/control
/bin/rm --force "$DIST"/*
/bin/mkdir --parents "$DIST"
cp -a -t "$DIST" ../solaar_$VERSION* || true
cp -a -t "$DIST" ../solaar-*_$VERSION* || true
cd "$DIST"
#cp -av -t ../../../packages/ * || true
export DEBUILD_LINTIAN_OPTS="--profile $DISTRIBUTION"
export DEBUILD_DPKG_BUILDPACKAGE_OPTS="-sa"
export DEBUILD_PRESERVE_ENVVARS='GPG_AGENT_INFO,DISPLAY'
/usr/bin/debuild $@
#
# place the resulting files in dist/$DISTRIBUTION/
#
/bin/rm --force "$DIST_TARGET"/*
/bin/mkdir --parents "$DIST_TARGET"
cp -a -t "$DIST_TARGET" ../solaar_$VERSION*
cp -a -t "$DIST_TARGET" ../solaar-*_$VERSION* || true

View File

@ -1,12 +0,0 @@
#!/bin/sh
set -e
cd "$(dirname "$0")/.."
DISTRIBUTION=ubuntu
DIST_RELEASE=precise
DEBIAN_FILES_EXTRA="$PWD/packaging/ubuntu"
BUILD_EXTRA=ppa1
DEBUILD_ARGS="-sa $@"
. packaging/build_deb.sh

22
packaging/dput.cf Normal file
View File

@ -0,0 +1,22 @@
[solaar-ppa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~daniel.pavel/solaar/ubuntu/
login = anonymous
allow_unsigned_uploads = 0
[solaar-snapshots-ppa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~daniel.pavel/solaar-snapshots/ubuntu/
login = anonymous
allow_unsigned_uploads = 0
[mentors]
fqdn = mentors.debian.net
incoming = /upload
method = http
allow_unsigned_uploads = 0
progress_indicator = 2
# Allow uploads for UNRELEASED packages
allowed_distributions = .*

17
packaging/upload_launchpad.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
export DEBSIGN_KEYID=07D8904B
export DEBMAIL="daniel.pavel+launchpad@gmail.com"
export DISTRIBUTION=ubuntu
export DIST_RELEASE=precise
export DEBIAN_FILES_EXTRA="$PWD/packaging/ubuntu"
export BUILD_EXTRA=ppa1
Z="$(readlink -f "$(dirname "$0")")"
"$Z"/build_deb.sh -S
cd "$Z/../dist/ubuntu/"
/usr/bin/dput --config="$Z/dput.cf" solaar-snapshots-ppa solaar_*_source.changes

9
packaging/upload_mentors.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
Z="$(readlink -f "$(dirname "$0")")"
"$Z"/build_deb.sh -S
cd "$Z/../dist/debian/"
/usr/bin/dput --config="$Z/dput.cf" mentors solaar_*_source.changes

View File

@ -1,18 +0,0 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"/..
./packaging/build_ppa.sh -S
cd ./dist/ubuntu/
C=${XDG_CONFIG_HOME:-$HOME/.config}/debian/dput.cf
if test -r "$C"; then
C="--config $C"
elif test -r "$HOME/.dput.cf"; then
C="--config=$HOME/.dput.cf"
else
unset C
fi
/usr/bin/dput $C solaar-snapshots-ppa solaar_*_source.changes