From 6d3ee6dc650b672c91cf11a845f68ef9341f4c38 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 24 Jan 2010 12:09:14 +0000 Subject: [PATCH] When adding a new release, offer to mark the previous one as "stable" --- 0release.xml | 2 +- release.py | 14 ++++++++++++-- tests/testall.py | 2 +- tests/testdocs.py | 2 +- tests/testrelease.py | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/0release.xml b/0release.xml index 71d7f5d..2431fda 100644 --- a/0release.xml +++ b/0release.xml @@ -19,7 +19,7 @@ - + diff --git a/release.py b/release.py index 60cc595..53eb455 100644 --- a/release.py +++ b/release.py @@ -271,7 +271,7 @@ def do_release(local_iface, options): scm.delete_branch(TMP_BRANCH_NAME) os.unlink(support.release_status_file) print "Restored to state before starting release. Make your fixes and try again..." - + def accept_and_publish(archive_file, archive_name, src_feed_name): assert options.master_feed_file @@ -298,6 +298,7 @@ def do_release(local_iface, options): if status.updated_master_feed: print "Already added to master feed. Not changing." else: + publish_opts = {} if os.path.exists(options.master_feed_file): # Check we haven't already released this version master = model.Interface(os.path.realpath(options.master_feed_file)) @@ -306,6 +307,15 @@ def do_release(local_iface, options): if len(existing_releases): raise SafeException("Master feed %s already contains an implementation with version number %s!" % (options.master_feed_file, status.release_version)) + previous_release = get_previous_release(status.release_version) + previous_testing_releases = [impl for impl in master.implementations.values() if impl.get_version() == previous_release + and impl.upstream_stability == model.stability_levels["testing"]] + if previous_testing_releases: + print "The previous release, version %s, is still marked as 'testing'. Set to stable?" % previous_release + if support.get_choice(['Yes', 'No']) == 'Yes': + publish_opts['select_version'] = previous_release + publish_opts['set_stability'] = "stable" + # Merge the source and binary feeds together first, so # that we update the master feed atomically and only # have to sign it once. @@ -313,7 +323,7 @@ def do_release(local_iface, options): for b in compiler.get_binary_feeds(): support.publish('merged.xml', local = b) - support.publish(options.master_feed_file, local = 'merged.xml', xmlsign = True, key = options.key) + support.publish(options.master_feed_file, local = 'merged.xml', xmlsign = True, key = options.key, **publish_opts) os.unlink('merged.xml') status.updated_master_feed = 'true' diff --git a/tests/testall.py b/tests/testall.py index 7da6c30..9cb4bb3 100755 --- a/tests/testall.py +++ b/tests/testall.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.4 +#!/usr/bin/env python import unittest, os, sys try: import coverage diff --git a/tests/testdocs.py b/tests/testdocs.py index 5bc69f1..01dc3cb 100755 --- a/tests/testdocs.py +++ b/tests/testdocs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright (C) 2007, Thomas Leonard # See the README file for details, or visit http://0install.net. diff --git a/tests/testrelease.py b/tests/testrelease.py index d2bf416..157ef96 100755 --- a/tests/testrelease.py +++ b/tests/testrelease.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright (C) 2007, Thomas Leonard # See the README file for details, or visit http://0install.net. import sys, os, shutil, tempfile, subprocess @@ -54,7 +54,7 @@ class TestRelease(unittest.TestCase): assert child.returncode == 0 child = subprocess.Popen(['./make-release', '-k', 'Testing'], stdin = subprocess.PIPE) - unused, unused = child.communicate('\nP\n\n') + unused, unused = child.communicate('\nP\nY\n\n') assert child.returncode == 0 assert 'Prints "Hello World"' in file('0.1/changelog-0.1').read() -- 2.11.4.GIT