mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Check upload rights before touching the bug (to save MOTU sponsors occasional embarrassment)
This commit is contained in:
parent
b23792c20f
commit
ba54fe6688
43
ack-sync
43
ack-sync
@ -32,6 +32,7 @@ from ubuntutools.lp.libsupport import get_launchpad
|
||||
COMMAND_LINE_SYNTAX_ERROR = 1
|
||||
VERSION_DETECTION_FAILED = 2
|
||||
PRIVATE_USER_EMAIL = 3
|
||||
UPLOAD_NOT_PERMITTED = 4
|
||||
|
||||
def get_version(title):
|
||||
m = re.search("[() ][0-9][0-9a-zA-Z.:+-~]*", title)
|
||||
@ -145,7 +146,8 @@ def main(bug_numbers, all_package, all_version, all_section, update,
|
||||
all_uploader_email, key, verbose=False, silent=False):
|
||||
launchpad = get_launchpad("ubuntu-dev-tools")
|
||||
# TODO: use release-info (once available)
|
||||
dist = launchpad.distributions["ubuntu"].current_series.name
|
||||
series = launchpad.distributions["ubuntu"].current_series
|
||||
dist = series.name
|
||||
|
||||
# update pbuilder
|
||||
if update:
|
||||
@ -177,22 +179,6 @@ def main(bug_numbers, all_package, all_version, all_section, update,
|
||||
|
||||
task = list(bug.bug_tasks)[0]
|
||||
|
||||
if task.assignee == None:
|
||||
task.assignee = launchpad.me
|
||||
print "assigned me"
|
||||
task.lp_save()
|
||||
if task.assignee != launchpad.me:
|
||||
print >> sys.stderr, "E: %s is already assigned to https://launchpad.net/bugs/%i" % \
|
||||
(task.assignee.display_name, bug.id)
|
||||
sys.exit(1)
|
||||
old_status = task.status
|
||||
task.status = 'In Progress'
|
||||
unsubscribe_sponsors(launchpad, bug)
|
||||
if task.importance == "Undecided":
|
||||
task.importance = "Wishlist"
|
||||
print "importance set to Wishlist"
|
||||
task.lp_save()
|
||||
|
||||
if all_package is not None:
|
||||
package = all_package
|
||||
else:
|
||||
@ -210,6 +196,29 @@ def main(bug_numbers, all_package, all_version, all_section, update,
|
||||
version = all_version
|
||||
else:
|
||||
version = get_version(bug.title)
|
||||
|
||||
if not series.main_archive.isSourceUploadAllowed(person=launchpad.me,
|
||||
sourcepackagename=package):
|
||||
print >> sys.stderr, ("E: Sorry, you are not allowed to "
|
||||
'upload package "%s" to %s.' % (package, dist))
|
||||
sys.exit(UPLOAD_NOT_PERMITTED)
|
||||
|
||||
if task.assignee == None:
|
||||
task.assignee = launchpad.me
|
||||
print "assigned me"
|
||||
task.lp_save()
|
||||
if task.assignee != launchpad.me:
|
||||
print >> sys.stderr, "E: %s is already assigned to https://launchpad.net/bugs/%i" % \
|
||||
(task.assignee.display_name, bug.id)
|
||||
sys.exit(1)
|
||||
old_status = task.status
|
||||
task.status = 'In Progress'
|
||||
unsubscribe_sponsors(launchpad, bug)
|
||||
if task.importance == "Undecided":
|
||||
task.importance = "Wishlist"
|
||||
print "importance set to Wishlist"
|
||||
task.lp_save()
|
||||
|
||||
print "package:", package
|
||||
print "version:", version
|
||||
dsc_file = get_source(package, version, all_section, dist,
|
||||
|
Loading…
x
Reference in New Issue
Block a user