~launchpad-pqm/launchpad/devel

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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
Launchpad Celebrities
=====================

https://dev.launchpad.net/LaunchpadCelebrities

There are a number of special objects, some of which exist in the
database, which we want to give easy access to in the code. To this end,
there is an ILaunchpadCelebrities utility available that gives access to
these well-known objects through attributes.

    >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
    >>> from lp.services.worlddata.interfaces.language import ILanguageSet
    >>> from lp.registry.interfaces.person import IPerson, IPersonSet
    >>> celebs = getUtility(ILaunchpadCelebrities)

    >>> from canonical.launchpad.webapp.testing import verifyObject
    >>> verifyObject(ILaunchpadCelebrities, celebs)
    True


admin
-----

The 'admins' team contain the user who have super-power over all of
Launchpad. This team is accessible through the admin attribute.

    >>> personset = getUtility(IPersonSet)
    >>> admins = personset.getByName('admins')
    >>> celebs.admin == admins
    True


vcs-imports
-----------

The vcs-imports celebrity owns the branches created by importd.

    >>> vcs_imports = personset.getByName('vcs-imports')
    >>> celebs.vcs_imports == vcs_imports
    True


bazaar-experts
--------------

The bazaar-experts celebrity effectively has admin type privileges for
branches, and branch related objects.

    >>> bazaar_experts = personset.getByName('bazaar-experts')
    >>> celebs.bazaar_experts == bazaar_experts
    True


english
-------

The English language is used in many places.  It's the native language
for translation, as well as for Launchpad itself.

    >>> english = getUtility(ILanguageSet).getLanguageByCode('en')
    >>> english == celebs.english
    True


registry_experts
----------------

The registry_experts celebrity has permissions to perform registry
gardening operations.

    >>> registry = personset.getByName('registry')
    >>> celebs.registry_experts == registry
    True


buildd_admin
------------

The buildd_admin celebrity has permission to perform routine task in the
buildfarm.

    >>> buildd_admin = personset.getByName('launchpad-buildd-admins')
    >>> celebs.buildd_admin == buildd_admin
    True


bug_watch_updater
-----------------

The bug_watch_updater celebrity updates the bug watches.

    >>> bug_watch_updater = personset.getByName('bug-watch-updater')
    >>> celebs.bug_watch_updater == bug_watch_updater
    True


sourceforge_tracker
-------------------

For all the products using SourceForge, we have a single registered
tracker

    >>> from lp.bugs.interfaces.bugtracker import IBugTrackerSet
    >>> sf_tracker = getUtility(IBugTrackerSet).getByName('sf')
    >>> celebs.sourceforge_tracker == sf_tracker
    True


janitor
-------

We have the Launchpad Janitor which takes care of expiring old
questions, team memberships when they reach their expiry date, and old
incomplete bugtasks.

    >>> janitor = personset.getByName('janitor')
    >>> celebs.janitor == janitor
    True


launchpad
---------

The Launchpad product itself.

    >>> from lp.registry.interfaces.product import IProductSet
    >>> launchpad = getUtility(IProductSet).getByName('launchpad')
    >>> celebs.launchpad == launchpad
    True


obsolete_junk
-------------

The 'Obsolete Junk' project is used to hold undeletable objects like
productseries that other projects no longer want.

    >>> obsolete_junk = getUtility(IProductSet).getByName('obsolete-junk')
    >>> celebs.obsolete_junk == obsolete_junk
    True


commercial_admin
----------------

There is a 'Commercial Subscription Admins' team that has administrative
power over the license review process and has the ability to de-activate
projects.

    >>> commercial_admin = personset.getByName('commercial-admins')
    >>> celebs.commercial_admin == commercial_admin
    True


Savannah bug tracker
--------------------

There is a 'Savannah Bug Tracker' bugtracker which represents the bug
tracker for all registered Savannah projects.

    >>> from lp.bugs.interfaces.bugtracker import IBugTrackerSet
    >>> savannah_tracker = getUtility(IBugTrackerSet).getByName(
    ...     'savannah')
    >>> celebs.savannah_tracker == savannah_tracker
    True

The Savannah bug tracker also has a BugTrackerAlias with the URL
http://savannah.nognu.org/

    >>> for alias in celebs.savannah_tracker.aliases:
    ...     print alias
    http://savannah.nognu.org/


Gnome Bugzilla
--------------

There is a 'Gnome Bugzilla' celebrity, which is used to represent the
Gnome Bugzilla instance by the checkwatches script.

    >>> gnome_bugzilla = getUtility(IBugTrackerSet).getByName('gnome-bugs')
    >>> celebs.gnome_bugzilla == gnome_bugzilla
    True


PPA key guard
-------------

There is a 'PPA key guard' celebrity which owns all PPA 'signing_keys'.

    >>> ppa_key_guard = personset.getByName('ppa-key-guard')
    >>> celebs.ppa_key_guard == ppa_key_guard
    True


Ubuntu branches
---------------

There's a celebrity that is the only Person allowed to set the official
branch for a source package. It's called ubuntu-branches.

    >>> ubuntu_branches = personset.getByName('ubuntu-branches')
    >>> celebs.ubuntu_branches == ubuntu_branches
    True


Ubuntu security team
--------------------

There is a celebrity representing the 'ubuntu-security' team, which is
mainly used for granting special permissions on the ubuntu primary
archive.

    >>> ubuntu_security = personset.getByName('ubuntu-security')
    >>> celebs.ubuntu_security == ubuntu_security
    True


Ubuntu technical board
----------------------

There's a celebrity for the Ubuntu technical board, the 'techboard'
team. It's used for determining who is allowed to create new package
sets.

    >>> ubuntu_techboard = personset.getByName('techboard')
    >>> print ubuntu_techboard.name
    techboard

    >>> celebs.ubuntu_techboard == ubuntu_techboard
    True


Person celebrities
------------------

Each person celebrity has a corresponding "in_" attribute in
IPersonRoles, to check if a person has that role. If the attributes
differ, IPersonRoles needs to be synced to ILaunchpadCelebrities by
adding/removing the appropriate "in_" attribute(s).

    >>> from lp.registry.interfaces.role import IPersonRoles
    >>> def get_person_celebrity_names():
    ...     for name in ILaunchpadCelebrities.names():
    ...         if IPerson.providedBy(getattr(celebs, name)):
    ...             yield "in_" + name
    >>> def get_person_roles_names():
    ...     for name in IPersonRoles.names():
    ...         if name.startswith("in_"):
    ...             yield name

Treating the lists as sets and determining their difference gives us a
clear picture of what is missing where.

    >>> person_celebrity_names = set(get_person_celebrity_names())
    >>> person_roles_names = set(get_person_roles_names())
    >>> print "Please add to IPersonRoles: " + (
    ...       ", ".join(list(person_celebrity_names - person_roles_names)))
    Please add to IPersonRoles:

    >>> print "Please remove from IPersonRoles: " + (
    ...       ", ".join(list(person_roles_names - person_celebrity_names)))
    Please remove from IPersonRoles:


Detecting if a person is a celebrity
------------------------------------

We can ask if a person has celebrity status.

    >>> celebs.isCelebrityPerson(ubuntu_techboard.name)
    True

    >>> celebs.isCelebrityPerson(obsolete_junk.name)
    False

    >>> celebs.isCelebrityPerson('admins')
    True

    >>> celebs.isCelebrityPerson('admin')
    False

    >>> celebs.isCelebrityPerson('janitor')
    True