sapling/contrib/builddeb
Augie Fackler 26c3dd960f builddeb: use a + before latesttagdistance instead of -
This matches the behavior of Mercurial itself.
2015-09-14 12:34:45 -04:00

32 lines
993 B
Bash
Executable File

#!/bin/sh -eu
#
# Build a remotefilelog debian package from the current repo
if [ ! -d .hg ]; then
echo 'You are not at the repository root!' 1>&2
exit 1
fi
cp -r contrib/debian debian
trap "rm -r '$PWD/debian'" EXIT
version=$(hg log -r . -T'{latesttag}+{latesttagdistance}-{node|short}')
control=debian/control
changelog=debian/changelog
# This looks like sed -i, but sed -i behaves just differently enough
# between BSD and GNU sed that I gave up and did the dumb thing.
sed "s/__VERSION__/$version/" < $changelog > $changelog.tmp
date=$(date --rfc-2822)
sed "s/__DATE__/$date/" < $changelog.tmp > $changelog
rm $changelog.tmp
debuild -us -uc -b || exit 1
OUTPUTDIR=${OUTPUTDIR:=packages/debian-unknown}
mkdir -p $OUTPUTDIR
find ../remotefilelog*.deb ../remotefilelog_*.build \
../remotefilelog_*.changes -type f -newer $control -print0 | \
xargs -Inarf -0 mv narf "$OUTPUTDIR"
echo "Built packages for $version:"
find "$OUTPUTDIR" -type f -newer $control -name '*.deb'