2012-10-02 12:13:36 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Upload packages to launchpad. Note: you must configure dput for tvh-X
|
|
|
|
# as target PPA, and you should also define DEBFULLNAME and DEBEMAIL
|
|
|
|
# environment variables
|
|
|
|
#
|
|
|
|
|
2012-10-23 12:03:15 +01:00
|
|
|
# Terminate
|
|
|
|
function die
|
|
|
|
{
|
2013-03-07 20:16:54 -07:00
|
|
|
echo >&2 "ERROR: $@"
|
2012-10-23 12:03:15 +01:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2012-10-04 14:37:16 +01:00
|
|
|
# CMD
|
2013-03-07 20:16:54 -07:00
|
|
|
CMD=$(basename "$0")
|
2013-03-27 09:45:24 +00:00
|
|
|
DIR=$(cd $(dirname "$0"); pwd)
|
2012-10-04 14:37:16 +01:00
|
|
|
|
2012-10-02 12:13:36 +01:00
|
|
|
# Configuration
|
2013-03-07 20:16:54 -07:00
|
|
|
TVH_ROOT=$(cd "$(dirname "$0")"/..; pwd)
|
2014-03-05 10:21:18 +00:00
|
|
|
[ -z "$TVH_DIST" ] && TVH_DIST="wheezy lucid precise quantal saucy trusty"
|
2012-10-04 14:37:16 +01:00
|
|
|
[ -z "$TVH_ARCH" ] && TVH_ARCH="i386 amd64"
|
2012-10-02 12:13:36 +01:00
|
|
|
|
|
|
|
# Options
|
|
|
|
[ ! -z "$1" ] && REL=$1 || REL=master
|
|
|
|
[ ! -z "$2" ] && PPA=$2 || PPA=unstable
|
|
|
|
|
|
|
|
# Setup
|
2013-03-07 20:16:54 -07:00
|
|
|
cd "$TVH_ROOT" || exit 1
|
2012-10-02 12:13:36 +01:00
|
|
|
NOW=`date -R`
|
2013-03-27 09:45:24 +00:00
|
|
|
CHANGELOG=./debian/changelog
|
|
|
|
VERFILE=./src/version.c
|
2012-10-02 12:13:36 +01:00
|
|
|
|
2012-12-30 12:12:24 +00:00
|
|
|
# Checkout
|
|
|
|
git checkout $REL || die "could not checkout $REL"
|
|
|
|
|
2013-03-27 09:45:24 +00:00
|
|
|
# Get version
|
|
|
|
VER=$("./support/version" $VERFILE)
|
|
|
|
|
|
|
|
# Export git tree
|
|
|
|
TMPDIR=/tmp/$CMD-$$
|
|
|
|
trap "rm -rf $TMPDIR" EXIT
|
|
|
|
mkdir -p "$TMPDIR"
|
|
|
|
git archive --prefix=tvheadend/ HEAD | tar -C "${TMPDIR}" -x ||\
|
|
|
|
die "failed to archive git tree"
|
|
|
|
cd "$TMPDIR/tvheadend" || die "failed to enter archived tree"
|
2012-10-02 12:13:36 +01:00
|
|
|
|
2013-03-27 09:45:24 +00:00
|
|
|
cd ..
|
2012-10-02 12:13:36 +01:00
|
|
|
|
|
|
|
# For each distro
|
|
|
|
for d in $TVH_DIST; do
|
|
|
|
V=${VER}~${d}
|
2013-03-27 09:45:24 +00:00
|
|
|
mv tvheadend "tvheadend-${V}"
|
|
|
|
cd "tvheadend-${V}"
|
2012-10-02 12:13:36 +01:00
|
|
|
|
|
|
|
# Create changelog
|
2013-03-27 09:45:24 +00:00
|
|
|
./support/changelog "$CHANGELOG" "$d" "$VER" || exit 1
|
2012-10-02 12:13:36 +01:00
|
|
|
|
|
|
|
# Build source package
|
|
|
|
dpkg-buildpackage -I.git* -S -sgpg -pgpg || exit 1
|
|
|
|
|
2012-10-04 14:37:16 +01:00
|
|
|
# Build
|
|
|
|
if [ "$CMD" == "pbuilder" ]; then
|
|
|
|
|
|
|
|
for a in $TVH_ARCH; do
|
|
|
|
pbuilder-dist $d $a ../tvheadend_${V}.dsc
|
|
|
|
done
|
|
|
|
|
2012-10-02 12:13:36 +01:00
|
|
|
# Upload
|
2012-10-04 14:37:16 +01:00
|
|
|
else
|
2013-03-27 09:45:24 +00:00
|
|
|
[ ! -f "$HOME/.dput.cf" ] && DPUT_OPT="$DPUT_OPT -c $DIR/dput.cf"
|
2012-10-23 12:03:15 +01:00
|
|
|
dput $DPUT_OPT tvh-${PPA} ../tvheadend_${V}_source.changes || exit 1
|
2012-10-04 14:37:16 +01:00
|
|
|
fi
|
|
|
|
|
2013-03-27 09:45:24 +00:00
|
|
|
# Rename back
|
|
|
|
cd ..
|
|
|
|
mv "tvheadend-${V}" tvheadend
|
2012-10-02 12:13:36 +01:00
|
|
|
done
|