Merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor into lp:launchpad

Proposed by Michael Nelson
Status: Merged
Approved by: Edwin Grubbs
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor
Merge into: lp:launchpad
Prerequisite: lp:~michael.nelson/launchpad/506203-ppa-privatisation-check
Diff against target: 586 lines (+143/-152)
3 files modified
lib/lp/archivepublisher/tests/publisher-config.txt (+9/-11)
lib/lp/soyuz/doc/archive.txt (+120/-128)
lib/lp/soyuz/doc/buildd-scoring.txt (+14/-13)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+19482@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

This is the first branch in a series to refactor soyuz tests after fixing bug 506203.

The MP for the prerequisite branch that fixes the actual bug is at:

https://code.edge.launchpad.net/~michael.nelson/launchpad/506203-ppa-privatisation-check/+merge/19415

The fix ensures that the privacy of a PPA cannot be altered once it has packages published. Unfortunately most of our test infrastructure does exactly that (switches the privacy to do a few tests and then switches it back).

The breakages are as follows:
http://pastebin.ubuntu.com/378292/

This branch fixes:

bin/test -vv -t doc/archive.txt -t publisher-config.txt -t buildd-scoring.txt

Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :
Download full text (4.8 KiB)

Hi Michael,

This is a nice improvement. Minor comments below.

merge-conditional

-Edwin

>=== modified file 'lib/lp/soyuz/doc/archive.txt'
>--- lib/lp/soyuz/doc/archive.txt 2010-01-26 11:34:26 +0000
>+++ lib/lp/soyuz/doc/archive.txt 2010-02-17 15:58:44 +0000
>@@ -102,10 +102,15 @@
> essentially the password to the archive for the builder.
>
> It can only be set by users with launchpad.Commercial permission in the
>-archive, i.e. an admin or a commercial admin.
>+archive, i.e. an admin or a commercial admin. We create a new PPA for
>+cprov here as changing privacy of a PPA is not allowed when sources have
>+already been published.
>
>+ >>> cprov_private_ppa = factory.makeArchive(
>+ ... owner=cprov, name='myprivateppa',
>+ ... distribution=cprov_archive.distribution)

Replace tab with spaces.

> >>> login(ANONYMOUS)
>- >>> cprov_archive.buildd_secret = 'boing'
>+ >>> cprov_private_ppa.buildd_secret = 'boing'
>
> Traceback (most recent call last):
> ...
> Unauthorized: (..., 'buildd_secret', 'launchpad.Commercial')
>@@ -1755,18 +1750,20 @@
> pmount 0.1-1 in warty PUBLISHED cprov
>
> Private source publications are excluded from this list, the fact that
>-they exist should never leak. If we make Celso's PPA private, its
>-contents will not be listed anymore. The same happens for uploaded
>-sources, since they are essentially another source publication in this
>-context.
>+they exist should never leak. If we copy the package to Celso's private
>+PPA the list is not updated. The same happens for uploaded sources, since they

Line too long.

>+are essentially another source publication in this context.
>
>- >>> naked_cprov_archive.private = True
>- >>> naked_cprov_archive.syncUpdate()
>+ >>> copy = cprov_cdrkit.copyTo(
>+ ... ubuntu['hoary'], PackagePublishingPocket.RELEASE,
>+ ... cprov_private_ppa)

Replace tab with spaces.

> >>> print_latest_uploads()
> cdrkit 1.0 in hoary PENDING mark
> iceweasel 1.0 in hoary PENDING mark
>+ cdrkit 1.0 in breezy-autotest SUPERSEDED cprov
> iceweasel 1.0 in breezy-autotest PUBLISHED mark
>+ pmount 0.1-1 in warty PUBLISHED cprov
>
> 'getMostActivePPAsForDistribution' returns a list of dictionaries
> containing up to 5 PPAs with the highest number of publications in the
>@@ -1808,14 +1805,13 @@
> ... a_pub.copyTo(
> ... ubuntu['hoary'], PackagePublishingPocket.RELEASE, where)
>
>- >>> create_activity(cprov_archive, 20)
>+ >>> create_activity(cprov_private_ppa, 20)
> >>> create_activity(sandbox_archive, 10)
> >>> create_activity(name12.archive, 4)
> >>> create_activity(no_priv.archive, 4)
> >>> create_activity(lp_buildd_team.archive, 8)
>
>-Celso's PPA is still private, so despite having the highest number of
>-uploads it's not listed.
>+Celso's private PPA is not listed despite having the highest number of uploads.

