From 715c554e8869353f570f29cf5b735f3f1151918b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 22 Dec 2010 14:19:21 +0100 Subject: [PATCH] Fix: The package was only uploaded if the target was "ubuntu". --- debian/changelog | 3 +- ubuntutools/sponsor_patch/main.py | 67 +++++++++++++++++-------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1a373db..4a7ef78 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,8 +29,9 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low - Default to a temporary workdir and clean it up (LP: #691467). - Fix 'str' object has no attribute 'startwith' crash caused by a typo. - Fix crash if uploading to ubuntu without building the package before. + - Fix: The package was only uploaded if the target was "ubuntu". - -- Benjamin Drung Wed, 22 Dec 2010 12:52:56 +0100 + -- Benjamin Drung Wed, 22 Dec 2010 13:38:36 +0100 ubuntu-dev-tools (0.108) experimental; urgency=low diff --git a/ubuntutools/sponsor_patch/main.py b/ubuntutools/sponsor_patch/main.py index af9c0e6..dbc6850 100644 --- a/ubuntutools/sponsor_patch/main.py +++ b/ubuntutools/sponsor_patch/main.py @@ -458,41 +458,46 @@ def main(bug_number, build, builder, edit, keyid, lpinstance, update, upload, # Upload package if upload: + print "Please check %s %s carefully:\nfile://%s\nfile://%s" % \ + (task.package, new_version, debdiff_filename, + lintian_filename) + if build_log: + print "\nfile://%s" % build_log if upload == "ubuntu": - print "Please check %s %s carefully:\nfile://%s\nfile://%s" % \ - (task.package, new_version, debdiff_filename, - lintian_filename) - if build_log: - print "\nfile://%s" % build_log - question = Question(["yes", "edit", "no"]) - answer = question.ask("Do you want to upload the package to " \ - "the official Ubuntu archive", "yes") - if answer == "edit": - continue - elif answer == "no": - user_abort() - cmd = ["dput", "--force", upload, changes_file] + target = "the official Ubuntu archive" + else: + target = upload + question = Question(["yes", "edit", "no"]) + answer = question.ask("Do you want to upload the package to %s" % \ + target, "yes") + if answer == "edit": + continue + elif answer == "no": + user_abort() + cmd = ["dput", "--force", upload, changes_file] + Logger.command(cmd) + if subprocess.call(cmd) != 0: + Logger.error("Upload of %s to %s failed." % \ + (os.path.basename(changes_file), upload)) + sys.exit(1) + + # Push the branch if the package is uploaded to the Ubuntu archive. + if upload == "ubuntu" and branch: + cmd = ['debcommit'] Logger.command(cmd) if subprocess.call(cmd) != 0: - Logger.error("Upload of %s to %s failed." % \ - (os.path.basename(changes_file), upload)) + Logger.error('Bzr commit failed.') + sys.exit(1) + cmd = ['bzr', 'mark-uploaded'] + Logger.command(cmd) + if subprocess.call(cmd) != 0: + Logger.error('Bzr tagging failed.') + sys.exit(1) + cmd = ['bzr', 'push', ':parent'] + Logger.command(cmd) + if subprocess.call(cmd) != 0: + Logger.error('Bzr push failed.') sys.exit(1) - if branch: - cmd = ['debcommit'] - Logger.command(cmd) - if subprocess.call(cmd) != 0: - Logger.error('Bzr commit failed.') - sys.exit(1) - cmd = ['bzr', 'mark-uploaded'] - Logger.command(cmd) - if subprocess.call(cmd) != 0: - Logger.error('Bzr tagging failed.') - sys.exit(1) - cmd = ['bzr', 'push', ':parent'] - Logger.command(cmd) - if subprocess.call(cmd) != 0: - Logger.error('Bzr push failed.') - sys.exit(1) # Leave while loop if everything worked break