mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-08 23:41:28 +00:00
* requestsync:
- Use optparse instead of getopt for option parsing. - Skip existing bug report check if python-launchpad-bugs is not installed.
This commit is contained in:
parent
4f99bf5466
commit
ac26414459
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -4,6 +4,10 @@ ubuntu-dev-tools (0.51) UNRELEASED; urgency=low
|
|||||||
* buildd: Added checks for arch-indep packages and packages which have no
|
* buildd: Added checks for arch-indep packages and packages which have no
|
||||||
builds in a release.
|
builds in a release.
|
||||||
* hugdaylist: String improvements.
|
* hugdaylist: String improvements.
|
||||||
|
* requestsync:
|
||||||
|
- Use optparse instead of getopt for option parsing.
|
||||||
|
- Skip existing bug report check if python-launchpad-bugs is not
|
||||||
|
installed.
|
||||||
|
|
||||||
-- Jonathan Davies <jpds@ubuntu.com> Tue, 30 Dec 2008 15:51:55 +0000
|
-- Jonathan Davies <jpds@ubuntu.com> Tue, 30 Dec 2008 15:51:55 +0000
|
||||||
|
|
||||||
|
108
requestsync
108
requestsync
@ -25,7 +25,7 @@
|
|||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
import getopt
|
#import getopt
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -33,6 +33,8 @@ import urllib
|
|||||||
import urllib2
|
import urllib2
|
||||||
from debian_bundle.changelog import Version
|
from debian_bundle.changelog import Version
|
||||||
|
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
# Use functions from ubuntu-dev-tools to create Launchpad cookie file.
|
# Use functions from ubuntu-dev-tools to create Launchpad cookie file.
|
||||||
sys.path.append('/usr/share/ubuntu-dev-tools/')
|
sys.path.append('/usr/share/ubuntu-dev-tools/')
|
||||||
import common
|
import common
|
||||||
@ -76,6 +78,8 @@ def checkNeedsSponsorship(component):
|
|||||||
print "If the above is correct please press Enter, otherwise please " \
|
print "If the above is correct please press Enter, otherwise please " \
|
||||||
"press Ctrl-C to stop this script now\nand check the cookie file " \
|
"press Ctrl-C to stop this script now\nand check the cookie file " \
|
||||||
"at:", launchpad_cookiefile
|
"at:", launchpad_cookiefile
|
||||||
|
print "Logging into Launchpad, deleting the above and rerunning this " \
|
||||||
|
"script should be enough to generate the cookie."
|
||||||
raw_input_exit_on_ctrlc() # Abort if necessary.
|
raw_input_exit_on_ctrlc() # Abort if necessary.
|
||||||
return True # Sponsorship required.
|
return True # Sponsorship required.
|
||||||
|
|
||||||
@ -87,7 +91,15 @@ def checkExistingReports(package):
|
|||||||
|
|
||||||
If found ask for confirmation on filing a request.
|
If found ask for confirmation on filing a request.
|
||||||
"""
|
"""
|
||||||
import launchpadbugs.connector as Connector
|
try:
|
||||||
|
import launchpadbugs.connector as Connector
|
||||||
|
except:
|
||||||
|
print >> sys.stderr, "Unable to import launchpadbugs. Is " \
|
||||||
|
"python-launchpad-bugs installed?"
|
||||||
|
print >> sys.stderr, "Skipping existing report check, you should "\
|
||||||
|
"manually check at:"
|
||||||
|
print "- https://bugs.launchpad.net/ubuntu/+source/%s" % package
|
||||||
|
return
|
||||||
|
|
||||||
# Connect to the bug list.
|
# Connect to the bug list.
|
||||||
bugList = Connector.ConnectBugList()
|
bugList = Connector.ConnectBugList()
|
||||||
@ -211,23 +223,6 @@ def raw_input_exit_on_ctrlc(*args, **kwargs):
|
|||||||
print 'Abort requested. No sync request filed.'
|
print 'Abort requested. No sync request filed.'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def usage():
|
|
||||||
print '''Usage: requestsync [-d distro|-h|-n|-s|-k <keyid>|--lp] <source package> <target release> [basever]
|
|
||||||
|
|
||||||
In some cases, the base version (fork point from Debian) cannot be determined
|
|
||||||
automatically, and you'll get a complete Debian changelog. Specify the correct
|
|
||||||
base version of the package in Ubuntu.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-d distro Override Debian distribution to sync from [unstable].
|
|
||||||
-h Print this help.
|
|
||||||
-n New source package (doesn't exist yet in Ubuntu).
|
|
||||||
-s Specify that you require sponsorship.
|
|
||||||
-k <keyid> Sign email with <keyid> (only used when submitting per email).
|
|
||||||
--lp Use python-launchpad-bugs instead of email for bug submitting.
|
|
||||||
'''
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def get_email_address():
|
def get_email_address():
|
||||||
'''Get the DEBEMAIL environment variable or give an error.'''
|
'''Get the DEBEMAIL environment variable or give an error.'''
|
||||||
myemailaddr = os.getenv('DEBEMAIL')
|
myemailaddr = os.getenv('DEBEMAIL')
|
||||||
@ -446,52 +441,73 @@ def edit_report(subject, body, changes_required=False):
|
|||||||
#
|
#
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
newsource = False
|
# Our usage options.
|
||||||
sponsorship = False
|
usage = "Usage: %prog [-d distro] [-k keyid] [-n] [--lp] [-s] <source "
|
||||||
keyid = None
|
usage += "package> <target release> [base version]"
|
||||||
use_lp_bugs = False
|
optParser = OptionParser(usage)
|
||||||
need_interaction = False
|
|
||||||
distro = 'unstable'
|
|
||||||
|
|
||||||
try:
|
optParser.add_option("-d", type = "string",
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hsnd:k:', ('lp'))
|
dest = "dist", default = "unstable",
|
||||||
except getopt.GetoptError:
|
help = "Debian distribution to sync from.")
|
||||||
usage()
|
optParser.add_option("-k", type = "string",
|
||||||
for o, a in opts:
|
dest = "keyid", default = None,
|
||||||
if o == '-h': usage()
|
help = "GnuPG key ID to use for signing report.")
|
||||||
if o == '-n': newsource = True
|
optParser.add_option("-n", action = "store_true",
|
||||||
if o == '-k': keyid = a
|
dest = "newpkg", default = False,
|
||||||
if o == '-d': distro = a
|
help = "Whether package to sync is a new package in Ubuntu.")
|
||||||
if o == "-s": sponsorship = True
|
optParser.add_option("--lp", action = "store_true",
|
||||||
if o == '--lp': use_lp_bugs = True
|
dest = "lpbugs", default = False,
|
||||||
|
help = "Specify whether to use the launchpadbugs module for filing " \
|
||||||
|
"report.")
|
||||||
|
optParser.add_option("-s", action = "store_true",
|
||||||
|
dest = "sponsor", default = False,
|
||||||
|
help = "Force sponsorship requirement (shall be autodetected if not " \
|
||||||
|
"specified).")
|
||||||
|
|
||||||
|
(options, args) = optParser.parse_args()
|
||||||
|
|
||||||
|
newsource = options.newpkg
|
||||||
|
sponsorship = options.sponsor
|
||||||
|
keyid = options.keyid
|
||||||
|
use_lp_bugs = options.lpbugs
|
||||||
|
need_interaction = False
|
||||||
|
distro = options.dist
|
||||||
|
|
||||||
if len(args) not in (2, 3):
|
if len(args) not in (2, 3):
|
||||||
usage()
|
optParser.error("Source package / target release missing - please " \
|
||||||
|
"specify.")
|
||||||
|
|
||||||
if not use_lp_bugs and not get_email_address():
|
if not use_lp_bugs and not get_email_address():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
(srcpkg, release) = args[:2]
|
srcpkg = args[0]
|
||||||
|
release = args[1]
|
||||||
force_base_ver = None
|
force_base_ver = None
|
||||||
if len(args) == 3:
|
|
||||||
force_base_ver = args[2]
|
# Base version specified.
|
||||||
|
if len(args) == 3: force_base_ver = args[2]
|
||||||
|
|
||||||
(cur_ver, component) = ('0', 'universe') # Let's assume universe
|
(cur_ver, component) = ('0', 'universe') # Let's assume universe
|
||||||
if not newsource:
|
|
||||||
(cur_ver, component) = cur_version_component(srcpkg, release)
|
# Find Ubuntu release's package version.
|
||||||
|
if not newsource: (cur_ver, component) = cur_version_component(srcpkg, release)
|
||||||
|
|
||||||
debiancomponent = debian_component(srcpkg, distro)
|
debiancomponent = debian_component(srcpkg, distro)
|
||||||
|
# Find Debian release's package version.
|
||||||
deb_version = cur_deb_version(srcpkg, distro)
|
deb_version = cur_deb_version(srcpkg, distro)
|
||||||
|
|
||||||
# -s flag not specified - check if we do need sponsorship.
|
# Debian and Ubuntu versions are the same - stop.
|
||||||
if not sponsorship: sponsorship = checkNeedsSponsorship(component)
|
|
||||||
|
|
||||||
if deb_version == cur_ver:
|
if deb_version == cur_ver:
|
||||||
print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,)
|
print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# -s flag not specified - check if we do need sponsorship.
|
||||||
|
if not sponsorship: sponsorship = checkNeedsSponsorship(component)
|
||||||
|
|
||||||
|
# Check for existing package reports.
|
||||||
if not newsource: checkExistingReports(srcpkg)
|
if not newsource: checkExistingReports(srcpkg)
|
||||||
|
|
||||||
# generate bug report
|
# Generate bug report.
|
||||||
subscribe = 'ubuntu-archive'
|
subscribe = 'ubuntu-archive'
|
||||||
status = 'confirmed'
|
status = 'confirmed'
|
||||||
if sponsorship:
|
if sponsorship:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user