simplified (again) the deb build script
This time also check for consistency of .orig archives.
This commit is contained in:
parent
1be56dd072
commit
ab8421b2f2
|
@ -3,12 +3,20 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if test "$DEBSIGN_KEYID"; then
|
if test "$DEBSIGN_KEYID"; then
|
||||||
|
# only build a source package, and sign it
|
||||||
|
DPKG_BUILPACKAGE_OPTS="-sa -S -k$DEBSIGN_KEYID"
|
||||||
|
BUILDER_ROLE='Uploaders'
|
||||||
test "$DEBEMAIL"
|
test "$DEBEMAIL"
|
||||||
test "$DEBFULLNAME"
|
test "$DEBFULLNAME"
|
||||||
|
DEBCHANGE_OPTIONS="$@"
|
||||||
else
|
else
|
||||||
|
# build an unsigned binary package
|
||||||
|
DPKG_BUILPACKAGE_OPTS="-b -us -uc"
|
||||||
|
BUILDER_ROLE='Changed-By'
|
||||||
export DEBFULLNAME="$(/usr/bin/getent passwd "$USER" | \
|
export DEBFULLNAME="$(/usr/bin/getent passwd "$USER" | \
|
||||||
/usr/bin/cut --delimiter=: --fields=5 | /usr/bin/cut --delimiter=, --fields=1)"
|
/usr/bin/cut --delimiter=: --fields=5 | /usr/bin/cut --delimiter=, --fields=1)"
|
||||||
export DEBEMAIL="${EMAIL:-$USER@$(/bin/hostname --long)}"
|
export DEBEMAIL="${EMAIL:-$USER@$(/bin/hostname --long)}"
|
||||||
|
DEBCHANGE_OPTIONS="--fromdirname"
|
||||||
fi
|
fi
|
||||||
export DEBMAIL="$DEBEMAIL"
|
export DEBMAIL="$DEBEMAIL"
|
||||||
|
|
||||||
|
@ -18,53 +26,71 @@ DISTRIBUTION=${DISTRIBUTION:-UNRELEASED}
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
DEBIAN_FILES="$PWD/packaging/debian"
|
DEBIAN_FILES="$PWD/packaging/debian"
|
||||||
DEBIAN_FILES_VENDOR="$PWD/packaging/$DEBCHANGE_VENDOR"
|
DEBIAN_FILES_VENDOR="$PWD/packaging/$DEBCHANGE_VENDOR"
|
||||||
DIST_TARGET="$PWD/dist/$DEBCHANGE_VENDOR"
|
DIST_DIR="$PWD/dist"
|
||||||
|
|
||||||
#
|
#
|
||||||
# build a python sdist package, then unpack and create .orig and source dir
|
# Build a python sdist package, then unpack and create .orig and source dir.
|
||||||
#
|
#
|
||||||
|
|
||||||
VERSION="$(python2.7 setup.py --version)"
|
P_NAME="$(python2.7 setup.py --name)"
|
||||||
FULLNAME="$(python2.7 setup.py --fullname)"
|
P_VERSION="$(python2.7 setup.py --version)"
|
||||||
|
SDIST_FILE="$DIST_DIR/$P_NAME-$P_VERSION.tar.gz"
|
||||||
|
ORIG_FILE="$DIST_DIR/${P_NAME}_${P_VERSION}.orig.tar.gz"
|
||||||
|
|
||||||
export TMPDIR="${TMPDIR:-/tmp}/debbuild-$FULLNAME-$USER"
|
BUILD_DIR="$DIST_DIR/$P_NAME-$P_VERSION"
|
||||||
BUILD_DIR="$TMPDIR/$DEBCHANGE_VENDOR-$DISTRIBUTION"
|
if test -d "$BUILD_DIR"; then
|
||||||
/bin/rm --force --recursive "$BUILD_DIR"
|
echo "*** $BUILD_DIR already exists, is it a leftover from previous builds? Aborting."
|
||||||
/bin/mkdir --parents --mode=0700 "$BUILD_DIR"
|
exit 1
|
||||||
python2.7 setup.py sdist --dist-dir="$BUILD_DIR" --formats=gztar --quiet
|
fi
|
||||||
|
|
||||||
ORIG_FILE="$BUILD_DIR/solaar_$VERSION.orig.tar.gz"
|
export TMPDIR="$(/bin/mktemp --directory --tmpdir debbuild-$P_NAME-$P_VERSION-$USER-XXXXXX)"
|
||||||
/bin/mv "$BUILD_DIR/$FULLNAME.tar.gz" "$ORIG_FILE"
|
|
||||||
/bin/tar --extract --gunzip --file "$ORIG_FILE" --directory "$BUILD_DIR"
|
|
||||||
|
|
||||||
cd "$BUILD_DIR/$FULLNAME"
|
python2.7 setup.py sdist --formats=gztar --quiet
|
||||||
unset BUILD_DIR VERSION FULLNAME ORIG_FILE
|
/bin/tar --extract --gunzip --file "$SDIST_FILE" --directory "$DIST_DIR"
|
||||||
|
test -d "$BUILD_DIR"
|
||||||
|
|
||||||
|
# If the orig file already exists for this version, check that no source
|
||||||
|
# changes occured.
|
||||||
|
if test -r "$ORIG_FILE"; then
|
||||||
|
ORIG_SOURCES="$TMPDIR/$P_NAME-$P_VERSION"
|
||||||
|
DIFF_OUTPUT="$TMPDIR/orig-diff-$P_VERSION"
|
||||||
|
/bin/tar --extract --gunzip --file "$ORIG_FILE" --directory "$TMPDIR"
|
||||||
|
/usr/bin/diff --recursive --minimal --unified \
|
||||||
|
"$ORIG_SOURCES" "$BUILD_DIR" >"$DIFF_OUTPUT" || true
|
||||||
|
# either way, the sdist archive is no longer useful
|
||||||
|
/bin/rm --force "$SDIST_FILE"
|
||||||
|
if test -s "$DIFF_OUTPUT"; then
|
||||||
|
/bin/rm --force --recursive "$BUILD_DIR"
|
||||||
|
echo '*** Current sbuild differs from existing .orig archive. Aborting.'
|
||||||
|
cat "$DIFF_OUTPUT"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
unset ORIG_SOURCES DIFF_OUTPUT
|
||||||
|
else
|
||||||
|
/bin/mv "$SDIST_FILE" "$ORIG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset P_NAME P_VERSION SDIST_FILE ORIG_FILE
|
||||||
|
|
||||||
#
|
#
|
||||||
# preparing to build the package
|
# preparing to build the package
|
||||||
#
|
#
|
||||||
|
|
||||||
|
cd "$BUILD_DIR"
|
||||||
|
|
||||||
/bin/cp --archive --target-directory=. "$DEBIAN_FILES"
|
/bin/cp --archive --target-directory=. "$DEBIAN_FILES"
|
||||||
|
|
||||||
if test "$DEBSIGN_KEYID"; then
|
/bin/sed --in-place --file=- debian/control <<-CONTROL
|
||||||
BUILDER_MAIL="$(echo "$DEBEMAIL" | /bin/sed --expression='s/+[a-z]*@/@/')"
|
/^Maintainer:/ a\
|
||||||
MAINT_MAIL="$(/bin/grep '^Maintainer: ' debian/control | /usr/bin/cut --delimiter=' ' --fields=2)"
|
$BUILDER_ROLE: $DEBFULLNAME <$DEBEMAIL>
|
||||||
echo "maintainer $MAINT_MAIL, builder $BUILDER_MAIL"
|
CONTROL
|
||||||
# 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
|
|
||||||
|
|
||||||
/usr/bin/debchange \
|
/usr/bin/debchange \
|
||||||
--vendor "$DEBCHANGE_VENDOR" \
|
--vendor "$DEBCHANGE_VENDOR" \
|
||||||
--distribution "$DISTRIBUTION" \
|
--distribution "$DISTRIBUTION" \
|
||||||
--force-save-on-release \
|
--force-save-on-release \
|
||||||
--auto-nmu \
|
--auto-nmu \
|
||||||
$@
|
$DEBCHANGE_OPTIONS
|
||||||
|
|
||||||
if test "$DEBCHANGE_VENDOR" = debian; then
|
if test "$DEBCHANGE_VENDOR" = debian; then
|
||||||
# if this is the main (Debian) build, update the source changelog
|
# if this is the main (Debian) build, update the source changelog
|
||||||
|
@ -74,23 +100,10 @@ else
|
||||||
/bin/cp --archive --target-directory=debian/ "$DEBIAN_FILES_VENDOR"/* || true
|
/bin/cp --archive --target-directory=debian/ "$DEBIAN_FILES_VENDOR"/* || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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 \
|
/usr/bin/debuild \
|
||||||
--lintian --tgz-check \
|
--lintian --tgz-check \
|
||||||
--preserve-envvar=DISPLAY \
|
--preserve-envvar=DISPLAY \
|
||||||
$DPKG_BUILPACKAGE_OPTS \
|
$DPKG_BUILPACKAGE_OPTS \
|
||||||
--lintian-opts --profile "$DEBCHANGE_VENDOR"
|
--lintian-opts --profile "$DEBCHANGE_VENDOR"
|
||||||
|
|
||||||
#
|
/bin/rm --force --recursive "$BUILD_DIR"
|
||||||
# place the resulting files in $DIST_TARGET
|
|
||||||
#
|
|
||||||
|
|
||||||
/bin/mkdir --parents "$DIST_TARGET"
|
|
||||||
/bin/cp --archive --backup=numbered --target-directory="$DIST_TARGET" ../solaar_$VERSION*
|
|
||||||
/bin/cp --archive --backup=numbered --target-directory="$DIST_TARGET" ../solaar-*_$VERSION* || true
|
|
||||||
|
|
Loading…
Reference in New Issue