mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-07-01 10:01:29 +00:00
requestsync: make a "mail" and "lp" version of checkExistingReports and move
it to the correct module
This commit is contained in:
parent
e628bfbe34
commit
5448add754
50
requestsync
50
requestsync
@ -43,56 +43,6 @@ from ubuntutools.requestsync.mail import *
|
|||||||
from ubuntutools.requestsync.common import *
|
from ubuntutools.requestsync.common import *
|
||||||
from ubuntutools.requestsync.lp import postBug
|
from ubuntutools.requestsync.lp import postBug
|
||||||
|
|
||||||
def checkExistingReports(package):
|
|
||||||
""" Check existing bug reports on Launchpad for a possible sync request.
|
|
||||||
|
|
||||||
If found ask for confirmation on filing a request.
|
|
||||||
"""
|
|
||||||
|
|
||||||
launchpad = None
|
|
||||||
|
|
||||||
try:
|
|
||||||
launchpad = Launchpad.login()
|
|
||||||
except ImportError:
|
|
||||||
print >> sys.stderr, 'Importing launchpadlib failed. Is ' \
|
|
||||||
'python-launchpadlib installed?'
|
|
||||||
except IOError, msg:
|
|
||||||
# No credentials found.
|
|
||||||
print msg
|
|
||||||
|
|
||||||
# Failed to get Launchpad credentials.
|
|
||||||
if launchpad is None:
|
|
||||||
print >> sys.stderr, "Skipping existing report check, you should "\
|
|
||||||
"manually see if there are any at:"
|
|
||||||
print "- https://bugs.launchpad.net/ubuntu/+source/%s" % package
|
|
||||||
print ""
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Fetch the package's bug list from Launchpad.
|
|
||||||
pkg = Distribution('ubuntu').getSourcePackage(name=package)
|
|
||||||
pkgBugList = pkg.searchTasks()
|
|
||||||
|
|
||||||
# Search bug list for other sync requests.
|
|
||||||
matchingBugs = [bug for bug in pkgBugList
|
|
||||||
if "Sync %s" % package in bug.title
|
|
||||||
or "Please sync %s" % package in bug.title]
|
|
||||||
|
|
||||||
if len(matchingBugs) == 0:
|
|
||||||
return # No sync bugs found.
|
|
||||||
|
|
||||||
print "The following bugs could be possible duplicate sync bug(s) on Launchpad:"
|
|
||||||
|
|
||||||
for bug in matchingBugs:
|
|
||||||
print " *", bug.title
|
|
||||||
print " -", lp_libsupport.translate_api_web(bug.self_link)
|
|
||||||
|
|
||||||
print "Please check the above URLs to verify this before filing a " \
|
|
||||||
"possible duplicate report."
|
|
||||||
print "Press Ctrl-C to stop filing the bug report now, otherwise " \
|
|
||||||
"please press enter."
|
|
||||||
raw_input_exit_on_ctrlc()
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# entry point
|
# entry point
|
||||||
#
|
#
|
||||||
|
@ -59,6 +59,27 @@ team.'''
|
|||||||
|
|
||||||
return need_sponsor
|
return need_sponsor
|
||||||
|
|
||||||
|
def checkExistingReports(srcpkg):
|
||||||
|
'''
|
||||||
|
Check existing bug reports on Launchpad for a possible sync request.
|
||||||
|
|
||||||
|
If found ask for confirmation on filing a request.
|
||||||
|
'''
|
||||||
|
|
||||||
|
# Fetch the package's bug list from Launchpad
|
||||||
|
pkg = Distribution('ubuntu').getSourcePackage(name = srcpkg.getPackageName())
|
||||||
|
pkgBugList = pkg.getBugTasks()
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
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 'Please check the above URL to verify this before continuing.'
|
||||||
|
raw_input_exit_on_ctrlc('Press [Enter] to continue or [Ctrl-C] to abort. ')
|
||||||
|
|
||||||
def postBug(srcpkg, subscribe, status, bugtitle, bugtext):
|
def postBug(srcpkg, subscribe, status, bugtitle, bugtext):
|
||||||
'''
|
'''
|
||||||
Use the LP API to file the sync request.
|
Use the LP API to file the sync request.
|
||||||
|
@ -27,7 +27,12 @@ import socket
|
|||||||
from .common import raw_input_exit_on_ctrlc
|
from .common import raw_input_exit_on_ctrlc
|
||||||
from ..lp.udtexceptions import PackageNotFoundException
|
from ..lp.udtexceptions import PackageNotFoundException
|
||||||
|
|
||||||
__all__ = ['getDebianSrcPkg', 'getUbuntuSrcPkg']
|
__all__ = [
|
||||||
|
'getDebianSrcPkg',
|
||||||
|
'getUbuntuSrcPkg',
|
||||||
|
'getEmailAddress',
|
||||||
|
'postBug',
|
||||||
|
]
|
||||||
|
|
||||||
class SourcePackagePublishingHistory(object):
|
class SourcePackagePublishingHistory(object):
|
||||||
'''
|
'''
|
||||||
@ -114,6 +119,13 @@ def needSponsorship(name, component):
|
|||||||
else:
|
else:
|
||||||
print 'Invalid answer'
|
print 'Invalid answer'
|
||||||
|
|
||||||
|
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.'
|
||||||
|
raw_input_exit_on_ctrlc('Press [Enter] to continue or [Ctrl-C] to abort. ')
|
||||||
|
|
||||||
def mailBug(srcpkg, subscribe, status, bugtitle, bugtext, keyid = None):
|
def mailBug(srcpkg, subscribe, status, bugtitle, bugtext, keyid = None):
|
||||||
'''
|
'''
|
||||||
Submit the sync request per email.
|
Submit the sync request per email.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user