diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-11-11 13:44:36 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-11-11 16:42:22 +0100 |
commit | d4fd1c0c38179967166f64342d216e46d7f4d6d3 (patch) | |
tree | 8b208a3e702b03c39de865115b80ddb22ac56ced /bin/get-bugzilla-attachments-by-mimetype | |
parent | get-bugzilla-attachments-by-mimetype: better test for existing file (diff) | |
download | core-d4fd1c0c38179967166f64342d216e46d7f4d6d3.tar.gz core-d4fd1c0c38179967166f64342d216e46d7f4d6d3.zip |
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
Diffstat (limited to 'bin/get-bugzilla-attachments-by-mimetype')
-rwxr-xr-x | bin/get-bugzilla-attachments-by-mimetype | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/bin/get-bugzilla-attachments-by-mimetype b/bin/get-bugzilla-attachments-by-mimetype index 05a24e7cb26e..6655ea866770 100755 --- a/bin/get-bugzilla-attachments-by-mimetype +++ b/bin/get-bugzilla-attachments-by-mimetype @@ -182,40 +182,41 @@ def get_launchpad_bugs(prefix): ubuntu = launchpad.distributions["ubuntu"] #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 - libo = ubuntu.getSourcePackage(name="libreoffice") - libobugs = libo.searchTasks() - - for bugtask in libobugs: - bug = bugtask.bug - id = str(bug.id) - print("parsing " + id + " status: " + bugtask.status + " title: " + bug.title[:50]) - attachmentid = 0 - for attachment in bug.attachments: - attachmentid += 1 - handle = attachment.data.open() - if not handle.content_type in mimetypes: - #print "skipping" - continue - - suffix = mimetypes[handle.content_type] - if not os.path.isdir(suffix): - try: - os.mkdir(suffix) - except: - pass - - download = suffix + '/' + prefix + id + '-' + str(attachmentid) + '.' + suffix - - if os.path.isfile(download): - print("assuming " + id + " is up to date") - break + #we're iterating over all bugs of the most interesting source packages + for pkg in ["libreoffice", "openoffice.org", "abiword", "gnumeric", "koffice", "calligra"]: + 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 pkgbugs: + bug = bugtask.bug + id = str(bug.id) + print("parsing " + id + " status: " + bugtask.status + " title: " + bug.title[:50]) + attachmentid = 0 + for attachment in bug.attachments: + attachmentid += 1 + handle = attachment.data.open() + if not handle.content_type in mimetypes: + #print "skipping" + continue + + suffix = mimetypes[handle.content_type] + if not os.path.isdir(suffix): + try: + os.mkdir(suffix) + except: + pass + + download = suffix + '/' + prefix + id + '-' + str(attachmentid) + '.' + suffix + + if os.path.isfile(download): + 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.write(handle.read()) - f.close() + f = open(download, "w") + f.write(handle.read()) + f.close() freedesktop = 'http://bugs.freedesktop.org/buglist.cgi' abisource = 'http://bugzilla.abisource.com/buglist.cgi' #added for abiword |