1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/bin/bash
# Prepare the build-dir for the debian package
# Prerequesite:
# make dist done by buildbot
# make dist will place a cp solarpowerlog-$VERSION.tar.gz in the builddir.
# Result:
# stagedir_debbuild contains untarred source and orig.tar.gz, debian dir integrated
# debian changelog contains buildbot information.
set -e
PWD=$(pwd)
VERSION=$(grep "PACKAGE_VERSION=" configure | cut -d"=" -f 2- | tr --delete "\'")
# copy orig.tar.gz into position
rm -rf stagedir_debbuild
mkdir -p stagedir_debbuild
mv solarpowerlog-$VERSION.tar.gz stagedir_debbuild/solarpowerlog_$VERSION.orig.tar.gz
# extract it
( cd stagedir_debbuild && tar xzf solarpowerlog_$VERSION.orig.tar.gz)
# copy debian dir
cp -r debian stagedir_debbuild/solarpowerlog-$VERSION
# record that we are autobuilding.
GIT_DESCRIBE=$(git describe)
cd stagedir_debbuild/solarpowerlog-$VERSION
DEB_VERSION=$(head -n1 debian/changelog | cut -d\( -f 2 | cut -d\) -f -1 | rev | cut -d- -f 2- | rev)
[[ "x$DEB_VERSION" == "x" ]] && ( echo "cannot determine existing debian version"; exit 1)
echo "DEB_VERSION = $DEB_VERSION"
if [[ "$DEB_VERSION" != "$VERSION" ]]
then
dch -M --newversion $VERSION-1 "New upstream version $VERSION"
dch -M -a "upstream git reference: $GIT_DESCRIBE"
else
dch -M -a "upstream git reference: $GIT_DESCRIBE"
fi
cd $PWD
|