requestbackport: Check for existing backport bugs first.

This commit is contained in:
Stefano Rivera 2011-11-22 23:48:30 +02:00
parent 70a035f13d
commit 7dfb6c3ed7
2 changed files with 30 additions and 1 deletions

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ ubuntu-dev-tools (0.136ubuntu1) UNRELEASED; urgency=low
* Remove dgetlp. No longer needed.
* Use httplib2 everywhere that we do https. The python stdlib doesn't do
certificate verification.
* requestbackport: Check for existing backport bugs first.
-- Stefano Rivera <stefanor@debian.org> Mon, 21 Nov 2011 09:47:00 +0200

View File

@ -16,6 +16,7 @@
from collections import defaultdict
import optparse
import re
import sys
import apt
@ -26,7 +27,8 @@ from ubuntutools.lp.lpapicache import Launchpad, Distribution
from ubuntutools.lp.udtexceptions import PackageNotFoundException
from ubuntutools.config import UDTConfig
from ubuntutools.rdepends import query_rdepends, RDependsException
from ubuntutools.question import YesNoQuestion, EditBugReport
from ubuntutools.question import (YesNoQuestion, EditBugReport,
confirmation_prompt)
class DestinationException(Exception):
@ -72,6 +74,30 @@ def determine_destinations(source, destination):
return destinations
def check_existing(package, destinations):
"""Search for possible existing bug reports"""
# The LP bug search is indexed, not substring:
query = re.findall(r'[a-z]+', package)
bugs = []
for release in destinations:
project = Launchpad.projects[release + '-backports']
bugs += project.searchTasks(omit_duplicates=True,
search_text=query,
status=["Incomplete", "New", "Confirmed",
"Triaged", "In Progress",
"Fix Committed"])
if not bugs:
return
Logger.normal("There are existing bug reports that look similar to your "
"request. Please check before continuing:")
for bug in sorted(set(bug_task.bug for bug_task in bugs)):
Logger.normal(" * LP: #%-7i: %s %s", bug.id, bug.title, bug.web_link)
confirmation_prompt()
def find_rdepends(releases, published_binaries):
intermediate = defaultdict(lambda: defaultdict(list))
@ -250,6 +276,8 @@ def main():
Logger.error(str(e))
sys.exit(1)
check_existing(package, destinations)
package_spph = locate_package(package, options.source)
request_backport(package_spph, options.source, destinations)