summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-07-07 14:33:50 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-07-07 15:39:12 +0100
commit10287449e56eb7acb54572948b4ce9aaa0a0cd52 (patch)
treeccb4f292001c7cb0a6f325c26fabbfa799f17630 /tools
parent2cb08f95c385adaf10b5a4a9cfe127cfbfdf1ddc (diff)
downloadtelepathy-salut-10287449e56eb7acb54572948b4ce9aaa0a0cd52.tar.gz
Add and use telepathy.am and make-release-mail.py
This will let me use maintainer-make-release, and adds checks for things like UNRELEASED.
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/make-release-mail.py76
-rw-r--r--tools/telepathy.am74
3 files changed, 152 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e21cbed5..6292143b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -16,6 +16,8 @@ EXTRA_DIST = \
glib-signals-marshal-gen.py \
identity.xsl \
libglibcodegen.py \
+ make-release-mail.py \
+ telepathy.am \
xep.xsl
glib-client-marshaller-gen.py: libglibcodegen.py
diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py
new file mode 100644
index 00000000..2bd7c2bc
--- /dev/null
+++ b/tools/make-release-mail.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# vim: set fileencoding=utf-8 :
+#
+# Hello. This is make-release-mail.py from the Telepathy project. It's
+# designed to turn an item from a NEWS file into a mail suitable for sending
+# to <telepathy@lists.freedesktop.org>. I hope that you enjoy your stay.
+
+import sys
+
+def extract_description(package, version, news_path):
+ release_name = []
+ details = []
+
+ with open(news_path) as f:
+ lines = (line for line in f.readlines())
+ for line in lines:
+ # Find the 'telepathy-foo 0.1.2' header
+ if line.startswith("%s %s" % (package, version)):
+ break
+
+ # Skip the ====== line, and the first blank line
+ lines.next()
+ lines.next()
+
+ got_release_name = False
+
+ for line in lines:
+ line = line.rstrip()
+ # If we hit the next version header, we're done
+ if line.startswith(package):
+ break
+ # Else, if we hit a blank line and we're still reading the release
+ # name, we're done with the release name.
+ elif not got_release_name and line == '':
+ got_release_name = True
+ # Otherwise, append this to the relevant list
+ elif not got_release_name:
+ release_name.append(line)
+ else:
+ details.append(line)
+
+ assert got_release_name, (release_name, details)
+
+ # We rstrip details because it picks up a trailing blank line
+ return ('\n'.join(release_name), '\n'.join(details).rstrip())
+
+BASE_URL = 'http://telepathy.freedesktop.org/releases'
+
+def main(package, version, news_path):
+ release_name, details = extract_description(package, version, news_path)
+
+ print """
+%(release_name)s
+
+tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz
+signature: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz.asc
+
+%(details)s""".strip().rstrip() % {
+ 'base_url': BASE_URL,
+ 'package': package,
+ 'version': version,
+ 'release_name': release_name,
+ 'details': details,
+ }
+
+if __name__ == '__main__':
+ try:
+ package, version, news_path = sys.argv[1:]
+
+ main(package, version, news_path)
+ except ValueError, e:
+ sys.stderr.write(
+ 'Usage: %s package-name package.version.number path/to/NEWS\n' %
+ sys.argv[0])
+ sys.stderr.flush()
+ sys.exit(1)
diff --git a/tools/telepathy.am b/tools/telepathy.am
new file mode 100644
index 00000000..d080afe7
--- /dev/null
+++ b/tools/telepathy.am
@@ -0,0 +1,74 @@
+## Useful top-level Makefile.am snippets for Telepathy projects.
+
+dist-hook:
+ chmod u+w ${distdir}/ChangeLog
+ if test -d ${top_srcdir}/.git; then \
+ git log --date=iso $(CHANGELOG_RANGE) > ${distdir}/ChangeLog; \
+ fi
+
+distcheck-hook:
+ @test "z$(CHECK_FOR_UNRELEASED)" = z || \
+ case @VERSION@ in \
+ *.*.*.*|*+) ;; \
+ *) \
+ if grep -r UNRELEASED $(CHECK_FOR_UNRELEASED); \
+ then \
+ echo "^^^ This is meant to be a release, but some files say UNRELEASED" >&2; \
+ exit 2; \
+ fi \
+ ;; \
+ esac
+
+_is-release-check:
+ @case @VERSION@ in \
+ (*.*.*.*|*+) \
+ echo "Hey! @VERSION@ is not a release!" >&2; \
+ exit 2; \
+ ;; \
+ esac
+ @if ! git diff --no-ext-diff --quiet --exit-code; then \
+ echo "Hey! Your tree is dirty! No release for you." >&2; \
+ exit 2; \
+ fi
+ @if ! git diff --cached --no-ext-diff --quiet --exit-code; then \
+ echo "Hey! You have changes staged! No release for you." >&2; \
+ exit 2; \
+ fi
+if ENABLE_GTK_DOC
+else
+ @echo "Hey! You need to pass --enable-gtk-doc to configure!"
+ @exit 2;
+endif
+
+%.tar.gz.asc: %.tar.gz
+ $(AM_V_GEN)gpg --detach-sign --armor $@
+
+@PACKAGE@-@VERSION@.tar.gz: _is-release-check check distcheck
+
+maintainer-prepare-release: _is-release-check all distcheck release-mail
+ git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@
+ gpg --detach-sign --armor @PACKAGE@-@VERSION@.tar.gz
+
+release-mail: NEWS
+ $(AM_V_GEN)(python $(top_srcdir)/tools/make-release-mail.py \
+ @PACKAGE@ @VERSION@ $(top_srcdir)/NEWS > $@.tmp && \
+ mv $@.tmp $@)
+
+maintainer-upload-release: _maintainer-upload-release
+
+_maintainer-upload-release-check: _is-release-check
+ test -f @PACKAGE@-@VERSION@.tar.gz
+ test -f @PACKAGE@-@VERSION@.tar.gz.asc
+ gpg --verify @PACKAGE@-@VERSION@.tar.gz.asc
+
+_maintainer-upload-release: _maintainer-upload-release-check
+ rsync -vzP @PACKAGE@-@VERSION@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz
+ rsync -vzP @PACKAGE@-@VERSION@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz.asc
+
+maintainer-make-release: maintainer-prepare-release maintainer-upload-release
+ @echo "Now:"
+ @echo " • bump the nano-version;"
+ @echo " • push the branch and tags upstream; and"
+ @echo " • send release-mail to <telepathy@lists.freedesktop.org>."
+
+## vim:set ft=automake: