From 2d882be5824ccc0b9d28e0516114c559dbb32352 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 22 Mar 2009 16:02:11 +0000 Subject: [PATCH] Put each release in its own sub-directory --- release.py | 21 ++++++++++++++++++--- support.py | 2 +- tests/testrelease.py | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/release.py b/release.py index a0d98a5..ffdd2fa 100644 --- a/release.py +++ b/release.py @@ -27,6 +27,9 @@ def run_unit_tests(local_feed, impl): raise SafeException("Self-test failed with exit status %d" % exitstatus) def do_release(local_iface, options): + assert options.master_feed_file + options.master_feed_file = os.path.abspath(options.master_feed_file) + status = support.Status() local_impl = support.get_singleton_impl(local_iface) @@ -91,6 +94,10 @@ def do_release(local_iface, options): print "Releasing version", release_version support.publish(local_iface.uri, set_released = 'today', set_version = release_version) + support.backup_if_exists(release_version) + os.mkdir(release_version) + os.chdir(release_version) + status.old_snapshot_version = local_impl.get_version() status.release_version = release_version status.head_at_release = scm.commit('Release %s' % release_version, branch = TMP_BRANCH_NAME, parent = 'HEAD') @@ -227,7 +234,7 @@ def do_release(local_iface, options): print "Archive already uploaded. Not uploading again." else: while True: - print "Upload %s as %s" % (archive_file, archive_url) + print "Upload %s/%s as %s" % (status.release_version, archive_file, archive_url) cmd = options.archive_upload_command.strip() if cmd: support.show_and_run(cmd, [archive_file]) @@ -281,6 +288,7 @@ def do_release(local_iface, options): ensure_ready_to_release() if status.release_version: + os.chdir(status.release_version) need_set_snapshot = False if status.tagged: print "Already tagged. Resuming the publishing process..." @@ -296,7 +304,7 @@ def do_release(local_iface, options): raise SafeException("Something went wrong previously when setting the new snapshot version.\n" + "Suggest you reset to the original HEAD of\n%s and delete '%s'." % (status.head_before_release, support.release_status_file)) else: - set_to_release() + set_to_release() # Changes directory assert status.release_version need_set_snapshot = True @@ -380,7 +388,14 @@ def do_release(local_iface, options): choice = support.get_choice(['Publish', 'Fail'] + maybe_diff) if choice == 'Diff': previous_archive_name = support.make_archive_name(local_iface.get_name(), previous_release) - previous_archive_file = previous_archive_name + '.tar.bz2' + previous_archive_file = '../%s/%s.tar.bz2' % (previous_release, previous_archive_name) + + # For archives created by older versions of 0release + if not os.path.isfile(previous_archive_file): + old_previous_archive_file = '../%s.tar.bz2' % previous_archive_name + if os.path.isfile(old_previous_archive_file): + previous_archive_file = old_previous_archive_file + if os.path.isfile(previous_archive_file): support.unpack_tarball(previous_archive_file) try: diff --git a/support.py b/support.py index 8144415..0ca0c1c 100644 --- a/support.py +++ b/support.py @@ -7,7 +7,7 @@ from zeroinstall import SafeException from zeroinstall.injector import model from logging import info -release_status_file = 'release-status' +release_status_file = os.path.abspath('release-status') def check_call(*args, **kwargs): exitstatus = subprocess.call(*args, **kwargs) diff --git a/tests/testrelease.py b/tests/testrelease.py index e45a55f..24e9af7 100755 --- a/tests/testrelease.py +++ b/tests/testrelease.py @@ -50,8 +50,8 @@ class TestRelease(unittest.TestCase): unused, unused = child.communicate('\nP\n\n') assert child.returncode == 0 - assert 'Prints "Hello World"' in file('changelog-0.1').read() - assert 'Prints "Hello World"' not in file('changelog-0.2').read() + assert 'Prints "Hello World"' in file('0.1/changelog-0.1').read() + assert 'Prints "Hello World"' not in file('0.2/changelog-0.2').read() def testUncommitted(self): support.check_call(['tar', 'xzf', test_repo_actions]) -- 2.11.4.GIT