1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
Closing Bugs when Publishing Accepted Source
============================================
We have implemented 'premature publication of accepted sources' in
NascentUpload to increase the publishing throughput (see
launchpad/doc/nascentupload.txt).
Therefore we also use the available infrastructure to close bugs
mentioned in the source changelog (see close-bugs-from-changelog).
Starting a new series of package, upload and publish the first version
of 'bar' source package in ubuntu/hoary.
Publishing package and creating a bugtask
-----------------------------------------
>>> bar_src = getUploadForSource(
... 'suite/bar_1.0-1/bar_1.0-1_source.changes')
>>> bar_src.process()
>>> result = bar_src.do_accept()
>>> bar_src.queue_root.status.name
'NEW'
>>> bar_src.queue_root.setAccepted()
>>> pub_records = bar_src.queue_root.realiseUpload()
>>> from lp.services.database.sqlbase import commit
>>> commit()
Check the current status of the bug we are supposed to fix:
>>> the_bug_id = 6
>>> from lp.testing.layers import LaunchpadZopelessLayer
>>> from lp.bugs.interfaces.bug import IBugSet
>>> from lp.bugs.interfaces.bugtask import IBugTaskSet
>>> from lp.registry.interfaces.distribution import IDistributionSet
>>> from lp.registry.interfaces.person import IPersonSet
>>> login('no-priv@canonical.com')
>>> LaunchpadZopelessLayer.switchDbUser('launchpad')
>>> bugtask_owner = getUtility(IPersonSet).getByName('kinnison')
>>> ubuntu = getUtility(IDistributionSet)['ubuntu']
>>> ubuntu_bar = ubuntu.getSourcePackage('bar')
>>> the_bug = getUtility(IBugSet).get(the_bug_id)
>>> bugtask = getUtility(IBugTaskSet).createTask(
... the_bug, bugtask_owner, ubuntu_bar)
Inspect the current bugtasks for bug #6:
>>> for bugtask in the_bug.bugtasks:
... print bugtask.title
... print bugtask.status.name
Bug #6 in Mozilla Firefox: "Firefox crashes when ...
NEW
Bug #6 in bar (Ubuntu): "Firefox crashes when ...
NEW
Return to the original test environment:
>>> commit()
>>> from lp.services.config import config
>>> LaunchpadZopelessLayer.switchDbUser(config.uploader.dbuser)
>>> login('foo.bar@canonical.com')
Testing bug closing
-------------------
Once the base source is published every posterior version will be
automatically published in upload time as described in
nascentupload-publishing-accepted-sources.txt.
>>> bar2_src = getUploadForSource(
... 'suite/bar_1.0-2/bar_1.0-2_source.changes')
>>> bar2_src.process()
This new version fixes bug #6 according its changesfiles:
>>> bar2_src.changes.changed_by['person'].name
u'kinnison'
>>> bar2_src.changes._dict['Launchpad-bugs-fixed']
'6'
>>> print bar2_src.changes.changes_comment
bar (1.0-2) breezy; urgency=low
<BLANKLINE>
* A second upload to ensure that binary overrides of _all work
<BLANKLINE>
* Also closes Launchpad bug #6
<BLANKLINE>
<BLANKLINE>
Do the upload acceptance/publication and expect the bug mentioned to
be processed:
>>> result = bar2_src.do_accept()
>>> bar2_src.queue_root.status.name
'DONE'
Checking the results, the bugtask for 'bar (Ubuntu)' is updated to
FIXRELEASED and bug notification are generated:
>>> the_bug = getUtility(IBugSet).get(6)
>>> for bugtask in the_bug.bugtasks:
... print bugtask.title
... print bugtask.status.name
Bug #6 in Mozilla Firefox: "Firefox crashes when ...
NEW
Bug #6 in bar (Ubuntu): "Firefox crashes when ...
FIXRELEASED
>>> from lp.bugs.model.bugnotification import BugNotification
>>> notifications = BugNotification.selectBy(bug=the_bug, orderBy='id')
>>> for notification in notifications:
... print "From %s:\n%s\n" % (
... notification.message.owner.displayname,
... notification.message.text_contents)
From Launchpad Janitor:
** Changed in: bar (Ubuntu)
Status: New => Fix Released
<BLANKLINE>
From Launchpad Janitor:
This bug was fixed in the package bar - 1.0-2
<BLANKLINE>
---------------
bar (1.0-2) breezy; urgency=low
<BLANKLINE>
* A second upload to ensure that binary overrides of _all work
<BLANKLINE>
* Also closes Launchpad bug #6
<BLANKLINE>
<BLANKLINE>
-- Daniel Silverstone <daniel.silverstone@canonical.com> Thu, 30 Mar 2006 01:36:14 +0100
<BLANKLINE>
And clean up.
>>> import os
>>> from lp.archiveuploader.tests import datadir
>>> upload_data = datadir('suite/bar_1.0-2')
>>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))
|