Line too long.

> >>> print_most_active_ppas()
> PPA for Foo Bar 10
>@@ -1824,13 +1820,11 @@
> PPA for Sample Person 4
> PPA for Mark Shuttleworth 2
>
>-When we make Celso's PPA public the result gets limited to 5 items.
>-The p...

Read more...

review: Approve (code)
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (5.8 KiB)

On Wed, Feb 17, 2010 at 6:39 PM, Edwin Grubbs
<email address hidden> wrote:
> Review: Approve code
> Hi Michael,
>
> This is a nice improvement. Minor comments below.
>
> merge-conditional
>
> -Edwin

Hi Edwin, it looks like you actually went through some of the
prerequisite branch changes too... thanks!

>
>
>>=== modified file 'lib/lp/soyuz/doc/archive.txt'
>>--- lib/lp/soyuz/doc/archive.txt       2010-01-26 11:34:26 +0000
>>+++ lib/lp/soyuz/doc/archive.txt       2010-02-17 15:58:44 +0000
>>@@ -102,10 +102,15 @@
>> essentially the password to the archive for the builder.
>>
>> It can only be set by users with launchpad.Commercial permission in the
>>-archive, i.e. an admin or a commercial admin.
>>+archive, i.e. an admin or a commercial admin. We create a new PPA for
>>+cprov here as changing privacy of a PPA is not allowed when sources have
>>+already been published.
>>
>>+    >>> cprov_private_ppa = factory.makeArchive(
>>+    ...     owner=cprov, name='myprivateppa',
>>+    ...           distribution=cprov_archive.distribution)
>
>
> Replace tab with spaces.

Sorry - switched editors recently, I've updated to automatically expand now.

>
>
>>     >>> login(ANONYMOUS)
>>-    >>> cprov_archive.buildd_secret = 'boing'
>>+    >>> cprov_private_ppa.buildd_secret = 'boing'
>>
>>     Traceback (most recent call last):
>>     ...
>>     Unauthorized: (..., 'buildd_secret', 'launchpad.Commercial')
>>@@ -1755,18 +1750,20 @@
>>     pmount 0.1-1 in warty PUBLISHED cprov
>>
>> Private source publications are excluded from this list, the fact that
>>-they exist should never leak. If we make Celso's PPA private, its
>>-contents will not be listed anymore. The same happens for uploaded
>>-sources, since they are essentially another source publication in this
>>-context.
>>+they exist should never leak. If we copy the package to Celso's private
>>+PPA the list is not updated.  The same happens for uploaded sources, since they
>
>
> Line too long.

... and to highlight from 78 rather than 79.

>
>
>>+are essentially another source publication in this context.
>>
>>-    >>> naked_cprov_archive.private = True
>>-    >>> naked_cprov_archive.syncUpdate()
>>+    >>> copy = cprov_cdrkit.copyTo(
>>+    ...      ubuntu['hoary'], PackagePublishingPocket.RELEASE,
>>+    ...            cprov_private_ppa)
>
>
> Replace tab with spaces.

Done

