Merge ~ddstreet/ubuntu-dev-tools:cleanup into ubuntu-dev-tools: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)
Reviewer Review Type Date Requested Status
Mattia Rizzolo Approve
Review via email: mp+412242@code.launchpad.net
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
diff --git a/debian/control b/debian/control
index ff0ad61..3c03156 100644
--- a/debian/control
+++ b/debian/control
@@ -90,7 +90,6 @@ Description: useful tools for Ubuntu developers
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.
91 - grab-merge - grabs a merge from merges.ubuntu.com easily.91 - grab-merge - grabs a merge from merges.ubuntu.com easily.
92 - grep-merges - search for pending merges from Debian.92 - grep-merges - search for pending merges from Debian.
93 - hugdaylist - compile HugDay lists from bug list URLs.
94 - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad93 - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad
95 - merge-changelog - manually merges two Debian changelogs with the same base94 - merge-changelog - manually merges two Debian changelogs with the same base
96 version.95 version.
diff --git a/debian/copyright b/debian/copyright
index 9db0196..42d84fc 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -72,13 +72,11 @@ License: GPL-2+
7272
73Files: doc/bitesize.173Files: doc/bitesize.1
74 doc/grab-merge.174 doc/grab-merge.1
75 doc/hugdaylist.1
76 doc/merge-changelog.175 doc/merge-changelog.1
77 doc/setup-packaging-environment.176 doc/setup-packaging-environment.1
78 doc/syncpackage.177 doc/syncpackage.1
79 bitesize78 bitesize
80 grab-merge79 grab-merge
81 hugdaylist
82 merge-changelog80 merge-changelog
83 setup-packaging-environment81 setup-packaging-environment
84 syncpackage82 syncpackage
@@ -109,7 +107,6 @@ Files: dch-repeat
109 grep-merges107 grep-merges
110 mk-sbuild108 mk-sbuild
111 ubuntu-build109 ubuntu-build
112 ubuntutools/lp/libsupport.py
113 ubuntutools/lp/lpapicache.py110 ubuntutools/lp/lpapicache.py
114 ubuntutools/misc.py111 ubuntutools/misc.py
115Copyright: 2007-2010, Canonical Ltd.112Copyright: 2007-2010, Canonical Ltd.
diff --git a/doc/hugdaylist.1 b/doc/hugdaylist.1
116deleted file mode 100644113deleted file mode 100644
index 71d0b9a..0000000
--- a/doc/hugdaylist.1
+++ /dev/null
@@ -1,26 +0,0 @@
1.TH HUGDAYLIST "1" "August 27, 2008" "ubuntu-dev-tools"
2
3.SH NAME
4hugdaylist \- produce MoinMoin wiki formatted tables based on a Launchpad bug list
5
6.SH SYNOPSIS
7.B hugdaylist [\fB\-n\fP|\fB\-\-number <NUMBER>\fP] \fBlaunchpad-buglist-url\fP
8
9.SH DESCRIPTION
10\fBhugdaylist\fP produces MoinMoin wiki formatted tables based on a
11Launchpad bug list
12
13.SH OPTIONS
14.TP
15\fB\-\-number=<NUMBER>\fP
16This option allows you to specify the number of entries to output.
17.TP
18\fBlaunchpad-buglist-url\fP
19Required, this option is a URL pointing to a launchpad bug list.
20
21.SH AUTHOR
22\fBhugdaylist\fP has been written by Canonical Ltd., Daniel Holbach
23<daniel.holbach@canonical.com> and Jonathan Patrick Davies <jpds@ubuntu.com>.
24This manual page was written by Ryan Kavanagh <ryanakca@kubuntu.org>.
25.PP
26Both are released under the GNU General Public License, version 3.
diff --git a/hugdaylist b/hugdaylist
27deleted file mode 1007550deleted file mode 100755
index ef33523..0000000
--- a/hugdaylist
+++ /dev/null
@@ -1,141 +0,0 @@
1#!/usr/bin/python3
2# -*- coding: utf-8 -*-
3#
4# Copyright (C) 2007 Canonical Ltd., Daniel Holbach
5# Copyright (C) 2008 Jonathan Patrick Davies <jpds@ubuntu.com>
6#
7# ##################################################################
8#
9# This program is free software; you can redistribute it and/or
10# modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation; version 3.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# See file /usr/share/common-licenses/GPL-3 for more details.
19#
20# ##################################################################
21#
22#
23# hugdaylist - produces MoinMoin wiki formatted tables based on a Launchpad bug
24# list.
25#
26# hugdaylist <url>
27# - produces lists like https://wiki.ubuntu.com/UbuntuBugDay/20070912?action=raw
28#
29# hugdaylist -n <howmany> <url>
30# - will only list <howmany> URLs.
31
32import sys
33from optparse import OptionParser
34
35from launchpadlib.launchpad import Launchpad
36
37from ubuntutools.lp.libsupport import translate_web_api
38
39from ubuntutools import getLogger
40Logger = getLogger()
41
42
43def check_args():
44 howmany = -1
45 url = ""
46
47 # Our usage options.
48 usage = "usage: %prog [-n <number>] launchpad-buglist-url"
49 opt_parser = OptionParser(usage)
50
51 # Options - namely just the number of bugs to output.
52 opt_parser.add_option("-n", "--number", type="int",
53 dest="number", help="Number of entries to output.")
54
55 # Parse arguments.
56 (options, args) = opt_parser.parse_args()
57
58 # Check if we want a number other than the default.
59 howmany = options.number
60
61 # Check that we have an URL.
62 if not args:
63 Logger.error("An URL pointing to a Launchpad bug list is required.")
64 opt_parser.print_help()
65 sys.exit(1)
66 else:
67 url = args[0]
68
69 return (howmany, url)
70
71
72def filter_unsolved(task):
73 # TODO: don't use this filter here, only check status and assignee of
74 # the given task
75 # Filter out special types of bugs:
76 # - https://wiki.ubuntu.com/Bugs/HowToTriage#Special%20types%20of%20bugs
77 # this is expensive, parse name out of self_link instead?
78 subscriptions = set(s.person.name for s in task.bug.subscriptions)
79 if (task.status != "Fix Committed" and
80 (not task.assignee or task.assignee.name in ['motu', 'desktop-bugs']) and
81 'ubuntu-sponsors' not in subscriptions and
82 'ubuntu-archive' not in subscriptions):
83 return True
84 return False
85
86
87def main():
88 (howmany, url) = check_args()
89 if len(url.split("?", 1)) == 2:
90 # search options not supported, because there is no mapping web ui
91 # options <-> API options
92 Logger.error("Options in url are not supported, url: %s" % url)
93 sys.exit(1)
94
95 launchpad = None
96 try:
97 launchpad = Launchpad.login_with("ubuntu-dev-tools", 'production')
98 except IOError as error:
99 Logger.exception(error)
100 sys.exit(1)
101
102 api_url = translate_web_api(url, launchpad)
103 try:
104 product = launchpad.load(api_url)
105 except Exception as error:
106 response = getattr(error, "response", {})
107 if response.get("status", None) == "404":
108 Logger.error("The URL at '%s' does not appear to be a "
109 "valid url to a product" % url)
110 sys.exit(1)
111 else:
112 raise
113
114 bug_list = [b for b in product.searchTasks() if filter_unsolved(b)]
115
116 if not bug_list:
117 Logger.info("Bug list of %s is empty." % url)
118 sys.exit(0)
119 if howmany == -1:
120 howmany = len(bug_list)
121
122 Logger.info("""
123## ||<rowbgcolor="#CCFFCC"> This task is done || somebody || ||
124## ||<rowbgcolor="#FFFFCC"> This task is assigned || somebody || <status> ||
125## ||<rowbgcolor="#FFEBBB"> This task isn't || ... || ||
126## ||<rowbgcolor="#FFCCCC"> This task is blocked on something || somebody || <explanation> ||
127
128|| Bug || Subject || Triager ||""")
129
130 for i in list(bug_list)[:howmany]:
131 bug = i.bug
132 Logger.info('||<rowbgcolor="#FFEBBB"> [%s %s] || %s || ||' %
133 (bug.web_link, bug.id, bug.title))
134
135
136if __name__ == '__main__':
137 try:
138 main()
139 except KeyboardInterrupt:
140 Logger.error("Aborted.")
141 sys.exit(1)
diff --git a/setup.py b/setup.py
index 59b00c2..dd6e76a 100755
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,6 @@ scripts = [
21 'dch-repeat',21 'dch-repeat',
22 'grab-merge',22 'grab-merge',
23 'grep-merges',23 'grep-merges',
24 'hugdaylist',
25 'import-bug-from-debian',24 'import-bug-from-debian',
26 'merge-changelog',25 'merge-changelog',
27 'mk-sbuild',26 'mk-sbuild',
diff --git a/ubuntutools/lp/libsupport.py b/ubuntutools/lp/libsupport.py
28deleted file mode 10064427deleted file mode 100644
index 24b1d3c..0000000
--- a/ubuntutools/lp/libsupport.py
+++ /dev/null
@@ -1,50 +0,0 @@
1#
2# libsupport.py - functions which add launchpadlib support to the Ubuntu
3# Developer Tools package.
4#
5# Copyright (C) 2009 Markus Korn <thekorn@gmx.de>
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 3
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# Please see the /usr/share/common-licenses/GPL file for the full text of
18# the GNU General Public License license.
19#
20
21from urllib.parse import urlsplit, urlencode, urlunsplit
22
23
24def query_to_dict(query_string):
25 result = dict()
26 options = filter(None, query_string.split("&"))
27 for opt in options:
28 key, value = opt.split("=")
29 result.setdefault(key, set()).add(value)
30 return result
31
32
33def translate_web_api(url, launchpad):
34 scheme, netloc, path, query, fragment = urlsplit(url)
35 query = query_to_dict(query)
36
37 differences = set(netloc.split('.')).symmetric_difference(
38 set(launchpad._root_uri.host.split('.')))
39 if ('staging' in differences or 'edge' in differences):
40 raise ValueError("url conflict (url: %s, root: %s" %
41 (url, launchpad._root_uri))
42 if path.endswith("/+bugs"):
43 path = path[:-6]
44 if "ws.op" in query:
45 raise ValueError("Invalid web url, url: %s" % url)
46 query["ws.op"] = "searchTasks"
47 scheme, netloc, api_path, _, _ = urlsplit(str(launchpad._root_uri))
48 query = urlencode(query)
49 url = urlunsplit((scheme, netloc, api_path + path.lstrip("/"), query, fragment))
50 return url

Subscribers

People subscribed via source and target branches