From e697a2d6cfa4de55f36fd88a2e58056f2d6a10f3 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Sat, 6 Jul 2013 14:47:07 +0200 Subject: [PATCH] updated debian build & upload scripts --- packaging/build_deb.sh | 49 +++++++++++++++++++++++++---------- packaging/build_ppa.sh | 12 --------- packaging/dput.cf | 22 ++++++++++++++++ packaging/upload_launchpad.sh | 17 ++++++++++++ packaging/upload_mentors.sh | 9 +++++++ packaging/upload_ppa.sh | 18 ------------- 6 files changed, 83 insertions(+), 44 deletions(-) delete mode 100755 packaging/build_ppa.sh create mode 100644 packaging/dput.cf create mode 100755 packaging/upload_launchpad.sh create mode 100755 packaging/upload_mentors.sh delete mode 100755 packaging/upload_ppa.sh diff --git a/packaging/build_deb.sh b/packaging/build_deb.sh index aafdf00c..3bc10122 100755 --- a/packaging/build_deb.sh +++ b/packaging/build_deb.sh @@ -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 diff --git a/packaging/build_ppa.sh b/packaging/build_ppa.sh deleted file mode 100755 index 465874ad..00000000 --- a/packaging/build_ppa.sh +++ /dev/null @@ -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 diff --git a/packaging/dput.cf b/packaging/dput.cf new file mode 100644 index 00000000..7c29ad09 --- /dev/null +++ b/packaging/dput.cf @@ -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 = .* diff --git a/packaging/upload_launchpad.sh b/packaging/upload_launchpad.sh new file mode 100755 index 00000000..eacff231 --- /dev/null +++ b/packaging/upload_launchpad.sh @@ -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 diff --git a/packaging/upload_mentors.sh b/packaging/upload_mentors.sh new file mode 100755 index 00000000..f2932223 --- /dev/null +++ b/packaging/upload_mentors.sh @@ -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 diff --git a/packaging/upload_ppa.sh b/packaging/upload_ppa.sh deleted file mode 100755 index 76f57d28..00000000 --- a/packaging/upload_ppa.sh +++ /dev/null @@ -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