Kaydet (Commit) d4fd1c0c authored tarafından Michael Stahl's avatar Michael Stahl

get-bugzilla-attachments-by-mimetype: more launchpad fixes

- look at more interesting packages on lanuchpad, not just libreoffice.
- the searchTasks method by default does not return closed tasks,
  and there does not appear to be a documented wild card search,
  so stupidly enumerate all possible status.

Change-Id: I51691506874722a1d8eea4755513edf50164cf9d
üst bad960e6
...@@ -182,40 +182,41 @@ def get_launchpad_bugs(prefix): ...@@ -182,40 +182,41 @@ def get_launchpad_bugs(prefix):
ubuntu = launchpad.distributions["ubuntu"] ubuntu = launchpad.distributions["ubuntu"]
#since searching bugs having attachments with specific mimetypes is not available in launchpad API #since searching bugs having attachments with specific mimetypes is not available in launchpad API
#we're iterating over all bugs of the libreoffice source package #we're iterating over all bugs of the most interesting source packages
libo = ubuntu.getSourcePackage(name="libreoffice") for pkg in ["libreoffice", "openoffice.org", "abiword", "gnumeric", "koffice", "calligra"]:
libobugs = libo.searchTasks() srcpkg = ubuntu.getSourcePackage(name=pkg)
pkgbugs = srcpkg.searchTasks(status=["New", "Fix Committed", "Invalid", "Won't Fix", "Confirmed", "Triaged", "In Progress", "Incomplete", "Incomplete (with response)", "Incomplete (without response)", "Fix Released", "Opinion", "Expired"])
for bugtask in libobugs:
bug = bugtask.bug for bugtask in pkgbugs:
id = str(bug.id) bug = bugtask.bug
print("parsing " + id + " status: " + bugtask.status + " title: " + bug.title[:50]) id = str(bug.id)
attachmentid = 0 print("parsing " + id + " status: " + bugtask.status + " title: " + bug.title[:50])
for attachment in bug.attachments: attachmentid = 0
attachmentid += 1 for attachment in bug.attachments:
handle = attachment.data.open() attachmentid += 1
if not handle.content_type in mimetypes: handle = attachment.data.open()
#print "skipping" if not handle.content_type in mimetypes:
continue #print "skipping"
continue
suffix = mimetypes[handle.content_type]
if not os.path.isdir(suffix): suffix = mimetypes[handle.content_type]
try: if not os.path.isdir(suffix):
os.mkdir(suffix) try:
except: os.mkdir(suffix)
pass except:
pass
download = suffix + '/' + prefix + id + '-' + str(attachmentid) + '.' + suffix
download = suffix + '/' + prefix + id + '-' + str(attachmentid) + '.' + suffix
if os.path.isfile(download):
print("assuming " + id + " is up to date") if os.path.isfile(download):
break print("assuming " + id + " is up to date")
break
print('mimetype is ' + handle.content_type + ' downloading as ' + download) print('mimetype is ' + handle.content_type + ' downloading as ' + download)
f = open(download, "w") f = open(download, "w")
f.write(handle.read()) f.write(handle.read())
f.close() f.close()
freedesktop = 'http://bugs.freedesktop.org/buglist.cgi' freedesktop = 'http://bugs.freedesktop.org/buglist.cgi'
abisource = 'http://bugzilla.abisource.com/buglist.cgi' #added for abiword abisource = 'http://bugzilla.abisource.com/buglist.cgi' #added for abiword
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment