major clean-up of debian building script
This commit is contained in:
parent
8b26759731
commit
2ab040591c
|
@ -2,98 +2,95 @@
|
|||
|
||||
set -e
|
||||
|
||||
export DEBFULLNAME="Daniel Pavel"
|
||||
export DEBMAIL=${DEBMAIL:-daniel.pavel+debian@gmail.com}
|
||||
export DEBSIGN_KEYID=${DEBSIGN_KEYID:-0B34B1A7}
|
||||
if test "$DEBSIGN_KEYID"; then
|
||||
test "$DEBEMAIL"
|
||||
test "$DEBFULLNAME"
|
||||
else
|
||||
export DEBFULLNAME="$(/usr/bin/getent passwd "$USER" | \
|
||||
/usr/bin/cut --delimiter=: --fields=5 | /usr/bin/cut --delimiter=, --fields=1)"
|
||||
export DEBEMAIL="${EMAIL:-$USER@$(/bin/hostname --long)}"
|
||||
fi
|
||||
export DEBMAIL="$DEBEMAIL"
|
||||
|
||||
DISTRIBUTION=${DISTRIBUTION:-debian}
|
||||
DIST_RELEASE=${DIST_RELEASE:-unstable}
|
||||
export DEBCHANGE_VENDOR=${DEBCHANGE_VENDOR:-$(/usr/bin/dpkg-vendor --query vendor | /usr/bin/tr 'A-Z' 'a-z')}
|
||||
DISTRIBUTION=${DISTRIBUTION:-UNRELEASED}
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
UDEV_RULES="$PWD/rules.d"
|
||||
DEBIAN_FILES="$PWD/packaging/debian"
|
||||
DIST_TARGET="$PWD/dist/$DISTRIBUTION"
|
||||
DEBIAN_FILES_VENDOR="$PWD/packaging/$DEBCHANGE_VENDOR"
|
||||
DIST_TARGET="$PWD/dist/$DEBCHANGE_VENDOR"
|
||||
|
||||
#
|
||||
# build a python sdist package
|
||||
# build a python sdist package, then unpack and create .orig and source dir
|
||||
#
|
||||
|
||||
export TMPDIR=${TMPDIR:-/tmp}/solaar-build-$USER
|
||||
/bin/mkdir --parents --mode=0700 "$TMPDIR"
|
||||
BUILD_DIR="$TMPDIR/build-$DISTRIBUTION"
|
||||
/bin/rm --recursive --force "$BUILD_DIR"
|
||||
VERSION="$(python2.7 setup.py --version)"
|
||||
FULLNAME="$(python2.7 setup.py --fullname)"
|
||||
|
||||
export TMPDIR="${TMPDIR:-/tmp}/debbuild-$FULLNAME-$USER"
|
||||
BUILD_DIR="$TMPDIR/$DEBCHANGE_VENDOR-$DISTRIBUTION"
|
||||
/bin/rm --force --recursive "$BUILD_DIR"
|
||||
/bin/mkdir --parents --mode=0700 "$BUILD_DIR"
|
||||
python "setup.py" sdist --dist-dir="$BUILD_DIR" --formats=gztar
|
||||
python2.7 setup.py sdist --dist-dir="$BUILD_DIR" --formats=gztar --quiet
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
ORIG_FILE="$BUILD_DIR/solaar_$VERSION.orig.tar.gz"
|
||||
/bin/mv "$BUILD_DIR/$FULLNAME.tar.gz" "$ORIG_FILE"
|
||||
/bin/tar --extract --gunzip --file "$ORIG_FILE" --directory "$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 "$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
|
||||
|
||||
tar xfz "$S"
|
||||
mv "$S" solaar_$VERSION.orig.tar.gz
|
||||
cd "$BUILD_DIR/$FULLNAME"
|
||||
unset BUILD_DIR VERSION FULLNAME ORIG_FILE
|
||||
|
||||
#
|
||||
# preparing to build the package
|
||||
#
|
||||
|
||||
cd solaar-$VERSION
|
||||
cp -a "$DEBIAN_FILES" .
|
||||
/bin/cp --archive --target-directory=. "$DEBIAN_FILES"
|
||||
|
||||
# udev rules, if not already set
|
||||
test -s debian/solaar.udev || cp -a "$UDEV_RULES"/??-*.rules debian/solaar.udev
|
||||
if test "$DEBSIGN_KEYID"; then
|
||||
BUILDER_MAIL="$(echo "$DEBEMAIL" | /bin/sed --expression='s/+[a-z]*@/@/')"
|
||||
MAINT_MAIL="$(/bin/grep '^Maintainer: ' debian/control | /usr/bin/cut --delimiter=' ' --fields=2)"
|
||||
echo "maintainer $MAINT_MAIL, builder $BUILDER_MAIL"
|
||||
# test "$MAINT_MAIL" = "$BUILDER_MAIL" &&
|
||||
# /bin/sed --in-place --expression="s/^Maintainer: .*$/Maintainer: $DEBFULLNAME <$DEBEMAIL>/" debian/control
|
||||
else
|
||||
/bin/sed --in-place --file=- debian/control <<-CONTROL
|
||||
/^Maintainer:/ a\
|
||||
Changed-By: $DEBFULLNAME <$DEBEMAIL>
|
||||
CONTROL
|
||||
fi
|
||||
|
||||
# generate the changelog with the right version number and release
|
||||
cat >debian/changelog <<_CHANGELOG
|
||||
solaar ($VERSION-$BUILD_NUMBER$BUILD_EXTRA) $DIST_RELEASE; urgency=low
|
||||
/usr/bin/debchange \
|
||||
--vendor "$DEBCHANGE_VENDOR" \
|
||||
--distribution "$DISTRIBUTION" \
|
||||
--force-save-on-release \
|
||||
--auto-nmu \
|
||||
$@
|
||||
|
||||
* Debian packaging scripts, supports ubuntu ppa as well.
|
||||
if test "$DEBCHANGE_VENDOR" = debian; then
|
||||
# if this is the main (Debian) build, update the source changelog
|
||||
/bin/cp --archive --no-target-directory debian/changelog "$DEBIAN_FILES"/changelog
|
||||
else
|
||||
# else copy any additional files
|
||||
/bin/cp --archive --target-directory=debian/ "$DEBIAN_FILES_VENDOR"/* || true
|
||||
fi
|
||||
|
||||
-- $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/
|
||||
|
||||
# set the right maintainer email address
|
||||
sed -i -e "s/^Maintainer: .*$/Maintainer: $DEBFULLNAME <$DEBMAIL>/" debian/control
|
||||
|
||||
export DEBUILD_LINTIAN_OPTS="--profile $DISTRIBUTION"
|
||||
export DEBUILD_DPKG_BUILDPACKAGE_OPTS="-sa"
|
||||
export DEBUILD_PRESERVE_ENVVARS='GPG_AGENT_INFO,DISPLAY'
|
||||
/usr/bin/debuild $@
|
||||
if test "$DEBSIGN_KEYID"; then
|
||||
# only build a source package, and sign it
|
||||
DPKG_BUILPACKAGE_OPTS="-sa -S -k$DEBSIGN_KEYID"
|
||||
else
|
||||
# build an unsigned binary package
|
||||
DPKG_BUILPACKAGE_OPTS="-b -us -uc"
|
||||
fi
|
||||
/usr/bin/debuild \
|
||||
--lintian --tgz-check \
|
||||
--preserve-envvar=DISPLAY \
|
||||
$DPKG_BUILPACKAGE_OPTS \
|
||||
--lintian-opts --profile "$DEBCHANGE_VENDOR"
|
||||
|
||||
#
|
||||
# place the resulting files in dist/$DISTRIBUTION/
|
||||
# place the resulting files in $DIST_TARGET
|
||||
#
|
||||
|
||||
/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
|
||||
/bin/cp --archive --backup=numbered --target-directory="$DIST_TARGET" ../solaar_$VERSION*
|
||||
/bin/cp --archive --backup=numbered --target-directory="$DIST_TARGET" ../solaar-*_$VERSION* || true
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
|
||||
set -e
|
||||
|
||||
export DEBSIGN_KEYID=07D8904B
|
||||
export DEBMAIL="daniel.pavel+launchpad@gmail.com"
|
||||
export DEBCHANGE_VENDOR=ubuntu
|
||||
export DISTRIBUTION=precise
|
||||
|
||||
export DISTRIBUTION=ubuntu
|
||||
export DIST_RELEASE=precise
|
||||
export DEBIAN_FILES_EXTRA="$PWD/packaging/ubuntu"
|
||||
export BUILD_EXTRA=ppa1
|
||||
export DEBFULLNAME='Daniel Pavel'
|
||||
export DEBEMAIL='daniel.pavel+launchpad@gmail.com'
|
||||
export DEBSIGN_KEYID=07D8904B
|
||||
|
||||
Z="$(readlink -f "$(dirname "$0")")"
|
||||
"$Z"/build_deb.sh -S
|
||||
"$Z"/build_deb.sh --rebuild "$@"
|
||||
|
||||
cd "$Z/../dist/ubuntu/"
|
||||
/usr/bin/dput --config="$Z/dput.cf" solaar-snapshots-ppa solaar_*_source.changes
|
||||
/usr/bin/dput --config="$Z/dput.cf" solaar-snapshots-ppa \
|
||||
"$Z/../dist/ubuntu"/solaar_*_source.changes
|
||||
|
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
set -e
|
||||
|
||||
Z="$(readlink -f "$(dirname "$0")")"
|
||||
"$Z"/build_deb.sh -S
|
||||
export DEBCHANGE_VENDOR=debian
|
||||
export DISTRIBUTION=unstable
|
||||
|
||||
cd "$Z/../dist/debian/"
|
||||
/usr/bin/dput --config="$Z/dput.cf" mentors solaar_*_source.changes
|
||||
export DEBFULLNAME='Daniel Pavel'
|
||||
export DEBEMAIL='daniel.pavel+debian@gmail.com'
|
||||
export DEBSIGN_KEYID=0B34B1A7
|
||||
|
||||
Z="$(readlink -f "$(dirname "$0")")"
|
||||
"$Z"/build_deb.sh --release "$@"
|
||||
|
||||
/usr/bin/dput --config="$Z/dput.cf" mentors \
|
||||
"$Z/../dist/debian"/solaar_*_source.changes
|
||||
|
|
Loading…
Reference in New Issue