From 28cdec9c784aeff7e78e1eabe26a532bface6f88 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Tue, 3 Apr 2012 11:46:09 -0400 Subject: tools/telepathy.am: update to latest version from tp-glib Well... s/tar.gz/tar.bz2/g. We should fix this in upstream tp-glib tbh. Signed-off-by: Jonny Lamb --- tools/Makefile.am | 1 + tools/make-release-mail.py | 88 ++++++++++++++++++++++++++++++++++++++++++++++ tools/telepathy.am | 65 ++++++++++++++++++++++++++++++---- 3 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 tools/make-release-mail.py (limited to 'tools') diff --git a/tools/Makefile.am b/tools/Makefile.am index ab906a0..ee31d17 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -17,6 +17,7 @@ EXTRA_DIST = \ libglibcodegen.py \ libtpcodegen.py \ log-strip.py \ + make-release-mail.py \ specparser.py \ telepathy.am \ test-wrapper.sh \ diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py new file mode 100644 index 0000000..b03ebd2 --- /dev/null +++ b/tools/make-release-mail.py @@ -0,0 +1,88 @@ +#!/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 . I hope that you enjoy your stay. + +import sys +import re + +def looks_like_a_header(line, package, version=None): + if version is None: + pattern = "^%s .* \(.*\)$" % package + else: + pattern = "^%s %s \(.*\)$" % (package, version) + + return re.match(pattern, line) is not None + +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 looks_like_a_header(line, 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 looks_like_a_header(line, 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' +GIT_URL = 'http://cgit.freedesktop.org/telepathy' + +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 +git: %(git_url)s/%(package)s + +%(details)s""".strip().rstrip() % { + 'base_url': BASE_URL, + 'git_url': GIT_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 index 7f7794f..5e78dfd 100644 --- a/tools/telepathy.am +++ b/tools/telepathy.am @@ -1,17 +1,64 @@ ## Useful top-level Makefile.am snippets for Telepathy projects. -maintainer-sign-release: - gpg --detach-sign -a @PACKAGE@-@VERSION@.tar.bz2 +dist-hook: + chmod u+w ${distdir}/ChangeLog + if test -d ${top_srcdir}/.git; then \ + ( cd ${top_srcdir} && git log --date=iso $(CHANGELOG_RANGE) ) > ${distdir}/ChangeLog; \ + fi -maintainer-upload-release: _maintainer-upload-release +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 -_maintainer-upload-release-check: +_is-release-check: @case @VERSION@ in \ - (*.*.*.*) \ - echo "@VERSION@ is not a release" >&2; \ + (*.*.*.*|*+) \ + echo "Hey! @VERSION@ is not a release!" >&2; \ exit 2; \ ;; \ esac + @cd ${top_srcdir} && \ + if ! git diff --no-ext-diff --quiet --exit-code; then \ + echo "Hey! Your tree is dirty! No release for you." >&2; \ + exit 2; \ + fi + @cd ${top_srcdir} && \ + 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.bz2.asc: %.tar.bz2 + $(AM_V_GEN)gpg --detach-sign --armor $@ + +@PACKAGE@-@VERSION@.tar.bz2: _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.bz2 + +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.bz2 test -f @PACKAGE@-@VERSION@.tar.bz2.asc gpg --verify @PACKAGE@-@VERSION@.tar.bz2.asc @@ -20,4 +67,10 @@ _maintainer-upload-release: _maintainer-upload-release-check rsync -vzP @PACKAGE@-@VERSION@.tar.bz2 telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.bz2 rsync -vzP @PACKAGE@-@VERSION@.tar.bz2.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.bz2.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 ." + ## vim:set ft=automake: -- cgit v1.2.3