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

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4
Merge into: lp:launchpad
Prerequisite: lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor3
Diff against target: 891 lines (+159/-151)
8 files modified
lib/lp/soyuz/doc/archiveauthtoken.txt (+25/-25)
lib/lp/soyuz/doc/archivesubscriber.txt (+37/-34)
lib/lp/soyuz/doc/build.txt (+42/-50)
lib/lp/soyuz/doc/package-diff.txt (+5/-4)
lib/lp/soyuz/doc/sourcepackagerelease.txt (+3/-3)
lib/lp/soyuz/stories/ppa/xx-ppa-files.txt (+41/-30)
lib/lp/soyuz/tests/test_publishing.py (+3/-3)
lib/lp/testing/factory.py (+3/-2)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor4
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+19961@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

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

The MP for the branch that actually fixed the 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 complete test breakages are as follows:
http://pastebin.ubuntu.com/378292/

This branch fixes:

bin/test -vv -t archiveauthtoken.txt -t archivesubscriber.txt -t doc/build.txt -t package-diff.txt -t sourcepackagerelease.txt -t xx-ppa-files.txt

Thanks.

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/doc/archiveauthtoken.txt'
2--- lib/lp/soyuz/doc/archiveauthtoken.txt 2009-05-06 20:53:05 +0000
3+++ lib/lp/soyuz/doc/archiveauthtoken.txt 2010-02-26 15:38:20 +0000
4@@ -7,13 +7,12 @@
5
6 See also ArchiveSubscriber.txt.
7
8-Set cprov's PPA to be a private one:
9+First we create a private PPA for Joe.
10
11- >>> login("foo.bar@canonical.com")
12- >>> from lp.registry.interfaces.person import IPersonSet
13- >>> cprov = getUtility(IPersonSet).getByName("cprov")
14- >>> cprov.archive.buildd_secret = "secret"
15- >>> cprov.archive.private = True
16+ >>> login("admin@canonical.com")
17+ >>> joe = factory.makePerson(name="joe", displayname="Joe Smith")
18+ >>> joe_private_ppa = factory.makeArchive(
19+ ... owner=joe, private=True)
20 >>> logout()
21
22 == Creating new tokens ==
23@@ -26,23 +25,24 @@
24 though we do not yet have a subscription:
25
26 >>> login("test@canonical.com")
27+ >>> from lp.registry.interfaces.person import IPersonSet
28 >>> name12 = getUtility(IPersonSet).getByName("name12")
29- >>> new_token = cprov.archive.newAuthToken(name12)
30+ >>> new_token = joe_private_ppa.newAuthToken(name12)
31 Traceback (most recent call last):
32 ...
33 Unauthorized: You do not have a subscription for
34- PPA for Celso Providelo.
35-
36-Create a subscription for name12 to cprov's archive:
37-
38- >>> login("celso.providelo@canonical.com")
39- >>> subscription_to_cprov_archive = cprov.archive.newSubscription(
40- ... name12, cprov)
41+ PPA for Joe Smith.
42+
43+Create a subscription for name12 to joe's archive:
44+
45+ >>> login_person(joe)
46+ >>> subscription_to_joe_private_ppa = joe_private_ppa.newSubscription(
47+ ... name12, joe)
48 >>> login("test@canonical.com")
49
50 Now try again to create a token as name12 - this time it works:
51
52- >>> token_with_random_string = cprov.archive.newAuthToken(name12)
53+ >>> token_with_random_string = joe_private_ppa.newAuthToken(name12)
54
55 By default the tokens are 20 characters long.
56
57@@ -51,26 +51,26 @@
58
59 It is not possible to create a second token when one already exists:
60
61- >>> new_token = cprov.archive.newAuthToken(name12)
62+ >>> new_token = joe_private_ppa.newAuthToken(name12)
63 Traceback (most recent call last):
64 ...
65 ArchiveSubscriptionError: Sample Person already has a token for
66- PPA for Celso Providelo.
67+ PPA for Joe Smith.
68
69 So deactivate the old token so that we can create a new token:
70
71- >>> login("celso.providelo@canonical.com")
72+ >>> login_person(joe)
73 >>> token_with_random_string.deactivate()
74 >>> login("test@canonical.com")
75
76 We can also specify our own token for testing purposes:
77
78- >>> new_token = cprov.archive.newAuthToken(name12, u"testtoken")
79+ >>> new_token = joe_private_ppa.newAuthToken(name12, u"testtoken")
80
81 The new token is returned and reflects the data:
82
83 >>> print new_token.archive.displayname
84- PPA for Celso Providelo
85+ PPA for Joe Smith
86
87 >>> print new_token.person.name
88 name12
89@@ -79,7 +79,7 @@
90 testtoken
91
92 >>> print new_token.archive_url
93- http://name12:testtoken@private-ppa.launchpad.dev/cprov/ppa/ubuntu
94+ http://name12:testtoken@private-ppa.launchpad.dev/joe/ppa/...
95
96 Commit the new token to the database.
97
98@@ -126,7 +126,7 @@
99
100 It's also possible to retrieve a set of all the tokens for an archive.
101
102- >>> tokens = token_set.getByArchive(cprov.archive)
103+ >>> tokens = token_set.getByArchive(joe_private_ppa)
104 >>> print tokens.count()
105 1
106
107@@ -153,7 +153,7 @@
108 ...
109 Unauthorized:...
110
111- >>> login("celso.providelo@canonical.com")
112+ >>> login_person(joe)
113 >>> new_token.deactivate()
114
115 Deactivating sets the date_deactivated value.
116@@ -163,14 +163,14 @@
117
118 We can do this as an admin too:
119
120- >>> new_token = cprov.archive.newAuthToken(name12)
121+ >>> new_token = joe_private_ppa.newAuthToken(name12)
122 >>> login("admin@canonical.com")
123 >>> new_token.deactivate()
124
125 Deactivating a token stops it being returned from getByArchive(). The
126 previous count of 1 is now reduced to 0.
127
128- >>> token_set.getByArchive(cprov.archive).count()
129+ >>> token_set.getByArchive(joe_private_ppa).count()
130 0
131
132 The IArchiveAuthTokenSet.getActiveTokenForArchiveAndPerson() method will
133
134=== modified file 'lib/lp/soyuz/doc/archivesubscriber.txt'
135--- lib/lp/soyuz/doc/archivesubscriber.txt 2010-02-11 09:14:17 +0000
136+++ lib/lp/soyuz/doc/archivesubscriber.txt 2010-02-26 15:38:20 +0000
137@@ -61,7 +61,7 @@
138 Unauthorized:...
139
140 If we log in as cprov it will still not work because his archive is
141-currently public:
142+public:
143
144 >>> login("celso.providelo@canonical.com")
145 >>> new_sub = cprov.archive.newSubscription(
146@@ -70,20 +70,22 @@
147 ...
148 ArchiveNotPrivate: Only private archives can have subscriptions.
149
150-After ensuring cprov's archive is private, cprov can create a
151+If we create a private ppa for Celso, then he can create a
152 subscription for joesmith:
153
154 >>> login('foo.bar@canonical.com')
155- >>> cprov.archive.buildd_secret = 'really secret'
156- >>> cprov.archive.private = True
157+ >>> cprov_private_ppa = factory.makeArchive(
158+ ... owner=cprov, distribution=cprov.archive.distribution,
159+ ... private=True, name='p3a',
160+ ... description="packages to help my friends.")
161 >>> login("celso.providelo@canonical.com")
162- >>> new_sub = cprov.archive.newSubscription(
163+ >>> new_sub = cprov_private_ppa.newSubscription(
164 ... joesmith, cprov, description=u"subscription for joesmith")
165
166 The new subscription is returned and reflects the data:
167
168 >>> print new_sub.displayname
169- Joe Smith's access to PPA for Celso Providelo
170+ Joe Smith's access to PPA named p3a for Celso Providelo
171
172 >>> print new_sub.registrant.name
173 cprov
174@@ -109,15 +111,15 @@
175 From: Celso Providelo <noreply@launchpad.net>
176 To: joe@example.com
177 Reply-To: Celso Providelo <celso.providelo@canonical.com>
178- Subject: PPA access granted for PPA for Celso Providelo
179+ Subject: PPA access granted for PPA named p3a for Celso Providelo
180 Hello Joe Smith,
181 <BLANKLINE>
182 Launchpad: access to a private archive
183 --------------------------------------
184 <BLANKLINE>
185 Celso Providelo has granted you access to a private software archive
186- "PPA for Celso Providelo" (ppa:cprov/ppa), which is hosted by Launchpad
187- and has the following description:
188+ "PPA named p3a for Celso Providelo" (ppa:cprov/p3a), which is hosted
189+ by Launchpad and has the following description:
190 <BLANKLINE>
191 packages to help my friends.
192 <BLANKLINE>
193@@ -143,21 +145,22 @@
194 A subscription for a subscriber who already has a current subscription
195 cannot be created:
196
197- >>> new_sub = cprov.archive.newSubscription(
198+ >>> new_sub = cprov_private_ppa.newSubscription(
199 ... joesmith, cprov, description=u"subscription for joesmith")
200 Traceback (most recent call last):
201 ...
202 AlreadySubscribed: Joe Smith already has a current subscription for
203- 'PPA for Celso Providelo'.
204+ 'PPA named p3a for Celso Providelo'.
205
206
207 Add another subscription for the test user, this time to mark's ppa:
208
209 >>> login("mark@example.com")
210 >>> mark = getUtility(IPersonSet).getByName("mark")
211- >>> mark.archive.buildd_secret = "really secret"
212- >>> mark.archive.private = True
213- >>> new_sub_to_mark_ppa = mark.archive.newSubscription(
214+ >>> mark_private_ppa = factory.makeArchive(
215+ ... owner=mark, distribution=mark.archive.distribution,
216+ ... private=True, name='p3a')
217+ >>> new_sub_to_mark_ppa = mark_private_ppa.newSubscription(
218 ... joesmith, mark, description=u"subscription for joesmith")
219
220 >>> print_emails()
221@@ -167,7 +170,7 @@
222
223 And also a subscription for a Team:
224
225- >>> new_team_sub_to_mark_ppa = mark.archive.newSubscription(
226+ >>> new_team_sub_to_mark_ppa = mark_private_ppa.newSubscription(
227 ... team_cprov, mark, description=u"Access for cprov team")
228
229 >>> print_emails()
230@@ -219,7 +222,7 @@
231
232 >>> print sub_set.getBySubscriber(
233 ... new_sub.subscriber)[0].archive.displayname
234- PPA for Celso Providelo
235+ PPA named p3a for Celso Providelo
236
237 >>> print sub_set.getByArchive(new_sub.archive)[0].subscriber.name
238 joesmith
239@@ -229,7 +232,7 @@
240
241 >>> print sub_set.getBySubscriber(
242 ... new_sub.subscriber, new_sub.archive)[0].archive.displayname
243- PPA for Celso Providelo
244+ PPA named p3a for Celso Providelo
245
246 By default the getBySubscriber() and getByArchive() methods return
247 all current subscriptions, most recently created first:
248@@ -238,10 +241,10 @@
249 >>> for subscription in sub_set.getBySubscriber(new_sub.subscriber):
250 ... print subscription.archive.displayname
251 ... print subscription.date_created.date()
252- PPA for Celso Providelo 2009-02-26
253- PPA for Mark Shuttleworth 2009-02-22
254+ PPA named p3a for Celso Providelo 2009-02-26
255+ PPA named p3a for Mark Shuttleworth 2009-02-22
256
257- >>> for subscription in sub_set.getByArchive(mark.archive):
258+ >>> for subscription in sub_set.getByArchive(mark_private_ppa):
259 ... print subscription.subscriber.displayname
260 ... print subscription.date_created.date()
261 Team Cprov 2009-02-24
262@@ -258,7 +261,7 @@
263
264 >>> sub_set.getBySubscriber(new_sub.subscriber).count()
265 1
266- >>> sub_set.getByArchive(mark.archive).count()
267+ >>> sub_set.getByArchive(mark_private_ppa).count()
268 1
269
270 Unless we explicitly ask for all subscriptions - not just the current ones:
271@@ -266,7 +269,7 @@
272 >>> sub_set.getBySubscriber(
273 ... new_sub.subscriber, current_only=False).count()
274 2
275- >>> sub_set.getByArchive(mark.archive, current_only=False).count()
276+ >>> sub_set.getByArchive(mark_private_ppa, current_only=False).count()
277 2
278
279 The getBySubscriber() method includes by default subscriptions for teams
280@@ -276,8 +279,8 @@
281 >>> for subscription in sub_set.getBySubscriber(joesmith):
282 ... print subscription.archive.displayname
283 ... print subscription.description
284- PPA for Celso Providelo subscription for joesmith
285- PPA for Mark Shuttleworth Access for cprov team
286+ PPA named p3a for Celso Providelo subscription for joesmith
287+ PPA named p3a for Mark Shuttleworth Access for cprov team
288
289 Finally, many callsites of getBySubscriber() will be interested not only
290 in each subscription of the subscriber, but also the generated
291@@ -286,7 +289,7 @@
292
293 First create a token for joesmith's subscription for cprov's archive:
294
295- >>> joesmith_token = cprov.archive.newAuthToken(joesmith, u"test_token")
296+ >>> joesmith_token = cprov_private_ppa.newAuthToken(joesmith, u"test_token")
297
298 Now print out all subscriptions with their tokens for joesmith:
299
300@@ -300,8 +303,8 @@
301 ... print token_text
302 >>> print_subscriptions_with_tokens(
303 ... sub_set.getBySubscriberWithActiveToken(joesmith))
304- PPA for Celso Providelo test_token
305- PPA for Mark Shuttleworth None
306+ PPA named p3a for Celso Providelo test_token
307+ PPA named p3a for Mark Shuttleworth None
308
309 Deactivated tokens are not included with the returned token for a
310 subscription:
311@@ -312,8 +315,8 @@
312
313 >>> print_subscriptions_with_tokens(
314 ... sub_set.getBySubscriberWithActiveToken(joesmith))
315- PPA for Celso Providelo None
316- PPA for Mark Shuttleworth None
317+ PPA named p3a for Celso Providelo None
318+ PPA named p3a for Mark Shuttleworth None
319
320 == Amending Subscriptions ==
321
322@@ -402,7 +405,7 @@
323 >>> for subscription in sub_set.getBySubscriber(joesmith):
324 ... print subscription.archive.displayname
325 ... print subscription.description
326- PPA for Mark Shuttleworth Access for cprov team
327+ PPA named p3a for Mark Shuttleworth Access for cprov team
328
329 >>> subscription = sub_set.getBySubscriber(joesmith).first()
330
331@@ -419,7 +422,7 @@
332 a separate subscription), then he will no longer be listed as a non-active
333 subscriber for this subscription:
334
335- >>> joesmith_token = mark.archive.newAuthToken(joesmith)
336+ >>> joesmith_token = mark_private_ppa.newAuthToken(joesmith)
337 >>> for person in subscription.getNonActiveSubscribers():
338 ... print person.displayname
339 Celso Providelo
340@@ -433,7 +436,7 @@
341 ... displayname="Harry Smith",
342 ... password="test",
343 ... email="harry@example.com")
344- >>> subscription = mark.archive.newSubscription(
345+ >>> subscription = mark_private_ppa.newSubscription(
346 ... harrysmith, mark, description=u"subscription for joesmith")
347 >>> for person in subscription.getNonActiveSubscribers():
348 ... print person.displayname
349@@ -443,7 +446,7 @@
350 getNonActiveSubscribers will return an empty result set as he is now
351 "active".
352
353- >>> harry_token = mark.archive.newAuthToken(harrysmith)
354+ >>> harry_token = mark_private_ppa.newAuthToken(harrysmith)
355 >>> print subscription.getNonActiveSubscribers().count()
356 0
357
358@@ -453,7 +456,7 @@
359 >>> launchpad_devs = getUtility(IPersonSet).getByName('launchpad')
360 >>> ignored = launchpad_devs.addMember(
361 ... team_cprov, mark, force_team_add=True)
362- >>> subscription = mark.archive.newSubscription(
363+ >>> subscription = mark_private_ppa.newSubscription(
364 ... launchpad_devs, mark, description=u"LP team too")
365 >>> for person in subscription.getNonActiveSubscribers():
366 ... print person.displayname
367
368=== modified file 'lib/lp/soyuz/doc/build.txt'
369--- lib/lp/soyuz/doc/build.txt 2010-02-10 11:21:41 +0000
370+++ lib/lp/soyuz/doc/build.txt 2010-02-26 15:38:20 +0000
371@@ -220,8 +220,9 @@
372 storeUploadLog() upload the given content as a restricted file.
373
374 >>> login('foo.bar@canonical.com')
375- >>> active_build.archive.buildd_secret = "secret"
376- >>> active_build.archive.private = True
377+ >>> original_archive = active_build.archive
378+ >>> private_ppa = factory.makeArchive(private=True)
379+ >>> removeSecurityProxy(active_build).archive = private_ppa
380 >>> login(ANONYMOUS)
381
382 Simply changing the archive privacy after the 'upload_log' is stored
383@@ -249,11 +250,11 @@
384 >>> print active_build.upload_log.restricted
385 True
386
387-Restore ubuntu main archive state to not affect the rest of the tests.
388+Restore ubuntu main archive as the target to not affect the rest of the
389+tests.
390
391 >>> login('foo.bar@canonical.com')
392- >>> active_build.archive.buildd_secret = ''
393- >>> active_build.archive.private = False
394+ >>> removeSecurityProxy(active_build).archive = original_archive
395 >>> login(ANONYMOUS)
396
397 Since ubuntu/warty is already released the failed build can't be
398@@ -770,38 +771,46 @@
399
400 >>> login('foo.bar@canonical.com')
401
402-Let's make cprov's archive private (and hence its builds become private):
403+Let's create a private PPA for cprov (and hence its builds become private):
404
405 >>> from canonical.launchpad.interfaces import IPersonSet
406 >>> cprov = removeSecurityProxy(getUtility(IPersonSet).getByName('cprov'))
407- >>> cprov.archive.buildd_secret = "secret"
408- >>> cprov.archive.private = True
409- >>> flush_database_updates()
410-
411-The default set of builds with no user specified excludes private builds:
412-
413+ >>> cprov_private_ppa = factory.makeArchive(
414+ ... owner=cprov, private=True, name='p3a',
415+ ... distribution=cprov.archive.distribution)
416 >>> from canonical.launchpad.interfaces import IBuilderSet
417 >>> bob = getUtility(IBuilderSet)['bob']
418+ >>> binaries = test_publisher.getPubBinaries(
419+ ... archive=cprov_private_ppa, builder=bob,
420+ ... binaryname='privacycheck-bin')
421+ >>> flush_database_updates()
422+
423+The default set of builds with no user specified excludes private builds:
424+
425 >>> bob_builds = bob.getBuildRecords()
426 >>> print_build_details(bob_builds)
427 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
428+ cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
429+ cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
430+ cprov: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
431 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE
432 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
433 ...
434 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
435- ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest
436+ ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest
437 RELEASE
438-
439+
440 >>> bob_builds.count()
441- 13
442+ 16
443
444 If we include an admin user, we can see all the builds. Here, we get
445-three additional private builds for cprov:
446+an additional private build for cprov:
447
448 >>> from canonical.launchpad.interfaces import ILaunchpadCelebrities
449 >>> admin = getUtility(ILaunchpadCelebrities).admin
450 >>> bob_builds = bob.getBuildRecords(user=admin)
451 >>> print_build_details(bob_builds)
452+ cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
453 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
454 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
455 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
456@@ -812,14 +821,15 @@
457 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
458 ubuntu-team: i386 build of mozilla-firefox 0.9 in ubuntu breezy-autotest
459 RELEASE
460-
461+
462 >>> bob_builds.count()
463- 16
464+ 17
465
466 Cprov can also see his own builds of course:
467
468 >>> bob_builds = bob.getBuildRecords(user=cprov)
469 >>> print_build_details(bob_builds)
470+ cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
471 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
472 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
473 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
474@@ -832,7 +842,7 @@
475 RELEASE
476
477 >>> bob_builds.count()
478- 16
479+ 17
480
481 Buildd admins specifically are not allowed to see private builds, which will
482 be filtered from the list returned:
483@@ -844,6 +854,9 @@
484 >>> bob_builds = bob.getBuildRecords(user=buildd_admin)
485 >>> print_build_details(bob_builds)
486 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
487+ cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
488+ cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
489+ cprov: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
490 no-priv: i386 build of cdrkit 1.0 in ubuntu warty RELEASE
491 ubuntu-team: i386 build of cdrkit 1.0 in ubuntu breezy-autotest RELEASE
492 ...
493@@ -852,7 +865,7 @@
494 RELEASE
495
496 >>> bob_builds.count()
497- 13
498+ 16
499
500 You can filter on build state:
501
502@@ -874,13 +887,6 @@
503 >>> bob_pmount_ok_builds.count()
504 4
505
506-Restore cprov to non-private:
507-
508- >>> login('foo.bar@canonical.com')
509- >>> removeSecurityProxy(cprov).archive.private = False
510- >>> flush_database_updates()
511- >>> login(ANONYMOUS)
512-
513
514 == AssertionErrors in IBuild ==
515
516@@ -1169,26 +1175,12 @@
517 IBuild's content class is wrapped in a Zope security wrapper that prevents
518 access to private builds for unauthorised users.
519
520-cprov's archive is private which makes its builds private. We'll add
521-an extra build that is not published anywhere but in his PPA.
522-
523- >>> login('foo.bar@canonical.com')
524- >>> test_publisher.prepareBreezyAutotest()
525- >>> removeSecurityProxy(cprov).archive.private = True
526- >>> private_source_pub = test_publisher.getPubSource(
527- ... status=PackagePublishingStatus.PUBLISHED,
528- ... sourcename='privacy-test',
529- ... architecturehintlist='i386',
530- ... archive=cprov.archive)
531- >>> [private_build] = private_source_pub.createMissingBuilds()
532- >>> private_build.builder = bob
533- >>> flush_database_updates()
534-
535 Accessing the cprov builds when logged in as admin will see the records:
536
537+ >>> login('admin@canonical.com')
538 >>> bob_builds = bob.getBuildRecords(user=admin)
539 >>> print_build_details(bob_builds)
540- cprov: i386 build of privacy-test 666 in ubuntutest breezy-autotest...
541+ cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
542 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
543 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
544 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
545@@ -1200,7 +1192,7 @@
546 >>> login('celso.providelo@canonical.com')
547 >>> bob_builds = bob.getBuildRecords(user=admin)
548 >>> print_build_details(bob_builds)
549- cprov: i386 build of privacy-test 666 in ubuntutest breezy-autotest...
550+ cprov: i386 build of privacycheck 666 in ubuntutest breezy-autotest...
551 ubuntu-team: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
552 cprov: hppa build of mozilla-firefox 0.9 in ubuntu warty RELEASE
553 cprov: i386 build of pmount 0.1-1 in ubuntu warty RELEASE
554@@ -1446,10 +1438,10 @@
555
556 == Getting the build records for a particular builder ==
557
558-The getBuildsForBuilder method returns all the builds for the
559+The getBuildsForBuilder method returns all the builds for the
560 specified builder ID, ordered from most-recently built.
561
562- Create some source packages with which to test the
563+ Create some source packages with which to test the
564 getBuildsForBuilder method:
565
566 >>> src_pkg_earlier = test_publisher.getPubSource(
567@@ -1459,7 +1451,7 @@
568 ... status=PackagePublishingStatus.PUBLISHED,
569 ... sourcename='laterbuildsrc',
570 ... architecturehintlist='hppa i386')
571-
572+
573 Create the builds based on the source packages, with the builds
574 for 'earlierbuildsrc' built one day before the 'laterbuildsrc':
575
576@@ -1474,10 +1466,10 @@
577 >>> later_builds = src_pkg_later.createMissingBuilds()
578 >>> for build in later_builds:
579 ... build.datebuilt = eg_build_date
580-
581+
582 Ensure that the i386 builds are created by the 'frog' builder,
583 while the hppa builds are created by 'bob' the builder:
584-
585+
586 >>> builds = earlier_builds + later_builds
587 >>> for build in builds:
588 ... if build.processor.name == u'386':
589@@ -1487,7 +1479,7 @@
590
591 A call to getBuildsForBuilder returns only those builds that were
592 built by the specified builder, ordered by datebuilt DESC:
593-
594+
595 >>> frog_builds = getUtility(IBuildSet).getBuildsForBuilder(
596 ... frog_builder.id)
597 >>> print_build_details(frog_builds)
598
599=== modified file 'lib/lp/soyuz/doc/package-diff.txt'
600--- lib/lp/soyuz/doc/package-diff.txt 2009-12-13 11:55:40 +0000
601+++ lib/lp/soyuz/doc/package-diff.txt 2010-02-26 15:38:20 +0000
602@@ -732,11 +732,12 @@
603 >>> print diff.diff_content.restricted
604 False
605
606-When we make FooBar's PPA private, the diff becomes 'private' and the
607-new 'diff_content' is stored in the restricted librarian instance.
608+If the diff is attached to a private PPA, the diff becomes 'private' and
609+the new 'diff_content' is stored in the restricted librarian instance.
610
611- >>> diff.to_source.upload_archive.buildd_secret = 'nhack!'
612- >>> diff.to_source.upload_archive.private = True
613+ >>> private_ppa = factory.makeArchive(private=True)
614+ >>> from zope.security.proxy import removeSecurityProxy
615+ >>> removeSecurityProxy(diff.to_source).upload_archive = private_ppa
616
617 >>> print diff.private
618 True
619
620=== modified file 'lib/lp/soyuz/doc/sourcepackagerelease.txt'
621--- lib/lp/soyuz/doc/sourcepackagerelease.txt 2009-12-10 11:42:07 +0000
622+++ lib/lp/soyuz/doc/sourcepackagerelease.txt 2010-02-26 15:38:20 +0000
623@@ -265,11 +265,11 @@
624 >>> cprov = getUtility(IPersonSet).getByName('cprov')
625
626 >>> login('foo.bar@canonical.com')
627- >>> cprov.archive.buildd_secret = 'boing'
628- >>> cprov.archive.private = True
629+ >>> cprov_private_ppa = factory.makeArchive(
630+ ... owner=cprov, private=True)
631
632 >>> private_publication = test_publisher.getPubSource(
633- ... archive=cprov.archive)
634+ ... archive=cprov_private_ppa)
635
636 >>> test_sourcepackagerelease = private_publication.sourcepackagerelease
637 >>> print test_sourcepackagerelease.title
638
639=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt'
640--- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-01-20 14:29:59 +0000
641+++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-02-26 15:38:20 +0000
642@@ -15,12 +15,15 @@
643 ... SoyuzTestPublisher)
644 >>> from lp.registry.interfaces.person import IPersonSet
645
646-Make the PPA private.
647+Create a private PPA for no-priv.
648
649 >>> login('foo.bar@canonical.com')
650 >>> no_priv = getUtility(IPersonSet).getByName('no-priv')
651- >>> no_priv.archive.buildd_secret = 'x'
652- >>> no_priv.archive.private = True
653+ >>> from lp.registry.interfaces.distribution import IDistributionSet
654+ >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
655+ >>> no_priv_private_ppa = factory.makeArchive(
656+ ... owner=no_priv, private=True, name='p3a',
657+ ... distribution=ubuntu)
658
659 Initialise SoyuzTestPublisher.
660
661@@ -31,7 +34,7 @@
662 Publish a source.
663
664 >>> test_source = test_publisher.getPubSource(
665- ... archive=no_priv.archive, sourcename='test-pkg',
666+ ... archive=no_priv_private_ppa, sourcename='test-pkg',
667 ... version='1.0')
668 >>> dsc_file = test_source.sourcepackagerelease.files[0].libraryfile
669
670@@ -68,10 +71,12 @@
671 Create a subsequent source publication so a package diff can be provided.
672
673 >>> another_test_source = test_publisher.getPubSource(
674- ... archive=no_priv.archive, sourcename='test-pkg',
675+ ... archive=no_priv_private_ppa, sourcename='test-pkg',
676 ... version='1.1')
677 >>> another_dsc_file = (
678 ... another_test_source.sourcepackagerelease.files[0].libraryfile)
679+ >>> other_binary_pubs = test_publisher.getPubBinaries(
680+ ... binaryname='test-bin', pub_source=another_test_source)
681
682 >>> package_diff = test_source.sourcepackagerelease.requestDiffTo(
683 ... no_priv, another_test_source.sourcepackagerelease)
684@@ -145,26 +150,26 @@
685 >>> no_priv_browser = setupBrowser(
686 ... auth='Basic no-priv@canonical.com:test')
687 >>> no_priv_browser.open(
688- ... "http://launchpad.dev/~no-priv/+archive/ppa/+packages")
689+ ... "http://launchpad.dev/~no-priv/+archive/p3a/+packages")
690
691 >>> print no_priv_browser.title
692- Packages in “PPA for No Privileges Person”...
693+ Packages in “PPA named p3a for No Privileges Person”...
694
695 Source changesfiles are served on the PPA '+files' traversal.
696
697 >>> check_urls(no_priv_browser, ppa_links,
698- ... 'http://launchpad.dev/~no-priv/+archive/ppa')
699+ ... 'http://launchpad.dev/~no-priv/+archive/p3a')
700 test-pkg_1.1_source.changes: OK
701
702 >>> no_priv_browser.getLink('Copy packages').click()
703 >>> check_urls(no_priv_browser, ppa_links,
704- ... 'http://launchpad.dev/~no-priv/+archive/ppa')
705+ ... 'http://launchpad.dev/~no-priv/+archive/p3a')
706 test-pkg_1.1_source.changes: OK
707
708 >>> no_priv_browser.getLink('Cancel').click()
709 >>> no_priv_browser.getLink('Delete packages').click()
710 >>> check_urls(no_priv_browser, ppa_links,
711- ... 'http://launchpad.dev/~no-priv/+archive/ppa')
712+ ... 'http://launchpad.dev/~no-priv/+archive/p3a')
713 test-pkg_1.1_source.changes: OK
714
715 Buildlogs are served on the Build '+files' traversal, when the PPA
716@@ -176,11 +181,11 @@
717 >>> no_priv_browser.getControl("Filter").click()
718
719 >>> check_urls(no_priv_browser, builds_links,
720- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/31')
721+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/31')
722 buildlog_ubuntu-breezy-autotest-i386.test-pkg_1.0_FULLYBUILT.txt.gz: OK
723
724 >>> no_priv_browser.open(
725- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+packages')
726+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+packages')
727
728 Source and binary files, in the expandable-row area, are served via
729 the PPA '+files' traversal.
730@@ -190,7 +195,7 @@
731 >>> no_priv_browser.getLink(id=expander_id).click()
732
733 >>> check_urls(no_priv_browser, ppa_1_0_links,
734- ... 'http://launchpad.dev/~no-priv/+archive/ppa')
735+ ... 'http://launchpad.dev/~no-priv/+archive/p3a')
736 test-pkg_1.0.dsc: OK
737 test-pkg_1.0.tar.gz: OK
738 test-bin_1.0_all.deb: OK
739@@ -200,10 +205,10 @@
740
741 >>> no_priv_browser.getLink('i386').click()
742 >>> print no_priv_browser.title
743- PPA for No Privileges Person : No Privileges Person
744+ PPA named p3a for No Privileges Person : No Privileges Person
745
746 >>> check_urls(no_priv_browser, build_links,
747- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/31')
748+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/31')
749 test-bin_1.0_i386.changes: OK
750 buildlog_...txt.gz: OK
751 upload_..._log.txt: OK
752@@ -212,14 +217,14 @@
753 '+files' traversal.
754
755 >>> no_priv_browser.open(
756- ... "http://launchpad.dev/~no-priv/+archive/ppa/+packages")
757+ ... "http://launchpad.dev/~no-priv/+archive/p3a/+packages")
758
759 >>> expander_id = find_tags_by_class(
760 ... no_priv_browser.contents, 'expander')[0]['id']
761 >>> no_priv_browser.getLink(id=expander_id).click()
762
763 >>> check_urls(no_priv_browser, ppa_1_1_links,
764- ... 'http://launchpad.dev/~no-priv/+archive/ppa')
765+ ... 'http://launchpad.dev/~no-priv/+archive/p3a')
766 test-pkg_1.1.dsc: OK
767 test-pkg_1.0_1.1.diff.gz: OK
768
769@@ -230,7 +235,7 @@
770 >>> file_size = str(dsc_file.content.filesize)
771 >>> file_mimetype = dsc_file.mimetype
772 >>> file_lp_url = str(
773- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %
774+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+files/%s' %
775 ... dsc_file.filename)
776 >>> logout()
777
778@@ -271,13 +276,13 @@
779 >>> buildlog_content = buildlog.read()
780 >>> buildlog_size = str(buildlog.content.filesize)
781 >>> buildlog_lp_url = str(
782- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+build/%d/+files/%s' %
783+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+build/%d/+files/%s' %
784 ... (build.id, buildlog.filename))
785
786 >>> diff_content = package_diff.diff_content.read()
787 >>> diff_size = str(package_diff.diff_content.content.filesize)
788 >>> diff_lp_url = str(
789- ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %
790+ ... 'http://launchpad.dev/~no-priv/+archive/p3a/+files/%s' %
791 ... package_diff.diff_content.filename)
792
793 >>> logout()
794@@ -321,19 +326,25 @@
795 >>> print no_priv_browser.headers['content-encoding']
796 gzip
797
798-When the PPA and the `LibraryFileAlias` become public, the +files/
799-proxy redirects to the public http url.
800-
801- >>> login('foo.bar@canonical.com')
802-
803- >>> no_priv = getUtility(IPersonSet).getByName('no-priv')
804- >>> no_priv.archive.buildd_secret = ''
805- >>> no_priv.archive.private = False
806+If the associated PPA and the `LibraryFileAlias` are public, the +files/
807+proxy redirects to the public http url. We'll copy the test sources and
808+binaries across to no-priv's public ppa.
809+
810+ >>> login_person(no_priv)
811+ >>> from lp.soyuz.scripts.packagecopier import do_copy
812+ >>> from lp.soyuz.interfaces.publishing import PackagePublishingPocket
813+ >>> copies = do_copy(
814+ ... no_priv_private_ppa.getPublishedSources(name='test-pkg'),
815+ ... no_priv.archive, series=ubuntu['warty'],
816+ ... pocket=PackagePublishingPocket.RELEASE,
817+ ... include_binaries=True, allow_delayed_copies=False)
818
819 >>> from zope.security.proxy import removeSecurityProxy
820 >>> removeSecurityProxy(dsc_file).restricted = False
821-
822 >>> file_librarian_url = dsc_file.http_url
823+ >>> file_lp_url = str(
824+ ... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %
825+ ... dsc_file.filename)
826
827 >>> commit()
828 >>> logout()
829@@ -372,7 +383,7 @@
830 The same redirection happens for +archive/+build/blah urls:
831
832 >>> buildlog_lp_url_without_ppa_name = buildlog_lp_url.replace(
833- ... '/ppa', '')
834+ ... '/p3a', '')
835 >>> print buildlog_lp_url_without_ppa_name
836 http://.../~no-priv/+archive/+build/31/+files/...
837
838
839=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
840--- lib/lp/soyuz/tests/test_publishing.py 2010-02-23 11:53:08 +0000
841+++ lib/lp/soyuz/tests/test_publishing.py 2010-02-26 15:38:20 +0000
842@@ -263,9 +263,8 @@
843 pocket=PackagePublishingPocket.RELEASE,
844 format=BinaryPackageFormat.DEB,
845 scheduleddeletiondate=None, dateremoved=None,
846- distroseries=None,
847- archive=None,
848- pub_source=None):
849+ distroseries=None, archive=None,
850+ pub_source=None, builder=None):
851 """Return a list of binary publishing records."""
852 if distroseries is None:
853 distroseries = self.distroseries
854@@ -284,6 +283,7 @@
855 builds = pub_source.createMissingBuilds()
856 published_binaries = []
857 for build in builds:
858+ build.builder = builder
859 binarypackagerelease = self.uploadBinaryForBuild(
860 build, binaryname, filecontent, summary, description,
861 shlibdep, depends, recommends, suggests, conflicts, replaces,
862
863=== modified file 'lib/lp/testing/factory.py'
864--- lib/lp/testing/factory.py 2010-02-26 15:38:18 +0000
865+++ lib/lp/testing/factory.py 2010-02-26 15:38:20 +0000
866@@ -1559,7 +1559,7 @@
867
868 def makeArchive(self, distribution=None, owner=None, name=None,
869 purpose=None, enabled=True, private=False,
870- virtualized=True):
871+ virtualized=True, description=None):
872 """Create and return a new arbitrary archive.
873
874 :param distribution: Supply IDistribution, defaults to a new one
875@@ -1571,6 +1571,7 @@
876 :param enabled: Whether the archive is enabled.
877 :param private: Whether the archive is created private.
878 :param virtualized: Whether the archive is virtualized.
879+ :param description: A description of the archive.
880 """
881 if distribution is None:
882 distribution = self.makeDistribution()
883@@ -1592,7 +1593,7 @@
884 archive = getUtility(IArchiveSet).new(
885 owner=owner, purpose=purpose,
886 distribution=distribution, name=name, enabled=enabled,
887- require_virtualized=virtualized)
888+ require_virtualized=virtualized, description=description)
889
890 if private:
891 archive.private = True