>
>
>>     >>> print_latest_uploads()
>>     cdrkit 1.0 in hoary PENDING mark
>>     iceweasel 1.0 in hoary PENDING mark
>>+    cdrkit 1.0 in breezy-autotest SUPERSEDED cprov
>>     iceweasel 1.0 in breezy-autotest PUBLISHED mark
>>+    pmount 0.1-1 in warty PUBLISHED cprov
>>
>> 'getMostActivePPAsForDistribution' returns a list of dictionaries
>> containing up to 5 PPAs with the highest number of publications in the
>>@@ -1808,14 +1805,13 @@
>>     ...         a_pub.copyTo(
>>     ...             ubuntu['hoary'], PackagePublishingPocket.RELEASE, where)
>>
>>-    >>> create_activity(cprov_archive, 20)
>>+    >>> create_activity(cprov_private_ppa, 20)
>>     >>> create_activity(sandbox_archive, 10)
>>     >>> create_activity(name12.archive, 4)
>>     >>> create_activity(no_priv.archive, 4)
>>     >>> create_activity(lp_buil...

Read more...

1=== modified file 'lib/lp/soyuz/doc/archive.txt'
2--- lib/lp/soyuz/doc/archive.txt 2010-02-17 12:38:26 +0000
3+++ lib/lp/soyuz/doc/archive.txt 2010-02-19 09:43:08 +0000
4@@ -108,7 +108,7 @@
5
6 >>> cprov_private_ppa = factory.makeArchive(
7 ... owner=cprov, name='myprivateppa',
8- ... distribution=cprov_archive.distribution)
9+ ... distribution=cprov_archive.distribution)
10 >>> login(ANONYMOUS)
11 >>> cprov_private_ppa.buildd_secret = 'boing'
12 Traceback (most recent call last):
13@@ -1751,12 +1751,12 @@
14
15 Private source publications are excluded from this list, the fact that
16 they exist should never leak. If we copy the package to Celso's private
17-PPA the list is not updated. The same happens for uploaded sources, since they
18-are essentially another source publication in this context.
19+PPA the list is not updated. The same happens for uploaded sources, since
20+they are essentially another source publication in this context.
21
22 >>> copy = cprov_cdrkit.copyTo(
23- ... ubuntu['hoary'], PackagePublishingPocket.RELEASE,
24- ... cprov_private_ppa)
25+ ... ubuntu['hoary'], PackagePublishingPocket.RELEASE,
26+ ... cprov_private_ppa)
27
28 >>> print_latest_uploads()
29 cdrkit 1.0 in hoary PENDING mark
30@@ -1811,7 +1811,8 @@
31 >>> create_activity(no_priv.archive, 4)
32 >>> create_activity(lp_buildd_team.archive, 8)
33
34-Celso's private PPA is not listed despite having the highest number of uploads.
35+Celso's private PPA is not listed despite having the highest number of
36+uploads.
37
38 >>> print_most_active_ppas()
39 PPA for Foo Bar 10
40@@ -1821,7 +1822,7 @@
41 PPA for Mark Shuttleworth 2
42
43 If we give lots of activity to Celso's public PPA the previous
44-las titem (Mark's PPA) will now be excluded as the results are
45+last item (Mark's PPA) will now be excluded as the results are
46 limited to 5 items.
47
48 >>> create_activity(cprov_archive, 20)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/tests/publisher-config.txt'
2--- lib/lp/archivepublisher/tests/publisher-config.txt 2010-02-25 12:28:30 +0000
3+++ lib/lp/archivepublisher/tests/publisher-config.txt 2010-02-26 15:30:40 +0000
4@@ -112,9 +112,12 @@
5 ... config.personalpackagearchive.root)
6 True
7
8- >>> cprov_archive.private = True
9- >>> cprov_archive.buildd_secret = "secret"
10- >>> p3a_config = getPubConfig(cprov_archive)
11+ >>> cprov_private_ppa = factory.makeArchive(
12+ ... owner=cprov, name='myprivateppa',
13+ ... distribution=cprov_archive.distribution)
14+ >>> cprov_private_ppa.private = True
15+ >>> cprov_private_ppa.buildd_secret = "secret"
16+ >>> p3a_config = getPubConfig(cprov_private_ppa)
17
18 >>> (p3a_config.distroroot ==
19 ... config.personalpackagearchive.private_root)
20@@ -123,9 +126,9 @@
21 >>> dump_config(p3a_config)
22 stayofexecution: 5.0
23 distroroot: /var/tmp/ppa
24- archiveroot: /var/tmp/ppa/cprov/ppa/ubuntutest
25- poolroot: /var/tmp/ppa/cprov/ppa/ubuntutest/pool
26- distsroot: /var/tmp/ppa/cprov/ppa/ubuntutest/dists
27+ archiveroot: /var/tmp/ppa/cprov/myprivateppa/ubuntutest
28+ poolroot: /var/tmp/ppa/cprov/myprivateppa/ubuntutest/pool
29+ distsroot: /var/tmp/ppa/cprov/myprivateppa/ubuntutest/dists
30 overrideroot: None
31 cacheroot: None
32 miscroot: None
33@@ -137,11 +140,6 @@
34 Architectures: amd64, i386
35 Components: main, multiverse, restricted, universe
36
37-Make Celso's PPA public again.
38-
39- >>> cprov_archive.private = False
40- >>> cprov_archive.buildd_secret = None
41-
42
43 == Partner ==
44
45
46=== modified file 'lib/lp/soyuz/doc/archive.txt'
47--- lib/lp/soyuz/doc/archive.txt 2010-02-18 17:11:12 +0000
48+++ lib/lp/soyuz/doc/archive.txt 2010-02-26 15:30:40 +0000
49@@ -102,10 +102,15 @@
50 essentially the password to the archive for the builder.
51
52 It can only be set by users with launchpad.Commercial permission in the
53-archive, i.e. an admin or a commercial admin.
54+archive, i.e. an admin or a commercial admin. We create a new PPA for
55+cprov here as changing privacy of a PPA is not allowed when sources have
56+already been published.
57
58+ >>> cprov_private_ppa = factory.makeArchive(
59+ ... owner=cprov, name='myprivateppa',
60+ ... distribution=cprov_archive.distribution)
61 >>> login(ANONYMOUS)
62- >>> cprov_archive.buildd_secret = 'boing'
63+ >>> cprov_private_ppa.buildd_secret = 'boing'
64 Traceback (most recent call last):
65 ...
66 Unauthorized: (..., 'buildd_secret', 'launchpad.Commercial')
67@@ -113,7 +118,7 @@
68 Commercial Member, a commercial admin but not an admin, can set 'buildd_secret'.
69
70 >>> login("commercial-member@canonical.com")
71- >>> cprov_archive.buildd_secret = 'not so secret at all'
72+ >>> cprov_private_ppa.buildd_secret = 'not so secret at all'
73
74 Foo Bar, an admin, can set 'buildd_secret'.
75
76@@ -133,11 +138,11 @@
77 'launchpad.View' in the archive.
78
79 >>> login("foo.bar@canonical.com")
80- >>> cprov_archive.buildd_secret = 'really secret'
81- >>> cprov_archive.private = True
82+ >>> cprov_private_ppa.buildd_secret = 'really secret'
83+ >>> cprov_private_ppa.private = True
84
85 >>> login(ANONYMOUS)
86- >>> print cprov_archive.buildd_secret
87+ >>> print cprov_private_ppa.buildd_secret
88 Traceback (most recent call last):
89 ...
90 Unauthorized: (..., 'buildd_secret', 'launchpad.View')
91@@ -145,17 +150,9 @@
92 Celso can read 'buildd_secret' contents for his PPA.
93
94 >>> login('celso.providelo@canonical.com')
95- >>> print cprov_archive.buildd_secret
96+ >>> print cprov_private_ppa.buildd_secret
97 really secret
98
99-In order to continue the tests of public archive attributes we will
100-make Celso's PPA public again.
101-
102- >>> login("foo.bar@canonical.com")
103- >>> cprov_archive.buildd_secret = ''
104- >>> cprov_archive.private = False
105- >>> login(ANONYMOUS)
106-
107 Useful properties:
108
109 >>> print cprov_archive.archive_url
110@@ -745,59 +742,65 @@
111 not publically available, but available only to users who have permission to
112 view the archive:
113
114-First, we turn cprov's archive into a private one:
115-
116- >>> login("foo.bar@canonical.com")
117- >>> cprov_archive.buildd_secret = 'really secret'
118- >>> cprov_archive.private = True
119-
120-And grab some source IDs from the archive:
121-
122- >>> sources = cprov_archive.getPublishedSources()
123- >>> source_ids = [sources[0].id, sources[1].id]
124+ # First we create some source/binary packages in cprov's private
125+ # PPA so that we'll have some results to view.
126+ >>> login('admin@canonical.com')
127+ >>> from lp.soyuz.tests.test_publishing import (
128+ ... SoyuzTestPublisher)
129+ >>> test_publisher = SoyuzTestPublisher()
130+ >>> ignore = test_publisher.setUpDefaultDistroSeries(warty)
131+ >>> test_publisher.addFakeChroots(warty)
132+ >>> ignore = test_publisher.getPubBinaries(archive=cprov_private_ppa)
133+
134+ # Grab some source IDs from the archive that we can use for calls to
135+ # getBuildSummariesForSourceIds():
136+ >>> sources = cprov_private_ppa.getPublishedSources()
137+ >>> source_ids = [sources[0].id]
138
139 Then verify that an admin can see the counters and build summaries:
140
141- >>> print_build_counters(cprov_archive.getBuildCounters())
142- failed 1
143- ...
144- total 4
145- >>> print_build_summaries(cprov_archive.getBuildSummariesForSourceIds(
146+ >>> print_build_counters(cprov_private_ppa.getBuildCounters())
147+ failed 0
148+ ...
149+ succeeded 1
150+ ...
151+ total 1
152+ >>> print_build_summaries(cprov_private_ppa.getBuildSummariesForSourceIds(
153 ... source_ids))
154- Source ID: 27
155- ...
156+ Source ID:...
157+ FULLYBUILT_PENDING
158+ All builds were built successfully but have not yet been published.
159+ Relevant builds:
160+ - i386 build of foo 666 in ubuntu warty RELEASE
161
162 Next veryify that cprov can still access the build counters:
163
164 >>> login('celso.providelo@canonical.com')
165- >>> print_build_counters(cprov_archive.getBuildCounters())
166- failed 1
167- ...
168- total 4
169- >>> print_build_summaries(cprov_archive.getBuildSummariesForSourceIds(
170+ >>> print_build_counters(cprov_private_ppa.getBuildCounters())
171+ failed 0
172+ ...
173+ succeeded 1
174+ ...
175+ total 1
176+ >>> print_build_summaries(cprov_private_ppa.getBuildSummariesForSourceIds(
177 ... source_ids))
178- Source ID: 27
179+ Source ID:...
180 ...
181+ - i386 build of foo 666 in ubuntu warty RELEASE
182
183 But the public cannot:
184
185 >>> login('no-priv@canonical.com')
186- >>> print_build_counters(cprov_archive.getBuildCounters())
187+ >>> print_build_counters(cprov_private_ppa.getBuildCounters())
188 Traceback (most recent call last):
189 ...
190 Unauthorized: (..., 'getBuildCounters', 'launchpad.View')
191- >>> print_build_summaries(cprov_archive.getBuildSummariesForSourceIds(
192+ >>> print_build_summaries(cprov_private_ppa.getBuildSummariesForSourceIds(
193 ... source_ids))
194 Traceback (most recent call last):
195 ...
196 Unauthorized: (..., 'getBuildSummariesForSourceIds', 'launchpad.View')
197
198-Make the archive public again before continuing:
199-
200- >>> login("foo.bar@canonical.com")
201- >>> cprov_archive.buildd_secret = ''
202- >>> cprov_archive.private = False
203-
204
205 == Package Counters ==
206
207@@ -1476,16 +1479,11 @@
208 If the archive is private, the url may be different as private PPAs
209 are published to a secure location.
210
211- >>> from zope.security.proxy import removeSecurityProxy
212- >>> naked_cprov_archive = removeSecurityProxy(cprov_archive)
213- >>> print naked_cprov_archive.archive_url
214+ >>> print cprov_archive.archive_url
215 http://ppa.launchpad.dev/cprov/ppa/ubuntu
216
217- >>> naked_cprov_archive.private = True
218- >>> naked_cprov_archive.syncUpdate()
219-
220- >>> print naked_cprov_archive.archive_url
221- http://private-ppa.launchpad.dev/cprov/ppa/ubuntu
222+ >>> print cprov_private_ppa.archive_url
223+ http://private-ppa.launchpad.dev/cprov/myprivateppa/ubuntu
224
225 IArchive.allowUpdatesToReleasePocket returns whether the archive is allowed
226 to publish to the RELEASE pocket no matter what state the distroseries is in.
227@@ -1519,7 +1517,7 @@
228
229 >>> archive_purposes = [archive.purpose.name for archive in archive_set]
230 >>> len(archive_purposes)
231- 17
232+ 18
233
234 >>> print sorted(set(archive_purposes))
235 ['COPY', 'DEBUG', 'PARTNER', 'PPA', 'PRIMARY']
236@@ -1537,32 +1535,34 @@
237
238 Those counters explicity exclude packages in private PPAs.
239
240-The current counters says we only have 1 source and 1 binary published
241+The current counters says we only have 4 source and 4 binary published
242 in public PPAs.
243
244 >>> archive_set.getNumberOfPPASourcesForDistribution(ubuntu)
245- 1
246+ 4
247 >>> archive_set.getNumberOfPPABinariesForDistribution(ubuntu)
248- 1
249+ 4
250
251 As mentioned caches for private PPAs are not considered.
252
253- >>> print cprov.archive.private
254+ >>> print cprov_private_ppa.private
255 True
256
257- >>> cprov.archive.sources_cached
258- 3
259- >>> cprov.archive.binaries_cached
260- 3
261+ >>> cprov_private_ppa.sources_cached
262+ 0
263+ >>> cprov_private_ppa.binaries_cached
264+ 0
265
266+ >>> from zope.security.proxy import removeSecurityProxy
267+ >>> naked_cprov_archive = removeSecurityProxy(cprov_private_ppa)
268 >>> naked_cprov_archive.sources_cached = 1000
269 >>> naked_cprov_archive.binaries_cached = 2000
270 >>> naked_cprov_archive.syncUpdate()
271
272 >>> archive_set.getNumberOfPPASourcesForDistribution(ubuntu)
273- 1
274+ 4
275 >>> archive_set.getNumberOfPPABinariesForDistribution(ubuntu)
276- 1
277+ 4
278
279 On the other hand, changes in the a public PPA are immediately
280 considered.
281@@ -1580,9 +1580,9 @@
282 >>> naked_no_priv_archive.syncUpdate()
283
284 >>> archive_set.getNumberOfPPASourcesForDistribution(ubuntu)
285- 11
286+ 14
287 >>> archive_set.getNumberOfPPABinariesForDistribution(ubuntu)
288- 3
289+ 6
290
291 Since we currently only create archives for ubuntu distribution, the
292 counters for other distributions are always 'zero'.
293@@ -1599,11 +1599,12 @@
294 uses `TeamParticipation` relationships to calculate all the PPAs the
295 user is allowed to upload or copy packages to.
296
297-In the sampledata, 'cprov' only participates in his own PPA.
298+Celso only participates in his own PPAs.
299
300 >>> for ppa in archive_set.getPPAsForUser(cprov):
301 ... print ppa.displayname
302 PPA for Celso Providelo
303+ PPA named myprivateppa for Celso Providelo
304
305 However 'cprov' is also a member of 'launchpad-buildd-admins' team,
306 which doesn't have a PPA yet.
307@@ -1628,6 +1629,7 @@
308 ... print ppa.displayname
309 PPA for Celso Providelo
310 PPA for Launchpad Buildd Admins
311+ PPA named myprivateppa for Celso Providelo
312
313 The same happens for specific upload rights granted on 3rd-party
314 PPAs. When 'No Privileges' gets upload rights to Celso's PPA,
315@@ -1699,14 +1701,7 @@
316 >>> p3as = archive_set.getPrivatePPAs()
317 >>> for p3a in p3as:
318 ... print p3a.displayname
319- PPA for Celso Providelo
320-
321-For the next test we will make Celso's PPA public again, so it can
322-appear in public lists. We do that because that PPA contains relevant
323-contents for testing.
324-
325- >>> naked_cprov_archive.private = False
326- >>> naked_cprov_archive.syncUpdate()
327+ PPA named myprivateppa for Celso Providelo
328
329 'getLatestPPASourcePublicationsForDistribution' returns up to 5
330 lastest source publications available for a given distribution ordered
331@@ -1762,18 +1757,20 @@
332 pmount 0.1-1 in warty PUBLISHED cprov
333
334 Private source publications are excluded from this list, the fact that
335-they exist should never leak. If we make Celso's PPA private, its
336-contents will not be listed anymore. The same happens for uploaded
337-sources, since they are essentially another source publication in this
338-context.
339+they exist should never leak. If we copy the package to Celso's private
340+PPA the list is not updated. The same happens for uploaded sources, since
341+they are essentially another source publication in this context.
342
343- >>> naked_cprov_archive.private = True
344- >>> naked_cprov_archive.syncUpdate()
345+ >>> copy = cprov_cdrkit.copyTo(
346+ ... ubuntu['hoary'], PackagePublishingPocket.RELEASE,
347+ ... cprov_private_ppa)
348
349 >>> print_latest_uploads()
350 cdrkit 1.0 in hoary PENDING mark
351 iceweasel 1.0 in hoary PENDING mark
352+ cdrkit 1.0 in breezy-autotest SUPERSEDED cprov
353 iceweasel 1.0 in breezy-autotest PUBLISHED mark
354+ pmount 0.1-1 in warty PUBLISHED cprov
355
356 'getMostActivePPAsForDistribution' returns a list of dictionaries
357 containing up to 5 PPAs with the highest number of publications in the
358@@ -1815,14 +1812,14 @@
359 ... a_pub.copyTo(
360 ... ubuntu['hoary'], PackagePublishingPocket.RELEASE, where)
361
362- >>> create_activity(cprov_archive, 20)
363+ >>> create_activity(cprov_private_ppa, 20)
364 >>> create_activity(sandbox_archive, 10)
365 >>> create_activity(name12.archive, 4)
366 >>> create_activity(no_priv.archive, 4)
367 >>> create_activity(lp_buildd_team.archive, 8)
368
369-Celso's PPA is still private, so despite having the highest number of
370-uploads it's not listed.
371+Celso's private PPA is not listed despite having the highest number of
372+uploads.
373
374 >>> print_most_active_ppas()
375 PPA for Foo Bar 10
376@@ -1831,13 +1828,11 @@
377 PPA for Sample Person 4
378 PPA for Mark Shuttleworth 2
379
380-When we make Celso's PPA public the result gets limited to 5 items.
381-The previous last item (Mark's PPA) will now be excluded in place of
382-Celso's PPA.
383-
384- >>> naked_cprov_archive.private = False
385- >>> naked_cprov_archive.syncUpdate()
386-
387+If we give lots of activity to Celso's public PPA the previous
388+last item (Mark's PPA) will now be excluded as the results are
389+limited to 5 items.
390+
391+ >>> create_activity(cprov_archive, 20)
392 >>> print_most_active_ppas()
393 PPA for Celso Providelo 20
394 PPA for Foo Bar 10
395@@ -2128,14 +2123,15 @@
396 False
397
398 We can also create an ArchivePermission entry for carlos to be able to upload
399-to cprov's PPA, even though he is not the owner.
400+to someone else's PPA, even though he is not the owner.
401
402- >>> discard = cprov_archive.newComponentUploader(
403+ >>> joes_ppa = factory.makeArchive()
404+ >>> discard = joes_ppa.newComponentUploader(
405 ... carlos, "main")
406
407-Carlos can now upload to cprov's PPA:
408+Carlos can now upload to Joe's PPA:
409
410- >>> cprov_archive.canUpload(carlos)
411+ >>> joes_ppa.canUpload(carlos)
412 True
413
414 Note that when creating a new permission, trying to specify a component other
415@@ -2146,7 +2142,7 @@
416 packagesets will replace components entirely as the ACL mechanism, so this
417 anacronism can be removed.
418
419- >>> cprov_archive.newComponentUploader(
420+ >>> joes_ppa.newComponentUploader(
421 ... carlos, "universe")
422 Traceback (most recent call last):
423 ...
424@@ -2155,60 +2151,61 @@
425 You'll get the same error if you use a component object that's not main.
426
427 >>> universe = getUtility(IComponentSet)['universe']
428- >>> cprov_archive.newComponentUploader(
429+ >>> joes_ppa.newComponentUploader(
430 ... carlos, universe)
431 Traceback (most recent call last):
432 ...
433 InvalidComponent: Component for PPAs should be 'main'
434
435-As important as the right to upload packages to Celso's PPA, Carlos
436+As important as the right to upload packages to Joe's PPA, Carlos
437 also got the corresponding permissions on it.
438
439 >>> from canonical.launchpad.webapp.authorization import check_permission
440 >>> login("carlos@canonical.com")
441
442- >>> check_permission('launchpad.View', cprov_archive)
443- True
444-
445- >>> check_permission('launchpad.Append', cprov_archive)
446- True
447-
448-So even if Celso's PPA suddenly becomes private, Carlos rights will be
449+ >>> check_permission('launchpad.View', joes_ppa)
450+ True
451+
452+ >>> check_permission('launchpad.Append', joes_ppa)
453+ True
454+
455+So even if Joe's PPA suddenly becomes private, Carlos rights will be
456 preserved.
457
458 >>> login('foo.bar@canonical.com')
459- >>> cprov_archive.buildd_secret = 'x'
460- >>> cprov_archive.private = True
461+ >>> joes_ppa.buildd_secret = 'x'
462+ >>> joes_ppa.private = True
463
464 >>> login("carlos@canonical.com")
465
466- >>> check_permission('launchpad.View', cprov_archive)
467- True
468-
469- >>> check_permission('launchpad.Append', cprov_archive)
470- True
471-
472-On the other hand, if Celso's PPA is disabled, only the view
473+ >>> check_permission('launchpad.View', joes_ppa)
474+ True
475+
476+ >>> check_permission('launchpad.Append', joes_ppa)
477+ True
478+
479+On the other hand, if Joe's PPA is disabled, only the view
480 permissions are kept. No one has permission to upload or copy sources
481 to it.
482
483 >>> login('foo.bar@canonical.com')
484- >>> cprov_archive.disable()
485+ >>> joes_ppa.disable()
486
487 >>> login("carlos@canonical.com")
488- >>> check_permission('launchpad.Append', cprov_archive)
489+ >>> check_permission('launchpad.Append', joes_ppa)
490 False
491
492- >>> login("celso.providelo@canonical.com")
493- >>> check_permission('launchpad.Append', cprov_archive)
494+ >>> login_person(joes_ppa.owner)
495+ >>> check_permission('launchpad.Append', joes_ppa)
496 False
497
498 Similarly to private PPAs, disabled public PPAs can only be viewed by
499 owners or uploaders.
500
501 >>> login('foo.bar@canonical.com')
502- >>> cprov_archive.buildd_secret = ''
503- >>> cprov_archive.private = False
504+ >>> discard = cprov_archive.newComponentUploader(
505+ ... carlos, "main")
506+ >>> cprov_archive.disable()
507
508 >>> login(ANONYMOUS)
509 >>> check_permission('launchpad.View', cprov_archive)
510@@ -2348,17 +2345,12 @@
511 First we use the SoyuzTestPublisher to make some test publications in
512 hoary:
513
514- >>> from lp.soyuz.tests.test_publishing import (
515- ... SoyuzTestPublisher)
516- >>> test_publisher = SoyuzTestPublisher()
517- >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
518- >>> hoary = ubuntu.getSeries('hoary')
519 >>> test_publisher.addFakeChroots(hoary)
520 >>> unused = test_publisher.setUpDefaultDistroSeries(hoary)
521 >>> discard = test_publisher.getPubSource(
522 ... sourcename="package1", version="1.0", archive=cprov.archive,
523- ... status=PackagePublishingStatus.PUBLISHED)
524- >>> discard = test_publisher.getPubSource(
525+ ... status=PackagePublishingStatus.PUBLISHED)
526+ >>> discard = test_publisher.getPubSource(
527 ... sourcename="package1", version="1.1", archive=cprov.archive,
528 ... status=PackagePublishingStatus.PUBLISHED)
529 >>> discard = test_publisher.getPubSource(
530
531=== modified file 'lib/lp/soyuz/doc/buildd-scoring.txt'
532--- lib/lp/soyuz/doc/buildd-scoring.txt 2010-01-20 01:23:38 +0000
533+++ lib/lp/soyuz/doc/buildd-scoring.txt 2010-02-26 15:30:40 +0000
534@@ -86,31 +86,31 @@
535
536 >>> commit()
537 >>> LaunchpadZopelessLayer.switchDbUser('launchpad')
538- >>> from lp.soyuz.interfaces.build import IBuildSet
539- >>> build = getUtility(IBuildSet).getByQueueEntry(bq0)
540- >>> build.archive.buildd_secret = "secret"
541- >>> build.archive.private = True
542- >>> bq0.score()
543- >>> bq0.lastscore
544+ >>> private_ppa = factory.makeArchive()
545+ >>> private_ppa.buildd_secret = "secret"
546+ >>> private_ppa.private = True
547+ >>> bq1 = setUpBuildQueueEntry(archive=private_ppa)
548+ >>> bq1.score()
549+ >>> bq1.lastscore
550 12515
551
552 The archive can also have a delta applied to all its build scores. Setting
553 IArchive.relative_build_score to boost by 100 changes the lastscore value
554 appropriately.
555
556- >>> build.archive.relative_build_score = 100
557- >>> bq0.score()
558- >>> bq0.lastscore
559+ >>> private_ppa.relative_build_score = 100
560+ >>> bq1.score()
561+ >>> bq1.lastscore
562 12615
563
564 The delta can also be negative.
565
566- >>> build.archive.relative_build_score = -100
567- >>> bq0.score()
568- >>> bq0.lastscore
569+ >>> private_ppa.relative_build_score = -100
570+ >>> bq1.score()
571+ >>> bq1.lastscore
572 12415
573
574- >>> build.archive.relative_build_score = 0
575+ >>> private_ppa.relative_build_score = 0
576 >>> LaunchpadZopelessLayer.switchDbUser(test_dbuser)
577
578
579@@ -260,6 +260,7 @@
580 ... name='test-rebuild')
581
582 >>> bqc = setUpBuildQueueEntry(archive=copy)
583+ >>> from lp.soyuz.interfaces.build import IBuildSet
584 >>> build = getUtility(IBuildSet).getByQueueEntry(bqc)
585 >>> bqc.score()
586 >>> bqc.lastscore