From 82899a0f4548aa5bee595ccbee39920327a84b39 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Tue, 25 Aug 2009 13:02:57 +0200 Subject: [PATCH] bug fixes --- requestsync | 12 ++++++++---- ubuntutools/requestsync/common.py | 7 ++++++- ubuntutools/requestsync/lp.py | 12 ++++++------ ubuntutools/requestsync/mail.py | 7 +++++-- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/requestsync b/requestsync index 64a929e..19f7285 100755 --- a/requestsync +++ b/requestsync @@ -124,9 +124,13 @@ if __name__ == '__main__': newsource = True # Get the requested Debian source package - debian_srcpkg = getDebianSrcPkg(srcpkg, distro) - debian_version = Version(debian_srcpkg.getVersion()) - debian_component = debian_srcpkg.getComponent() + try: + debian_srcpkg = getDebianSrcPkg(srcpkg, distro) + debian_version = Version(debian_srcpkg.getVersion()) + debian_component = debian_srcpkg.getComponent() + except udtexceptions.PackageNotFoundException, e: + print >> sys.stderr, "E: %s" % e + sys.exit(1) # Debian and Ubuntu versions are the same - stop if ubuntu_version == debian_version: @@ -136,7 +140,7 @@ if __name__ == '__main__': # -s flag not specified - check if we do need sponsorship if not sponsorship: - sponsorship = needsSponsorship(srcpkg, ubuntu_component) + sponsorship = needSponsorship(srcpkg, ubuntu_component) # Check for existing package reports if not newsource: diff --git a/ubuntutools/requestsync/common.py b/ubuntutools/requestsync/common.py index 47096cd..2cb66b9 100644 --- a/ubuntutools/requestsync/common.py +++ b/ubuntutools/requestsync/common.py @@ -34,7 +34,7 @@ def raw_input_exit_on_ctrlc(*args, **kwargs): try: return raw_input(*args, **kwargs) except KeyboardInterrupt: - print 'Abort requested. No sync request filed.' + print '\nAbort requested. No sync request filed.' sys.exit(1) def getDebianChangelog(srcpkg, version): @@ -48,6 +48,9 @@ def getDebianChangelog(srcpkg, version): subdir = 'lib%s' % pkgname[3] else: subdir = pkgname[0] + # Strip epoch from version + if ':' in pkgversion: + pkgversion = pkgversion[pkgversion.find(':')+1:] # Get the debian changelog file from packages.debian.org try: @@ -113,6 +116,8 @@ def edit_report(subject, body, changes_required = False): print 'The report has not been changed, but you have to explain why ' \ 'the Ubuntu changes can be dropped.' raw_input_exit_on_ctrlc('Press [Enter] to retry or [Control-C] to abort. ') + else: + changes_required = False report_file.seek(0) report = report_file.read() diff --git a/ubuntutools/requestsync/lp.py b/ubuntutools/requestsync/lp.py index d002b5e..7e8f3b3 100644 --- a/ubuntutools/requestsync/lp.py +++ b/ubuntutools/requestsync/lp.py @@ -55,7 +55,7 @@ Your sync request shall require an approval by a member of the appropriate sponsorship team, who shall be subscribed to this bug report. This must be done before it can be processed by a member of the Ubuntu Archive team.''' - raw_input_exit_on_ctrlc('If the above is correct please press [Enter]: ') + raw_input_exit_on_ctrlc('If the above is correct please press [Enter] ') return need_sponsor @@ -73,10 +73,10 @@ def checkExistingReports(srcpkg): # Search bug list for other sync requests. for bug in pkgBugList: # check for Sync or sync and the package name - if 'ync %s' % package in bug.title: + if not bug.is_complete and 'ync %s' % srcpkg in bug.title: print 'The following bug could be a possible duplicate sync bug on Launchpad:' - print ' * Bug #%i: %s (%s)' % \ - (bug.id, bug.title, translate_api_web(bug.self_link)) + print ' * %s (%s)' % \ + (bug.title, translate_api_web(bug.self_link)) print 'Please check the above URL to verify this before continuing.' raw_input_exit_on_ctrlc('Press [Enter] to continue or [Ctrl-C] to abort. ') @@ -96,7 +96,7 @@ def postBug(srcpkg, subscribe, status, bugtitle, bugtext): bug_target = Distribution('ubuntu') # create bug - bug = Launchpad.bugs.createBug(title = bugtitle, description = bugtext, target = bug_target) + bug = Launchpad.bugs.createBug(title = bugtitle, description = bugtext, target = bug_target()) # newly created bugreports have only one task task = bug.bug_tasks[0] @@ -106,7 +106,7 @@ def postBug(srcpkg, subscribe, status, bugtitle, bugtext): task.status = status task.lp_save() - bug.subscribe(person = PersonTeam(subscribe)) + bug.subscribe(person = PersonTeam(subscribe)()) print 'Sync request filed as bug #%i: %s' % (bug.id, translate_api_web(bug.self_link)) diff --git a/ubuntutools/requestsync/mail.py b/ubuntutools/requestsync/mail.py index 3b7b87a..8e7d41a 100644 --- a/ubuntutools/requestsync/mail.py +++ b/ubuntutools/requestsync/mail.py @@ -31,6 +31,8 @@ __all__ = [ 'getDebianSrcPkg', 'getUbuntuSrcPkg', 'getEmailAddress', + 'needSponsorship', + 'checkExistingReports', 'mailBug', ] @@ -111,7 +113,7 @@ def needSponsorship(name, component): while True: print "Do you have upload permissions for the '%s' component " \ "or the package '%s'?" % (component, name) - val = raw_input_exit_on_ctrlc("If in doubt answer 'no'. [y/N]? ") + val = raw_input_exit_on_ctrlc("If in doubt answer 'n'. [y/N]? ") if val.lower() in ('y', 'yes'): return False elif val.lower() in ('n', 'no', ''): @@ -123,7 +125,8 @@ def checkExistingReports(srcpkg): ''' Point the user to the URL to manually check for duplicate bug reports. ''' - print 'Please check on https://bugs.launchpad.net/ubuntu/+source/%s/+bugs for duplicate sync requests before continuing.' + print 'Please check on https://bugs.launchpad.net/ubuntu/+source/%s/+bugs\n' \ + 'for duplicate sync requests before continuing.' % srcpkg raw_input_exit_on_ctrlc('Press [Enter] to continue or [Ctrl-C] to abort. ') def mailBug(srcpkg, subscribe, status, bugtitle, bugtext, keyid = None):