Merge ~ddstreet/ubuntu-dev-tools:cleanup into ubuntu-dev-tools:master
- Git
- lp:~ddstreet/ubuntu-dev-tools
- cleanup
- Merge into master
Proposed by
Dan Streetman
Status: | Merged |
---|---|
Merged at revision: | 13123c51c61b7237e51b1e7bda95dd3fc7700f68 |
Proposed branch: | ~ddstreet/ubuntu-dev-tools:cleanup |
Merge into: | ubuntu-dev-tools:master |
Diff against target: |
285 lines (+0/-55) 4 files modified
debian/control (+0/-1) debian/copyright (+0/-3) dev/null (+0/-50) setup.py (+0/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mattia Rizzolo | Approve | ||
Review via email: mp+412242@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Mattia Rizzolo (mapreri) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/control b/debian/control | |||
2 | index ff0ad61..3c03156 100644 | |||
3 | --- a/debian/control | |||
4 | +++ b/debian/control | |||
5 | @@ -90,7 +90,6 @@ Description: useful tools for Ubuntu developers | |||
6 | 90 | - dch-repeat - used to repeat a change log into an older release. | 90 | - dch-repeat - used to repeat a change log into an older release. |
7 | 91 | - grab-merge - grabs a merge from merges.ubuntu.com easily. | 91 | - grab-merge - grabs a merge from merges.ubuntu.com easily. |
8 | 92 | - grep-merges - search for pending merges from Debian. | 92 | - grep-merges - search for pending merges from Debian. |
9 | 93 | - hugdaylist - compile HugDay lists from bug list URLs. | ||
10 | 94 | - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad | 93 | - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad |
11 | 95 | - merge-changelog - manually merges two Debian changelogs with the same base | 94 | - merge-changelog - manually merges two Debian changelogs with the same base |
12 | 96 | version. | 95 | version. |
13 | diff --git a/debian/copyright b/debian/copyright | |||
14 | index 9db0196..42d84fc 100644 | |||
15 | --- a/debian/copyright | |||
16 | +++ b/debian/copyright | |||
17 | @@ -72,13 +72,11 @@ License: GPL-2+ | |||
18 | 72 | 72 | ||
19 | 73 | Files: doc/bitesize.1 | 73 | Files: doc/bitesize.1 |
20 | 74 | doc/grab-merge.1 | 74 | doc/grab-merge.1 |
21 | 75 | doc/hugdaylist.1 | ||
22 | 76 | doc/merge-changelog.1 | 75 | doc/merge-changelog.1 |
23 | 77 | doc/setup-packaging-environment.1 | 76 | doc/setup-packaging-environment.1 |
24 | 78 | doc/syncpackage.1 | 77 | doc/syncpackage.1 |
25 | 79 | bitesize | 78 | bitesize |
26 | 80 | grab-merge | 79 | grab-merge |
27 | 81 | hugdaylist | ||
28 | 82 | merge-changelog | 80 | merge-changelog |
29 | 83 | setup-packaging-environment | 81 | setup-packaging-environment |
30 | 84 | syncpackage | 82 | syncpackage |
31 | @@ -109,7 +107,6 @@ Files: dch-repeat | |||
32 | 109 | grep-merges | 107 | grep-merges |
33 | 110 | mk-sbuild | 108 | mk-sbuild |
34 | 111 | ubuntu-build | 109 | ubuntu-build |
35 | 112 | ubuntutools/lp/libsupport.py | ||
36 | 113 | ubuntutools/lp/lpapicache.py | 110 | ubuntutools/lp/lpapicache.py |
37 | 114 | ubuntutools/misc.py | 111 | ubuntutools/misc.py |
38 | 115 | Copyright: 2007-2010, Canonical Ltd. | 112 | Copyright: 2007-2010, Canonical Ltd. |
39 | diff --git a/doc/hugdaylist.1 b/doc/hugdaylist.1 | |||
40 | 116 | deleted file mode 100644 | 113 | deleted file mode 100644 |
41 | index 71d0b9a..0000000 | |||
42 | --- a/doc/hugdaylist.1 | |||
43 | +++ /dev/null | |||
44 | @@ -1,26 +0,0 @@ | |||
45 | 1 | .TH HUGDAYLIST "1" "August 27, 2008" "ubuntu-dev-tools" | ||
46 | 2 | |||
47 | 3 | .SH NAME | ||
48 | 4 | hugdaylist \- produce MoinMoin wiki formatted tables based on a Launchpad bug list | ||
49 | 5 | |||
50 | 6 | .SH SYNOPSIS | ||
51 | 7 | .B hugdaylist [\fB\-n\fP|\fB\-\-number <NUMBER>\fP] \fBlaunchpad-buglist-url\fP | ||
52 | 8 | |||
53 | 9 | .SH DESCRIPTION | ||
54 | 10 | \fBhugdaylist\fP produces MoinMoin wiki formatted tables based on a | ||
55 | 11 | Launchpad bug list | ||
56 | 12 | |||
57 | 13 | .SH OPTIONS | ||
58 | 14 | .TP | ||
59 | 15 | \fB\-\-number=<NUMBER>\fP | ||
60 | 16 | This option allows you to specify the number of entries to output. | ||
61 | 17 | .TP | ||
62 | 18 | \fBlaunchpad-buglist-url\fP | ||
63 | 19 | Required, this option is a URL pointing to a launchpad bug list. | ||
64 | 20 | |||
65 | 21 | .SH AUTHOR | ||
66 | 22 | \fBhugdaylist\fP has been written by Canonical Ltd., Daniel Holbach | ||
67 | 23 | <daniel.holbach@canonical.com> and Jonathan Patrick Davies <jpds@ubuntu.com>. | ||
68 | 24 | This manual page was written by Ryan Kavanagh <ryanakca@kubuntu.org>. | ||
69 | 25 | .PP | ||
70 | 26 | Both are released under the GNU General Public License, version 3. | ||
71 | diff --git a/hugdaylist b/hugdaylist | |||
72 | 27 | deleted file mode 100755 | 0 | deleted file mode 100755 |
73 | index ef33523..0000000 | |||
74 | --- a/hugdaylist | |||
75 | +++ /dev/null | |||
76 | @@ -1,141 +0,0 @@ | |||
77 | 1 | #!/usr/bin/python3 | ||
78 | 2 | # -*- coding: utf-8 -*- | ||
79 | 3 | # | ||
80 | 4 | # Copyright (C) 2007 Canonical Ltd., Daniel Holbach | ||
81 | 5 | # Copyright (C) 2008 Jonathan Patrick Davies <jpds@ubuntu.com> | ||
82 | 6 | # | ||
83 | 7 | # ################################################################## | ||
84 | 8 | # | ||
85 | 9 | # This program is free software; you can redistribute it and/or | ||
86 | 10 | # modify it under the terms of the GNU General Public License | ||
87 | 11 | # as published by the Free Software Foundation; version 3. | ||
88 | 12 | # | ||
89 | 13 | # This program is distributed in the hope that it will be useful, | ||
90 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
91 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
92 | 16 | # GNU General Public License for more details. | ||
93 | 17 | # | ||
94 | 18 | # See file /usr/share/common-licenses/GPL-3 for more details. | ||
95 | 19 | # | ||
96 | 20 | # ################################################################## | ||
97 | 21 | # | ||
98 | 22 | # | ||
99 | 23 | # hugdaylist - produces MoinMoin wiki formatted tables based on a Launchpad bug | ||
100 | 24 | # list. | ||
101 | 25 | # | ||
102 | 26 | # hugdaylist <url> | ||
103 | 27 | # - produces lists like https://wiki.ubuntu.com/UbuntuBugDay/20070912?action=raw | ||
104 | 28 | # | ||
105 | 29 | # hugdaylist -n <howmany> <url> | ||
106 | 30 | # - will only list <howmany> URLs. | ||
107 | 31 | |||
108 | 32 | import sys | ||
109 | 33 | from optparse import OptionParser | ||
110 | 34 | |||
111 | 35 | from launchpadlib.launchpad import Launchpad | ||
112 | 36 | |||
113 | 37 | from ubuntutools.lp.libsupport import translate_web_api | ||
114 | 38 | |||
115 | 39 | from ubuntutools import getLogger | ||
116 | 40 | Logger = getLogger() | ||
117 | 41 | |||
118 | 42 | |||
119 | 43 | def check_args(): | ||
120 | 44 | howmany = -1 | ||
121 | 45 | url = "" | ||
122 | 46 | |||
123 | 47 | # Our usage options. | ||
124 | 48 | usage = "usage: %prog [-n <number>] launchpad-buglist-url" | ||
125 | 49 | opt_parser = OptionParser(usage) | ||
126 | 50 | |||
127 | 51 | # Options - namely just the number of bugs to output. | ||
128 | 52 | opt_parser.add_option("-n", "--number", type="int", | ||
129 | 53 | dest="number", help="Number of entries to output.") | ||
130 | 54 | |||
131 | 55 | # Parse arguments. | ||
132 | 56 | (options, args) = opt_parser.parse_args() | ||
133 | 57 | |||
134 | 58 | # Check if we want a number other than the default. | ||
135 | 59 | howmany = options.number | ||
136 | 60 | |||
137 | 61 | # Check that we have an URL. | ||
138 | 62 | if not args: | ||
139 | 63 | Logger.error("An URL pointing to a Launchpad bug list is required.") | ||
140 | 64 | opt_parser.print_help() | ||
141 | 65 | sys.exit(1) | ||
142 | 66 | else: | ||
143 | 67 | url = args[0] | ||
144 | 68 | |||
145 | 69 | return (howmany, url) | ||
146 | 70 | |||
147 | 71 | |||
148 | 72 | def filter_unsolved(task): | ||
149 | 73 | # TODO: don't use this filter here, only check status and assignee of | ||
150 | 74 | # the given task | ||
151 | 75 | # Filter out special types of bugs: | ||
152 | 76 | # - https://wiki.ubuntu.com/Bugs/HowToTriage#Special%20types%20of%20bugs | ||
153 | 77 | # this is expensive, parse name out of self_link instead? | ||
154 | 78 | subscriptions = set(s.person.name for s in task.bug.subscriptions) | ||
155 | 79 | if (task.status != "Fix Committed" and | ||
156 | 80 | (not task.assignee or task.assignee.name in ['motu', 'desktop-bugs']) and | ||
157 | 81 | 'ubuntu-sponsors' not in subscriptions and | ||
158 | 82 | 'ubuntu-archive' not in subscriptions): | ||
159 | 83 | return True | ||
160 | 84 | return False | ||
161 | 85 | |||
162 | 86 | |||
163 | 87 | def main(): | ||
164 | 88 | (howmany, url) = check_args() | ||
165 | 89 | if len(url.split("?", 1)) == 2: | ||
166 | 90 | # search options not supported, because there is no mapping web ui | ||
167 | 91 | # options <-> API options | ||
168 | 92 | Logger.error("Options in url are not supported, url: %s" % url) | ||
169 | 93 | sys.exit(1) | ||
170 | 94 | |||
171 | 95 | launchpad = None | ||
172 | 96 | try: | ||
173 | 97 | launchpad = Launchpad.login_with("ubuntu-dev-tools", 'production') | ||
174 | 98 | except IOError as error: | ||
175 | 99 | Logger.exception(error) | ||
176 | 100 | sys.exit(1) | ||
177 | 101 | |||
178 | 102 | api_url = translate_web_api(url, launchpad) | ||
179 | 103 | try: | ||
180 | 104 | product = launchpad.load(api_url) | ||
181 | 105 | except Exception as error: | ||
182 | 106 | response = getattr(error, "response", {}) | ||
183 | 107 | if response.get("status", None) == "404": | ||
184 | 108 | Logger.error("The URL at '%s' does not appear to be a " | ||
185 | 109 | "valid url to a product" % url) | ||
186 | 110 | sys.exit(1) | ||
187 | 111 | else: | ||
188 | 112 | raise | ||
189 | 113 | |||
190 | 114 | bug_list = [b for b in product.searchTasks() if filter_unsolved(b)] | ||
191 | 115 | |||
192 | 116 | if not bug_list: | ||
193 | 117 | Logger.info("Bug list of %s is empty." % url) | ||
194 | 118 | sys.exit(0) | ||
195 | 119 | if howmany == -1: | ||
196 | 120 | howmany = len(bug_list) | ||
197 | 121 | |||
198 | 122 | Logger.info(""" | ||
199 | 123 | ## ||<rowbgcolor="#CCFFCC"> This task is done || somebody || || | ||
200 | 124 | ## ||<rowbgcolor="#FFFFCC"> This task is assigned || somebody || <status> || | ||
201 | 125 | ## ||<rowbgcolor="#FFEBBB"> This task isn't || ... || || | ||
202 | 126 | ## ||<rowbgcolor="#FFCCCC"> This task is blocked on something || somebody || <explanation> || | ||
203 | 127 | |||
204 | 128 | || Bug || Subject || Triager ||""") | ||
205 | 129 | |||
206 | 130 | for i in list(bug_list)[:howmany]: | ||
207 | 131 | bug = i.bug | ||
208 | 132 | Logger.info('||<rowbgcolor="#FFEBBB"> [%s %s] || %s || ||' % | ||
209 | 133 | (bug.web_link, bug.id, bug.title)) | ||
210 | 134 | |||
211 | 135 | |||
212 | 136 | if __name__ == '__main__': | ||
213 | 137 | try: | ||
214 | 138 | main() | ||
215 | 139 | except KeyboardInterrupt: | ||
216 | 140 | Logger.error("Aborted.") | ||
217 | 141 | sys.exit(1) | ||
218 | diff --git a/setup.py b/setup.py | |||
219 | index 59b00c2..dd6e76a 100755 | |||
220 | --- a/setup.py | |||
221 | +++ b/setup.py | |||
222 | @@ -21,7 +21,6 @@ scripts = [ | |||
223 | 21 | 'dch-repeat', | 21 | 'dch-repeat', |
224 | 22 | 'grab-merge', | 22 | 'grab-merge', |
225 | 23 | 'grep-merges', | 23 | 'grep-merges', |
226 | 24 | 'hugdaylist', | ||
227 | 25 | 'import-bug-from-debian', | 24 | 'import-bug-from-debian', |
228 | 26 | 'merge-changelog', | 25 | 'merge-changelog', |
229 | 27 | 'mk-sbuild', | 26 | 'mk-sbuild', |
230 | diff --git a/ubuntutools/lp/libsupport.py b/ubuntutools/lp/libsupport.py | |||
231 | 28 | deleted file mode 100644 | 27 | deleted file mode 100644 |
232 | index 24b1d3c..0000000 | |||
233 | --- a/ubuntutools/lp/libsupport.py | |||
234 | +++ /dev/null | |||
235 | @@ -1,50 +0,0 @@ | |||
236 | 1 | # | ||
237 | 2 | # libsupport.py - functions which add launchpadlib support to the Ubuntu | ||
238 | 3 | # Developer Tools package. | ||
239 | 4 | # | ||
240 | 5 | # Copyright (C) 2009 Markus Korn <thekorn@gmx.de> | ||
241 | 6 | # | ||
242 | 7 | # This program is free software; you can redistribute it and/or | ||
243 | 8 | # modify it under the terms of the GNU General Public License | ||
244 | 9 | # as published by the Free Software Foundation; either version 3 | ||
245 | 10 | # of the License, or (at your option) any later version. | ||
246 | 11 | # | ||
247 | 12 | # This program is distributed in the hope that it will be useful, | ||
248 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
249 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
250 | 15 | # GNU General Public License for more details. | ||
251 | 16 | # | ||
252 | 17 | # Please see the /usr/share/common-licenses/GPL file for the full text of | ||
253 | 18 | # the GNU General Public License license. | ||
254 | 19 | # | ||
255 | 20 | |||
256 | 21 | from urllib.parse import urlsplit, urlencode, urlunsplit | ||
257 | 22 | |||
258 | 23 | |||
259 | 24 | def query_to_dict(query_string): | ||
260 | 25 | result = dict() | ||
261 | 26 | options = filter(None, query_string.split("&")) | ||
262 | 27 | for opt in options: | ||
263 | 28 | key, value = opt.split("=") | ||
264 | 29 | result.setdefault(key, set()).add(value) | ||
265 | 30 | return result | ||
266 | 31 | |||
267 | 32 | |||
268 | 33 | def translate_web_api(url, launchpad): | ||
269 | 34 | scheme, netloc, path, query, fragment = urlsplit(url) | ||
270 | 35 | query = query_to_dict(query) | ||
271 | 36 | |||
272 | 37 | differences = set(netloc.split('.')).symmetric_difference( | ||
273 | 38 | set(launchpad._root_uri.host.split('.'))) | ||
274 | 39 | if ('staging' in differences or 'edge' in differences): | ||
275 | 40 | raise ValueError("url conflict (url: %s, root: %s" % | ||
276 | 41 | (url, launchpad._root_uri)) | ||
277 | 42 | if path.endswith("/+bugs"): | ||
278 | 43 | path = path[:-6] | ||
279 | 44 | if "ws.op" in query: | ||
280 | 45 | raise ValueError("Invalid web url, url: %s" % url) | ||
281 | 46 | query["ws.op"] = "searchTasks" | ||
282 | 47 | scheme, netloc, api_path, _, _ = urlsplit(str(launchpad._root_uri)) | ||
283 | 48 | query = urlencode(query) | ||
284 | 49 | url = urlunsplit((scheme, netloc, api_path + path.lstrip("/"), query, fragment)) | ||
285 | 50 | return url |