tint2/packaging/make_ubuntu.sh

76 lines
1.7 KiB
Bash
Raw Normal View History

2016-02-14 18:08:22 +00:00
#!/bin/bash
2016-02-19 13:22:41 +00:00
set -e
2016-02-14 18:08:22 +00:00
set -x
2016-02-19 13:22:41 +00:00
rm -rf tint2* 2>/dev/null || true
2016-02-14 18:08:22 +00:00
if [ ! -z "$1" ]
then
MINOR="$1"
else
MINOR="1"
fi
# Get version (and check that the repository is clean)
2016-02-19 13:10:38 +00:00
VERSION=$(../get_version.sh --strict)
2016-02-14 18:08:22 +00:00
if [ ! $? -eq 0 ]
then
echo >&2 "Error: get_version.sh failed!"
exit 1
fi
rm -f version.h
2016-02-19 13:10:38 +00:00
VERSION=$(git describe --exact-match 2>/dev/null | sed 's/^v//')
if [ $? -eq 0 ]
then
REPO="tint2"
else
VERSION="$(git show -s --pretty=format:%cI.%ct.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g').$MINOR"
REPO="tint2-git"
fi
2016-02-14 18:08:22 +00:00
# Export repository contents to source directory
DIR=tint2-$VERSION
echo "Making release $DIR"
pushd .
cd ..
git checkout-index --prefix=packaging/$DIR/ -a
popd
# Update version file in source directory
rm -f $DIR/make_release.sh
echo "echo \"#define VERSION_STRING \\\"$VERSION\\\"\" > version.h" > $DIR/get_version.sh
# Copy the debian files into the source directory
cp -r ubuntu $DIR/debian
for DISTRO in precise trusty wily xenial
do
# Cleanup from previous builds
rm -rf tint2_$VERSION-*
# Update debian package changelog if necessary
echo -e "tint2 ($VERSION-$DISTRO-1) $DISTRO; urgency=medium\n\n$(git log --pretty=format:' * %h %an (%ci) %s %d')\n -- o9000 <mrovi9000@gmail.com> $(date -R)\n" > $DIR/debian/changelog
# Create source tarball
ARCHIVE=tint2_$VERSION-$DISTRO.orig.tar.gz
rm -rf $ARCHIVE
tar -czf $ARCHIVE $DIR
# Build package
KEY=$(gpg --list-secret-keys | awk '/^sec/ { print $2 }' | cut -d / -f 2)
pushd .
cd $DIR
debuild -S -k$KEY
popd
# Upload package
2016-02-19 13:10:38 +00:00
dput ppa:o9000/$REPO tint2_$VERSION-$DISTRO-1_source.changes
2016-02-14 18:08:22 +00:00
done
# Cleanup
rm -rf $DIR $ARCHIVE
rm -rf tint2_$VERSION-*