From 806beacb5168071cb40d28cc2c9f8679abd4d11c Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Mon, 1 Sep 2008 22:29:32 +0100 Subject: [PATCH] * requestsync: Check for already existing sync requests before filing a new one. --- debian/changelog | 2 ++ get-branches | 5 ++++- requestsync | 31 ++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f9d9e93..65da4f6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ ubuntu-dev-tools (0.43ubuntu2) UNRELEASED; urgency=low - Wrapped Depends line and bumped debhelper build-dependency version to 6. * debian/compat: Changed to 6. * Moved https_proxy dropping code to common.py. + * requestsync: Check for already existing sync requests before filing a new + one. -- Colin Watson Mon, 01 Sep 2008 09:48:38 +0100 diff --git a/get-branches b/get-branches index 06204c0..5755c8f 100755 --- a/get-branches +++ b/get-branches @@ -138,4 +138,7 @@ def main(): sys.exit(0) if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + print "Operation was interrupted by user." diff --git a/requestsync b/requestsync index 3dcaf77..8db3805 100755 --- a/requestsync +++ b/requestsync @@ -73,7 +73,7 @@ def checkNeedsSponsorship(component): "the '%s'\nteam, who shall be subscribed to this bug report." % sponsor print "This must be done before it can be processed by a member of " \ "the Ubuntu Archive team." - print "Should the above be incorrect, please press Control-C now to " \ + print "Should the above be incorrect, please press Ctrl-C now to " \ "stop this script now\nand check the cookie file at:", launchpad_cookiefile raw_input_exit_on_ctrlc() # Abort if necessary. return True # Sponsorship required. @@ -81,6 +81,33 @@ def checkNeedsSponsorship(component): # Is a team member, no sponsorship required. return False +def checkExistingReports(package): + """ Check existing bug reports on Launchpad for a possible sync request. + + If found ask for confirmation on filing a request. + """ + import launchpadbugs.connector as Connector + + # Connect to the bug list. + bugList = Connector.ConnectBugList() + + # Fetch the package bug list from Launchpad. + pkgBugList = bugList("https://bugs.launchpad.net/ubuntu/+source/%s" % package) + + if len(pkgBugList) == 0: + return # No bugs found. + + for bug in pkgBugList: + # See if Please sync package is in the bug summary. + if ("Please sync %s" % package) in bug.summary: + print "A bug with the title: '%s' has been found on Launchpad." % bug.summary + print "Please see the following URL to verify this before filing a " \ + "duplicate report:" + print " -", bug.url + print "Press Ctrl-C to stop filing the bug report now, otherwise " \ + "please press enter." + raw_input_exit_on_ctrlc() + def cur_version_component(sourcepkg, release): '''Determine current package version in ubuntu.''' madison = subprocess.Popen(['rmadison', '-u', 'ubuntu', '-a', 'source', \ @@ -451,6 +478,8 @@ if __name__ == '__main__': print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,) sys.exit(1) + checkExistingReports(srcpkg) + # generate bug report subscribe = 'ubuntu-archive' status = 'confirmed'