From 60b02995c7e703d25d7aa7d4bebcc9dd87018765 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 28 Nov 2007 21:49:32 +0000 Subject: [PATCH] Remember whether we already added the release to the master feed. --- release.py | 32 +++++++++++++++++++------------- support.py | 3 ++- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/release.py b/release.py index a1f502a..4e25dd6 100644 --- a/release.py +++ b/release.py @@ -160,14 +160,8 @@ def do_release(local_iface, options): if not options.archive_dir_public_url: raise SafeException("Archive directory public URL is not set! Edit configuration and try again.") - master = model.Interface(os.path.realpath(options.master_feed_file)) - reader.update(master, master.uri, local = True) - existing_releases = [impl for impl in master.implementations.values() if impl.get_version() == status.release_version] - if len(existing_releases): - raise SafeException("Master feed %s already contains an implementation with version number %s!" % (options.master_feed_file, status.release_version)) - if status.tagged: - print "Already tagged and added to master feed." + print "Already tagged in SCM. Not re-tagging." else: scm.ensure_committed() head = scm.get_head_revision() @@ -176,6 +170,22 @@ def do_release(local_iface, options): "HEAD was " + status.head_before_release + "\n" "HEAD now " + head) + scm.tag(status.release_version, status.head_at_release) + scm.reset_hard(TMP_BRANCH_NAME) + scm.delete_branch(TMP_BRANCH_NAME) + + status.tagged = 'true' + status.save() + + if status.updated_master_feed: + print "Already added to master feed. Not changing." + else: + master = model.Interface(os.path.realpath(options.master_feed_file)) + reader.update(master, master.uri, local = True) + existing_releases = [impl for impl in master.implementations.values() if impl.get_version() == status.release_version] + if len(existing_releases): + raise SafeException("Master feed %s already contains an implementation with version number %s!" % (options.master_feed_file, status.release_version)) + tar = tarfile.open(archive_file, 'r:bz2') stream = tar.extractfile(tar.getmember(archive_name + '/' + local_iface_rel_path)) remote_dl_iface = create_feed(stream, archive_file, archive_name) @@ -184,11 +194,7 @@ def do_release(local_iface, options): support.publish(options.master_feed_file, local = remote_dl_iface.name, xmlsign = True, key = options.key) remote_dl_iface.close() - scm.tag(status.release_version, status.head_at_release) - scm.reset_hard(TMP_BRANCH_NAME) - scm.delete_branch(TMP_BRANCH_NAME) - - status.tagged = 'true' + status.updated_master_feed = 'true' status.save() def is_uploaded(url, size): @@ -220,7 +226,7 @@ def do_release(local_iface, options): raw_input('Press Return once archive is uploaded.') print if is_uploaded(archive_url, archive_size): - print "OK, archive uploaded successfull" + print "OK, archive uploaded successfully" status.uploaded_archive = 'true' status.save() break diff --git a/support.py b/support.py index caab120..12dc27a 100644 --- a/support.py +++ b/support.py @@ -96,7 +96,8 @@ def show_diff(from_dir, to_dir): return class Status(object): - __slots__ = ['old_snapshot_version', 'release_version', 'head_before_release', 'new_snapshot_version', 'head_at_release', 'created_archive', 'tagged', 'uploaded_archive'] + __slots__ = ['old_snapshot_version', 'release_version', 'head_before_release', 'new_snapshot_version', + 'head_at_release', 'created_archive', 'tagged', 'uploaded_archive', 'updated_master_feed'] def __init__(self): for name in self.__slots__: setattr(self, name, None) -- 2.11.4.GIT