mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
ported massfile from launchpadbugs to launchpadlib
This commit is contained in:
parent
7b0977b0df
commit
9f2db19919
78
massfile
78
massfile
@ -27,12 +27,7 @@ import email
|
|||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
import launchpadbugs.connector as Connector
|
from common import get_launchpad, translate_api_web, translate_web_api
|
||||||
|
|
||||||
sys.path.append('/usr/share/ubuntu-dev-tools/')
|
|
||||||
import common
|
|
||||||
|
|
||||||
cookie = common.prepareLaunchpadCookie()
|
|
||||||
|
|
||||||
def read_config():
|
def read_config():
|
||||||
instructions_file = open("instructions")
|
instructions_file = open("instructions")
|
||||||
@ -57,10 +52,6 @@ def read_list():
|
|||||||
listfile.close()
|
listfile.close()
|
||||||
return pack_list
|
return pack_list
|
||||||
|
|
||||||
def file_bug():
|
|
||||||
Bug = Connector.ConnectBug()
|
|
||||||
Bug.authentication = cookie
|
|
||||||
|
|
||||||
def check_configfiles():
|
def check_configfiles():
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
@ -87,43 +78,62 @@ def check_configfiles():
|
|||||||
|
|
||||||
|
|
||||||
def file_bug(config):
|
def file_bug(config):
|
||||||
Bug = Connector.ConnectBug()
|
launchpad = get_launchpad("ubuntu-dev-tools")
|
||||||
|
|
||||||
Bug.authentication = cookie
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
summary = config["subject"].replace("$pack", config["sourcepackage"])
|
summary = config["subject"].replace("$pack", config["sourcepackage"])
|
||||||
description = config["text"].replace("$pack", config["sourcepackage"])
|
description = config["text"].replace("$pack", config["sourcepackage"])
|
||||||
|
|
||||||
bug = Bug.New(product={"name": config["sourcepackage"],
|
|
||||||
"target": "ubuntu"},
|
product_url = "%subuntu/+source/%s" %(launchpad._root_uri, config["sourcepackage"])
|
||||||
summary=summary,
|
tags = filter(None, map(lambda t: t.strip("\n").strip(), config["tags"].split(",")))
|
||||||
description=description)
|
bug = launchpad.bugs.createBug(description=description, title=summary,
|
||||||
print "Successfully filed bug %s: https://launchpad.net/bugs/%s" % \
|
target=product_url, tags=tags)
|
||||||
(bug.bugnumber, bug.bugnumber)
|
|
||||||
for sub in config["subscribers"].split(","):
|
print "Successfully filed bug %i: %s" %(bug.id, translate_api_web(bug.self_link))
|
||||||
if sub.strip("\n").strip():
|
|
||||||
bug.subscribers.add(sub.strip("\n").strip())
|
subscribers = filter(None, map(lambda t: t.strip("\n").strip(), config["subscribers"].split(",")))
|
||||||
for tag in config["tags"].split(","):
|
for sub in subscribers:
|
||||||
if tag.strip("\n").strip():
|
subscribe_url = "%s~%s" %(launchpad._root_uri, sub)
|
||||||
bug.tags.append(tag.strip("\n").strip())
|
bug.subscribe(person=subscribe_url)
|
||||||
bug.assignee = config["assignee"]
|
|
||||||
|
#newly created bugreports have one task
|
||||||
|
task = bug.bug_tasks[0]
|
||||||
|
|
||||||
if config["status"]:
|
if config["status"]:
|
||||||
bug.status = config["status"].capitalize()
|
status = config["status"].capitalize()
|
||||||
else:
|
else:
|
||||||
bug.status = "Confirmed"
|
status = "Confirmed"
|
||||||
bug.commit()
|
task.transitionToStatus(status=status)
|
||||||
|
|
||||||
|
assignee = config["assignee"]
|
||||||
|
if assignee:
|
||||||
|
assignee_url = "%s~%s" %(launchpad._root_uri, assignee)
|
||||||
|
bug.transitionToAssignee(assignee=assignee_url)
|
||||||
except:
|
except:
|
||||||
"Bug for '%s' was not filed." % config["sourcepackage"]
|
"Bug for '%s' was not filed." % config["sourcepackage"]
|
||||||
|
|
||||||
def read_buglist(url):
|
def read_buglist(url):
|
||||||
BugList = Connector.ConnectBugList()
|
if not url:
|
||||||
|
return set()
|
||||||
|
|
||||||
|
if len(url.split("?", 1)) == 2:
|
||||||
|
# search options not supported, because there is no mapping web ui options <-> API options
|
||||||
|
print >> sys.stderr, "Options in url are not supported, url: %s" %url
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
launchpad = get_launchpad("ubuntu-dev-tools")
|
||||||
packages = set()
|
packages = set()
|
||||||
|
|
||||||
if url:
|
api_url = translate_web_api(url, launchpad)
|
||||||
buglist = BugList(url)
|
# workaround LP #303414
|
||||||
for bug in buglist.bugs:
|
# if this is fixed it should simply be: buglist = launchpad.load(api_url)
|
||||||
packages.add(bug.sourcepackage)
|
api_url = api_url.split("?", 1)[0]
|
||||||
|
project = launchpad.load(api_url)
|
||||||
|
buglist = project.searchTasks()
|
||||||
|
|
||||||
|
for bug in buglist:
|
||||||
|
packages.add(bug.bug_target_name)
|
||||||
|
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user