commit c738bfc8e7e3c1c50fd91956eb3b06aa0a97d9ba
parent f7972993f388425a375791c5fcb0e32ff3984129
Author: Kris Maglione <kris@suckless.org>
Date: Tue, 6 Jul 2010 21:23:15 -0400
[debian] Add util/genchangelog.
Diffstat:
3 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -20,10 +20,7 @@ deb-dep:
DISTRO = unstable
deb:
- if [ -d .hg ]; \
- then hg tip --template 'wmii-hg ($(VERSION)) $(DISTRO); urgency=low\n\n * {desc}\n\n -- {author} {date|rfc822date}\n'; \
- else awk 'BEGIN{"date"|getline; print "wmii-hg ($(VERSION)) $(DISTRO); urgency=low\n\n * Upstream build\n\n -- Kris Maglione <jg@suckless.org> "$$0"\n"}'; \
- fi >debian/changelog || true
+ $(ROOT)/util/genchangelog wmii-hg $(VERSION) $(DISTRO)
dpkg-buildpackage -rfakeroot -b -nc
[ -d .hg ] && hg revert debian/changelog || true
diff --git a/debian/changelog b/debian/changelog
@@ -1,4 +1,4 @@
-wmii-hg (hg2728) unstable; urgency=low
+wmii-hg (2728) unstable; urgency=low
* Remove long deprecated special treatment of the '!' tag.
diff --git a/util/genchangelog b/util/genchangelog
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -ef
+
+ifs="$(echo)"
+name=$1
+vers=$2
+dist=$3
+desc="Upstream build"
+auth="Kris Maglione <kris@suckless.org>"
+date=$(date +'%a, %d %b %Y %T %z')
+if hg root >/dev/null 2>&1; then
+ t() { hg log -r . --template "{$@}"; }
+ vers=$(t rev)
+ desc=$(t desc)
+ auth=$(t author)
+ date=$(t 'date|rfc822date')
+fi
+
+cat >debian/changelog.new <<!
+$name ($vers) $dist; urgency=low
+
+ * $desc
+
+ -- $auth $date
+
+$(cat debian/changelog)
+!
+
+mv debian/changelog.new debian/changelog
+