5
5
import getopt, re, sys
7
7
from launchpadlib.launchpad import Launchpad
8
from lazr.restfulclient import errors
9
10
print "Please install launchpadlib from lp:launchpadlib"
12
options, args = getopt.gnu_getopt(sys.argv, "l", ["launchpad"])
15
print "Please install hydrazine from lp:hydrazine"
19
options, args = getopt.gnu_getopt(sys.argv, "lw", ["launchpad", 'webbrowser'])
13
20
options = dict(options)
16
print "Usage: check-newsbugs [--launchpad] NEWS"
23
print ("Usage: check-newsbugs [--launchpad][--webbrowser] "
24
"doc/en/release-notes/bzr-x.y.txt")
18
26
print "--launchpad Print out Launchpad mail commands for closing bugs "
19
27
print " that are already fixed."
28
print "--webbrowser Open launchpad bug pages for bugs that are already "
23
33
def report_notmarked(bug, task, section):
25
35
print "Bug %d was mentioned in NEWS but is not marked fix released:" % (bug.id, )
26
36
print "Launchpad title: %s" % bug.title
27
37
print "NEWS summary: "
30
40
print " bug %d" % bug.id
31
41
print " affects %s" % task.bug_target_name
32
42
print " status fixreleased"
43
if "--webbrowser" in options or "-w" in options:
45
webbrowser.open('http://pad.lv/%s>' % (bug.id,))
35
48
def read_news_bugnos(path):
64
lp = Launchpad.login_anonymously('bzr-check-newsbugs', 'edge', version='1.0')
77
def print_bug_url(bugno):
78
print '<URL:http://pad.lv/%s>' % (bugno,)
80
launchpad = hydrazine.create_session()
66
81
bugnos = read_news_bugnos(args[1])
67
82
for bugno, section in bugnos:
84
bug = launchpad.bugs[bugno]
85
except errors.HTTPError, e:
86
if e.response.status == 401:
88
# Private, we can't access the bug content
89
print '%s is private and cannot be accessed' % (bugno,)
70
95
for task in bug.bug_tasks:
71
if task.bug_target_name == "bzr":
96
parts = task.bug_target_name.split('/')
102
distribution = parts[1]
73
if task.status != "Fix Released":
74
report_notmarked(bug, task, section)
105
if not fix_released and task.status == "Fix Released":
106
# We could check that the NEWS section and task_status are in
107
# sync, but that would be overkill. (case at hand: bug #416732)
76
112
print "Bug %d was mentioned in NEWS but is not marked as affecting bzr" % bugno
113
elif not fix_released:
115
report_notmarked(bug, task, section)