Merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor3 into lp:launchpad
- ppa-privatisation-test-refactor3
- Merge into devel
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Henning Eggers | ||||
Approved revision: | not available | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor3 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor2 | ||||
Diff against target: |
751 lines (+194/-174) 9 files modified
lib/canonical/launchpad/doc/publishing-security.txt (+48/-47) lib/canonical/launchpad/doc/tales.txt (+33/-28) lib/lp/registry/browser/tests/person-views.txt (+5/-7) lib/lp/soyuz/browser/tests/archive-views.txt (+14/-22) lib/lp/soyuz/browser/tests/archivesubscription-views.txt (+16/-15) lib/lp/soyuz/browser/tests/builder-views.txt (+4/-4) lib/lp/soyuz/doc/archive-dependencies.txt (+35/-26) lib/lp/soyuz/doc/buildd-slavescanner.txt (+32/-22) lib/lp/testing/factory.py (+7/-3) |
||||
To merge this branch: | bzr merge lp:~michael.nelson/launchpad/ppa-privatisation-test-refactor3 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Henning Eggers (community) | code | Approve | |
Review via email: mp+19864@code.launchpad.net |
Commit message
Description of the change
Michael Nelson (michael.nelson) wrote : | # |
Henning Eggers (henninge) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Michael!
Sorry for the delay. This branch looks mostly good but I have a few
stylistic issues about comments in doctests and a couple of long lines.
The only real test issue is about 'foo.bar'. Please consider that and if
I am wrong, ignore my comment. ;-)
You are good to land this when these issues have been attended to.
review approve code
Thank you for your good work! ;-)
Cheers,
Hennig
> === modified file 'lib/canonical/
> --- lib/canonical/
> +++ lib/canonical/
> @@ -8,50 +8,49 @@
> are no restrictions. For those attached to a private archive, only those able
> to view the archive, or admins, can see the publication.
>
> -As an anonymous user get the first published source and binary out of cprov's
> -public PPA:
> + # Create two ppas, one public and one private and publish to both.
A comment in a doc test is very uncommon AFAIK. Since all text in here
are explanations, why not put this into the main text? "We have two
ppas, a public one and a private one. Both are published." Or something
like that.
> + >>> login('<email address hidden>')
> + >>> public_ppa = factory.
> + >>> private_ppa = factory.
> + >>> from lp.soyuz.
> + >>> test_publisher = SoyuzTestPublis
> + >>> test_publisher.
> + >>> ignore = test_publisher.
> + >>> ignore = test_publisher.
> +
> +
> +As an anonymous user we can get the first published source and binary out
> +the public PPA:
>
> >>> login(ANONYMOUS)
> -
> - >>> from canonical.
> - >>> cprov_ppa = getUtility(
> - >>> cprov_ppa.private
> - False
> -
> - >>> source_pub = cprov_ppa.
> + >>> source_pub = public_
> >>> print source_
> - cdrkit 1.0 in breezy-autotest
> + foo 666 in breezy-autotest
>
> - >>> binary_pub = cprov_ppa.
> + >>> binary_pub = public_
> >>> print binary_
> - mozilla-firefox 1.0 in warty hppa
> + foo-bin 666 in breezy-autotest i386
>
> A regular user can see them too:
>
> >>> login('<email address hidden>')
> - >>> source_pub = cprov_ppa.
> + >>> source_pub = public_
> >>> print source_
> - cdrkit 1.0 in breezy-autotest
> + foo 666 in breezy-autotest
>
> - >>> binary_pub = cprov_ppa.
> + >>> binary_pub = public_
> >>> print binary_
> - mozilla-firefox 1.0 in warty hppa
> -
> -Now, we'll make cprov's PPA private:
> -
> - >>> login('<email address hidden>')
> - >>> cprov_ppa.private = True
> - >>> cpr...
Michael Nelson (michael.nelson) wrote : | # |
On Tue, Feb 23, 2010 at 11:00 AM, Henning Eggers
<email address hidden> wrote:
> Review: Approve code
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Michael!
>
> Sorry for the delay. This branch looks mostly good but I have a few
> stylistic issues about comments in doctests and a couple of long lines.
> The only real test issue is about 'foo.bar'. Please consider that and if
> I am wrong, ignore my comment. ;-)
Thanks for all the thoughts below!
>
> You are good to land this when these issues have been attended to.
>
> review approve code
>
> Thank you for your good work! ;-)
>
> Cheers,
> Hennig
>
>
>> === modified file 'lib/canonical/
>> --- lib/canonical/
>> +++ lib/canonical/
>> @@ -8,50 +8,49 @@
>> are no restrictions. For those attached to a private archive, only those able
>> to view the archive, or admins, can see the publication.
>>
>> -As an anonymous user get the first published source and binary out of cprov's
>> -public PPA:
>> + # Create two ppas, one public and one private and publish to both.
>
> A comment in a doc test is very uncommon AFAIK. Since all text in here
> are explanations, why not put this into the main text? "We have two
> ppas, a public one and a private one. Both are published." Or something
> like that.
>
True. I've tended to add python comments just to indicate that it is
not part of the narrative, but rather is setup code. But I'll stop now
:)
>> === modified file 'lib/canonical/
>> --- lib/canonical/
>> +++ lib/canonical/
>> @@ -126,55 +126,59 @@
>> for referring to them in other pages and a 'reference' formatter which
>> displays the unique ppa reference.
>>
>> - >>> print test_tales(
>> - <a href="/
>> - class="sprite ppa-icon">PPA for Mark Shuttleworth</a>
>> - >>> print test_tales(
>> - ppa:mark/ppa
>> + >>> login('<email address hidden>')
>> + >>> owner = factory.
>> + >>> public_ppa = factory.
>> + ... name='ppa', private=False, owner=owner)
>> + >>> login(ANONYMOUS)
>> + >>> print test_tales(
>> + <a href="/
>> + class="sprite ppa-icon">PPA for Joe Smith</a>
>> + >>> print test_tales(
>> + ppa:joe/ppa
>>
>> Disabled PPAs links use a different icon and are only linkified for
>> users with launchpad.View on them.
>>
>> - >>> login('<email address hidden>')
>> - >>> mark.archive.
>> + >>> login('<email address hidden>')
>> + >>> public_
>>
>> - >>> print test_tales(
>> - <a href="/
>> - for Mark Shuttleworth</a>
>> + >>> print test_tales(
1 | === modified file 'lib/canonical/launchpad/doc/publishing-security.txt' |
2 | --- lib/canonical/launchpad/doc/publishing-security.txt 2010-02-22 09:38:40 +0000 |
3 | +++ lib/canonical/launchpad/doc/publishing-security.txt 2010-02-23 15:07:20 +0000 |
4 | @@ -8,7 +8,9 @@ |
5 | are no restrictions. For those attached to a private archive, only those able |
6 | to view the archive, or admins, can see the publication. |
7 | |
8 | - # Create two ppas, one public and one private and publish to both. |
9 | +We create two PPAs, one public and one private. Both PPAs are populated |
10 | +with some source and binary publishings. |
11 | + |
12 | >>> login('admin@canonical.com') |
13 | >>> public_ppa = factory.makeArchive(private=False) |
14 | >>> private_ppa = factory.makeArchive(private=True) |
15 | |
16 | === modified file 'lib/canonical/launchpad/doc/tales.txt' |
17 | --- lib/canonical/launchpad/doc/tales.txt 2010-02-22 10:30:09 +0000 |
18 | +++ lib/canonical/launchpad/doc/tales.txt 2010-02-23 12:43:46 +0000 |
19 | @@ -170,18 +170,19 @@ |
20 | Similarly, references to private PPAs are not rendered unless the user has |
21 | a subscription to the PPA. |
22 | |
23 | - >>> login('foo.bar@canonical.com') |
24 | + >>> ppa_user = factory.makePerson(name="jake", displayname="Jake Smith") |
25 | + >>> login_person(ppa_user) |
26 | >>> print test_tales("ppa/fmt:reference", ppa=private_ppa) |
27 | |
28 | >>> login_person(owner) |
29 | - >>> foo = getUtility(IPersonSet).getByName('name16') |
30 | - >>> ignore = private_ppa.newSubscription(foo, owner) |
31 | - >>> login('foo.bar@canonical.com') |
32 | + >>> ignore = private_ppa.newSubscription(ppa_user, owner) |
33 | + >>> login_person(ppa_user) |
34 | >>> print test_tales("ppa/fmt:reference", ppa=private_ppa) |
35 | ppa:joe/ppa |
36 | |
37 | We also have icons for builds which may have different dimensions. |
38 | |
39 | + >>> login('admin@canonical.com') |
40 | >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
41 | >>> stp = SoyuzTestPublisher() |
42 | >>> stp.prepareBreezyAutotest() |
43 | |
44 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' |
45 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2010-02-22 11:11:52 +0000 |
46 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2010-02-23 14:47:03 +0000 |
47 | @@ -1008,8 +1008,8 @@ |
48 | ... print dependency.value.displayname |
49 | PPA for Pirulito Team |
50 | |
51 | -Remove Celso's membership on the new team and disable subsequent tests |
52 | -unaffected. |
53 | +Remove Celso's membership on the new team and disable his PPA so we don't |
54 | +affect the following tests. |
55 | |
56 | >>> cprov.leave(a_team) |
57 | >>> cprov_private_ppa.disable() |
58 | |
59 | === modified file 'lib/lp/soyuz/browser/tests/archivesubscription-views.txt' |
60 | --- lib/lp/soyuz/browser/tests/archivesubscription-views.txt 2010-02-22 12:55:58 +0000 |
61 | +++ lib/lp/soyuz/browser/tests/archivesubscription-views.txt 2010-02-23 14:49:47 +0000 |
62 | @@ -33,7 +33,8 @@ |
63 | The view includes a label property. |
64 | |
65 | >>> login('celso.providelo@canonical.com') |
66 | - >>> view = create_initialized_view(cprov_private_ppa, name="+subscriptions") |
67 | + >>> view = create_initialized_view( |
68 | + ... cprov_private_ppa, name="+subscriptions") |
69 | >>> print view.label |
70 | Manage access to PPA for Celso Providelo |
71 | |
72 | |
73 | === modified file 'lib/lp/soyuz/doc/archive-dependencies.txt' |
74 | --- lib/lp/soyuz/doc/archive-dependencies.txt 2010-02-22 13:46:34 +0000 |
75 | +++ lib/lp/soyuz/doc/archive-dependencies.txt 2010-02-23 14:53:45 +0000 |
76 | @@ -271,16 +271,15 @@ |
77 | main restricted universe multiverse |
78 | |
79 | The authentication information gets added for private PPA |
80 | -dependencies. |
81 | +dependencies. We'll create a private PPA and then update cprov's PPA, |
82 | +removing the dependency on Mark's public PPA and adding one for the |
83 | +new private PPA. |
84 | |
85 | >>> private_ppa = factory.makeArchive( |
86 | ... owner=mark, name='p3a', private=True, distribution=ubuntu) |
87 | >>> pub_binaries = test_publisher.getPubBinaries( |
88 | ... binaryname='dep-bin', archive=private_ppa, |
89 | ... status=PackagePublishingStatus.PUBLISHED) |
90 | - |
91 | - # Remove the dependency on mark's archive and add one for the |
92 | - # private PPA. |
93 | >>> cprov.archive.removeArchiveDependency(mark.archive) |
94 | >>> archive_dependency = cprov.archive.addArchiveDependency( |
95 | ... private_ppa, PackagePublishingPocket.RELEASE, |
96 | |
97 | === modified file 'lib/lp/soyuz/doc/buildd-slavescanner.txt' |
98 | --- lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-02-19 16:29:30 +0000 |
99 | +++ lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-02-23 15:09:43 +0000 |
100 | @@ -1175,8 +1175,9 @@ |
101 | ... owner=cprov_archive.owner, name='pppa', private=True, |
102 | ... virtualized=False, distribution=ubuntu) |
103 | |
104 | - # We need to publish some binaries so that the dependencies will include |
105 | - # this ppa itself below in the sources list. |
106 | +It's necessary to publish some binaries into the private PPA, otherwise |
107 | +the PPA won't be included as a dependency in the sources list below. |
108 | + |
109 | >>> binaries = test_publisher.getPubBinaries( |
110 | ... distroseries=ubuntu['hoary'], archive=private_ppa, |
111 | ... status=PackagePublishingStatus.PUBLISHED) |
112 | @@ -1210,11 +1211,11 @@ |
113 | >>> removeSecurityProxy(a_builder)._dispatchBuildCandidate(candidate) |
114 | ensurepresent called, url=... |
115 | ensurepresent called, |
116 | - url=http://private-ppa.launchpad.dev/cprov/pppa/ubuntu/pool/main/m/mozilla-firefox/firefox_0.9.2.orig.tar.gz |
117 | + url=http://private-ppa.../cprov/pppa/.../firefox_0.9.2.orig.tar.gz |
118 | URL authorisation with buildd/sekrit |
119 | OkSlave BUILDING |
120 | Archives: |
121 | - deb http://buildd:sekrit@private-ppa.launchpad.dev/cprov/pppa/ubuntu hoary main |
122 | + deb http://buildd:sekrit@private-ppa.../cprov/pppa/ubuntu hoary main |
123 | deb http://ftpmaster.internal/ubuntu hoary |
124 | main restricted universe multiverse |
125 | deb http://ftpmaster.internal/ubuntu hoary-security |
126 | @@ -1301,8 +1302,9 @@ |
127 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
128 | >>> login('foo.bar@canonical.com') |
129 | |
130 | - # Switch the build's archive back to Celso's PPA and set it back |
131 | - # to virtualized. |
132 | +We'll switch the build's archive back to Celso's PPA and set the PPA to |
133 | +virtualized before adding the dependency on Mark's PPA. |
134 | + |
135 | >>> removeSecurityProxy(build).archive = cprov_archive |
136 | >>> cprov_archive.require_virtualized = True |
137 | >>> for build_file in a_build.sourcepackagerelease.files: |
Henning Eggers (henninge) wrote : | # |
Thank you for the fixes! ;)
Preview Diff
1 | === modified file 'lib/canonical/launchpad/doc/publishing-security.txt' |
2 | --- lib/canonical/launchpad/doc/publishing-security.txt 2009-04-16 16:05:48 +0000 |
3 | +++ lib/canonical/launchpad/doc/publishing-security.txt 2010-02-26 15:36:26 +0000 |
4 | @@ -8,50 +8,51 @@ |
5 | are no restrictions. For those attached to a private archive, only those able |
6 | to view the archive, or admins, can see the publication. |
7 | |
8 | -As an anonymous user get the first published source and binary out of cprov's |
9 | -public PPA: |
10 | +We create two PPAs, one public and one private. Both PPAs are populated |
11 | +with some source and binary publishings. |
12 | + |
13 | + >>> login('admin@canonical.com') |
14 | + >>> public_ppa = factory.makeArchive(private=False) |
15 | + >>> private_ppa = factory.makeArchive(private=True) |
16 | + >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
17 | + >>> test_publisher = SoyuzTestPublisher() |
18 | + >>> test_publisher.prepareBreezyAutotest() |
19 | + >>> ignore = test_publisher.getPubBinaries(archive=public_ppa) |
20 | + >>> ignore = test_publisher.getPubBinaries(archive=private_ppa) |
21 | + |
22 | + |
23 | +As an anonymous user we can get the first published source and binary out |
24 | +the public PPA: |
25 | |
26 | >>> login(ANONYMOUS) |
27 | - |
28 | - >>> from canonical.launchpad.interfaces import IPersonSet |
29 | - >>> cprov_ppa = getUtility(IPersonSet).getByName('cprov').archive |
30 | - >>> cprov_ppa.private |
31 | - False |
32 | - |
33 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
34 | + >>> source_pub = public_ppa.getPublishedSources()[0] |
35 | >>> print source_pub.displayname |
36 | - cdrkit 1.0 in breezy-autotest |
37 | + foo 666 in breezy-autotest |
38 | |
39 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
40 | + >>> binary_pub = public_ppa.getAllPublishedBinaries()[0] |
41 | >>> print binary_pub.displayname |
42 | - mozilla-firefox 1.0 in warty hppa |
43 | + foo-bin 666 in breezy-autotest i386 |
44 | |
45 | A regular user can see them too: |
46 | |
47 | >>> login('no-priv@canonical.com') |
48 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
49 | + >>> source_pub = public_ppa.getPublishedSources()[0] |
50 | >>> print source_pub.displayname |
51 | - cdrkit 1.0 in breezy-autotest |
52 | + foo 666 in breezy-autotest |
53 | |
54 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
55 | + >>> binary_pub = public_ppa.getAllPublishedBinaries()[0] |
56 | >>> print binary_pub.displayname |
57 | - mozilla-firefox 1.0 in warty hppa |
58 | - |
59 | -Now, we'll make cprov's PPA private: |
60 | - |
61 | - >>> login('admin@canonical.com') |
62 | - >>> cprov_ppa.private = True |
63 | - >>> cprov_ppa.buildd_secret = "blah" |
64 | - |
65 | -Anonymous access will now be refused: |
66 | + foo-bin 666 in breezy-autotest i386 |
67 | + |
68 | +But when querying the private PPA, anonymous access will be refused: |
69 | |
70 | >>> login(ANONYMOUS) |
71 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
72 | + >>> source_pub = private_ppa.getPublishedSources()[0] |
73 | Traceback (most recent call last): |
74 | ... |
75 | Unauthorized:... |
76 | |
77 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
78 | + >>> binary_pub = private_ppa.getAllPublishedBinaries()[0] |
79 | Traceback (most recent call last): |
80 | ... |
81 | Unauthorized:... |
82 | @@ -59,35 +60,35 @@ |
83 | As is for a regular user. |
84 | |
85 | >>> login('no-priv@canonical.com') |
86 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
87 | - Traceback (most recent call last): |
88 | - ... |
89 | - Unauthorized:... |
90 | - |
91 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
92 | - Traceback (most recent call last): |
93 | - ... |
94 | - Unauthorized:... |
95 | - |
96 | -But cprov himself can see them: |
97 | - |
98 | - >>> login('celso.providelo@canonical.com') |
99 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
100 | + >>> source_pub = private_ppa.getPublishedSources()[0] |
101 | + Traceback (most recent call last): |
102 | + ... |
103 | + Unauthorized:... |
104 | + |
105 | + >>> binary_pub = private_ppa.getAllPublishedBinaries()[0] |
106 | + Traceback (most recent call last): |
107 | + ... |
108 | + Unauthorized:... |
109 | + |
110 | +But the owner can see them. |
111 | + |
112 | + >>> login_person(private_ppa.owner) |
113 | + >>> source_pub = private_ppa.getPublishedSources()[0] |
114 | >>> print source_pub.displayname |
115 | - cdrkit 1.0 in breezy-autotest |
116 | + foo 666 in breezy-autotest |
117 | |
118 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
119 | + >>> binary_pub = private_ppa.getAllPublishedBinaries()[0] |
120 | >>> print binary_pub.displayname |
121 | - mozilla-firefox 1.0 in warty hppa |
122 | + foo-bin 666 in breezy-autotest i386 |
123 | |
124 | As can an administrator. |
125 | |
126 | >>> login('admin@canonical.com') |
127 | - >>> source_pub = cprov_ppa.getPublishedSources()[0] |
128 | + >>> source_pub = private_ppa.getPublishedSources()[0] |
129 | >>> print source_pub.displayname |
130 | - cdrkit 1.0 in breezy-autotest |
131 | + foo 666 in breezy-autotest |
132 | |
133 | - >>> binary_pub = cprov_ppa.getAllPublishedBinaries()[0] |
134 | + >>> binary_pub = private_ppa.getAllPublishedBinaries()[0] |
135 | >>> print binary_pub.displayname |
136 | - mozilla-firefox 1.0 in warty hppa |
137 | + foo-bin 666 in breezy-autotest i386 |
138 | |
139 | |
140 | === modified file 'lib/canonical/launchpad/doc/tales.txt' |
141 | --- lib/canonical/launchpad/doc/tales.txt 2010-02-16 16:31:24 +0000 |
142 | +++ lib/canonical/launchpad/doc/tales.txt 2010-02-26 15:36:26 +0000 |
143 | @@ -126,58 +126,63 @@ |
144 | for referring to them in other pages and a 'reference' formatter which |
145 | displays the unique ppa reference. |
146 | |
147 | - >>> print test_tales("ppa/fmt:link", ppa=mark.archive) |
148 | - <a href="/~mark/+archive/ppa" |
149 | - class="sprite ppa-icon">PPA for Mark Shuttleworth</a> |
150 | - >>> print test_tales("ppa/fmt:reference", ppa=mark.archive) |
151 | - ppa:mark/ppa |
152 | + >>> login('admin@canonical.com') |
153 | + >>> owner = factory.makePerson(name="joe", displayname="Joe Smith") |
154 | + >>> public_ppa = factory.makeArchive( |
155 | + ... name='ppa', private=False, owner=owner) |
156 | + >>> login(ANONYMOUS) |
157 | + >>> print test_tales("ppa/fmt:link", ppa=public_ppa) |
158 | + <a href="/~joe/+archive/ppa" |
159 | + class="sprite ppa-icon">PPA for Joe Smith</a> |
160 | + >>> print test_tales("ppa/fmt:reference", ppa=public_ppa) |
161 | + ppa:joe/ppa |
162 | |
163 | Disabled PPAs links use a different icon and are only linkified for |
164 | users with launchpad.View on them. |
165 | |
166 | - >>> login('foo.bar@canonical.com') |
167 | - >>> mark.archive.disable() |
168 | + >>> login('admin@canonical.com') |
169 | + >>> public_ppa.disable() |
170 | |
171 | - >>> print test_tales("ppa/fmt:link", ppa=mark.archive) |
172 | - <a href="/~mark/+archive/ppa" class="sprite ppa-icon-inactive">PPA |
173 | - for Mark Shuttleworth</a> |
174 | + >>> print test_tales("ppa/fmt:link", ppa=public_ppa) |
175 | + <a href="/~joe/+archive/ppa" class="sprite ppa-icon-inactive">PPA |
176 | + for Joe Smith</a> |
177 | |
178 | >>> login(ANONYMOUS) |
179 | |
180 | - >>> print test_tales("ppa/fmt:link", ppa=mark.archive) |
181 | - <span class="sprite ppa-icon-inactive">PPA for Mark Shuttleworth</span> |
182 | + >>> print test_tales("ppa/fmt:link", ppa=public_ppa) |
183 | + <span class="sprite ppa-icon-inactive">PPA for Joe Smith</span> |
184 | |
185 | Private PPAs links are not rendered for users without launchpad.View on |
186 | them. |
187 | |
188 | - >>> login('foo.bar@canonical.com') |
189 | - >>> mark.archive.enable() |
190 | - >>> mark.archive.buildd_secret = 'x' |
191 | - >>> mark.archive.private = True |
192 | + >>> login('admin@canonical.com') |
193 | + >>> private_ppa = factory.makeArchive( |
194 | + ... name='ppa', private=True, owner=owner) |
195 | |
196 | - >>> print test_tales("ppa/fmt:link", ppa=mark.archive) |
197 | - <a href="/~mark/+archive/ppa" class="sprite ppa-icon">PPA |
198 | - for Mark Shuttleworth</a> |
199 | + >>> print test_tales("ppa/fmt:link", ppa=private_ppa) |
200 | + <a href="/~joe/+archive/ppa" class="sprite ppa-icon">PPA |
201 | + for Joe Smith</a> |
202 | |
203 | >>> login(ANONYMOUS) |
204 | |
205 | - >>> print test_tales("ppa/fmt:link", ppa=mark.archive) |
206 | + >>> print test_tales("ppa/fmt:link", ppa=private_ppa) |
207 | |
208 | Similarly, references to private PPAs are not rendered unless the user has |
209 | a subscription to the PPA. |
210 | |
211 | - >>> login('foo.bar@canonical.com') |
212 | - >>> print test_tales("ppa/fmt:reference", ppa=mark.archive) |
213 | + >>> ppa_user = factory.makePerson(name="jake", displayname="Jake Smith") |
214 | + >>> login_person(ppa_user) |
215 | + >>> print test_tales("ppa/fmt:reference", ppa=private_ppa) |
216 | |
217 | - >>> login('mark@example.com') |
218 | - >>> foo = getUtility(IPersonSet).getByName('name16') |
219 | - >>> ignore = mark.archive.newSubscription(foo, mark) |
220 | - >>> login('foo.bar@canonical.com') |
221 | - >>> print test_tales("ppa/fmt:reference", ppa=mark.archive) |
222 | - ppa:mark/ppa |
223 | + >>> login_person(owner) |
224 | + >>> ignore = private_ppa.newSubscription(ppa_user, owner) |
225 | + >>> login_person(ppa_user) |
226 | + >>> print test_tales("ppa/fmt:reference", ppa=private_ppa) |
227 | + ppa:joe/ppa |
228 | |
229 | We also have icons for builds which may have different dimensions. |
230 | |
231 | + >>> login('admin@canonical.com') |
232 | >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
233 | >>> stp = SoyuzTestPublisher() |
234 | >>> stp.prepareBreezyAutotest() |
235 | |
236 | === modified file 'lib/lp/registry/browser/tests/person-views.txt' |
237 | --- lib/lp/registry/browser/tests/person-views.txt 2010-02-02 21:28:50 +0000 |
238 | +++ lib/lp/registry/browser/tests/person-views.txt 2010-02-26 15:36:26 +0000 |
239 | @@ -868,20 +868,18 @@ |
240 | >>> view.should_show_ppa_section |
241 | True |
242 | |
243 | -If we make the PPA private, only cprov will see the section. |
244 | +If the PPA is private, only the owner will see the section. |
245 | |
246 | >>> login("admin@canonical.com") |
247 | - >>> cprov.archive.buildd_secret = "secret" |
248 | - >>> cprov.archive.private = True |
249 | - >>> transaction.commit() |
250 | + >>> private_ppa = factory.makeArchive(private=True) |
251 | |
252 | - >>> login("celso.providelo@canonical.com") |
253 | - >>> view = create_initialized_view(cprov, "+index") |
254 | + >>> login_person(private_ppa.owner) |
255 | + >>> view = create_initialized_view(private_ppa.owner, "+index") |
256 | >>> view.should_show_ppa_section |
257 | True |
258 | |
259 | >>> login(ANONYMOUS) |
260 | - >>> view = create_initialized_view(cprov, "+index") |
261 | + >>> view = create_initialized_view(private_ppa.owner, "+index") |
262 | >>> view.should_show_ppa_section |
263 | False |
264 | |
265 | |
266 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' |
267 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2010-02-11 13:26:21 +0000 |
268 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2010-02-26 15:36:26 +0000 |
269 | @@ -945,9 +945,7 @@ |
270 | >>> login('foo.bar@canonical.com') |
271 | >>> a_team = factory.makeTeam(mark, name="pirulito-team") |
272 | >>> team_ppa = factory.makeArchive( |
273 | - ... distribution=ubuntu, name='ppa', owner=a_team) |
274 | - >>> team_ppa.buildd_secret = 'boing' |
275 | - >>> team_ppa.private = True |
276 | + ... distribution=ubuntu, name='ppa', owner=a_team, private=True) |
277 | >>> transaction.commit() |
278 | >>> login('celso.providelo@canonical.com') |
279 | |
280 | @@ -987,38 +985,34 @@ |
281 | ... print error |
282 | Public PPAs cannot depend on private ones. |
283 | |
284 | -Finally, we make Celso's PPA private. That's enough for allowing Celso |
285 | -to set PPA for Pirulito Team as dependency of his PPA. |
286 | +Finally, we try with a private PPA of Celso's. That's enough for |
287 | +allowing Celso to set PPA for Pirulito Team as dependency of his PPA. |
288 | |
289 | >>> login('foo.bar@canonical.com') |
290 | - >>> cprov.archive.buildd_secret = 'boing' |
291 | - >>> cprov.archive.private = True |
292 | + >>> cprov_private_ppa = factory.makeArchive( |
293 | + ... owner=cprov, private=True, name='p3a') |
294 | >>> login('celso.providelo@canonical.com') |
295 | |
296 | >>> view = create_initialized_view( |
297 | - ... cprov.archive, name="+edit-dependencies", |
298 | + ... cprov_private_ppa, name="+edit-dependencies", |
299 | ... form=add_private_form) |
300 | |
301 | >>> len(view.errors) |
302 | 0 |
303 | |
304 | >>> view = create_initialized_view( |
305 | - ... cprov.archive, name="+edit-dependencies") |
306 | + ... cprov_private_ppa, name="+edit-dependencies") |
307 | |
308 | >>> dependencies = view.widgets.get('selected_dependencies').vocabulary |
309 | >>> for dependency in dependencies: |
310 | ... print dependency.value.displayname |
311 | PPA for Pirulito Team |
312 | |
313 | -Remove Celso's membership on the new team and made his PPA public |
314 | -again to not affect subsequent tests. |
315 | +Remove Celso's membership on the new team and disable his PPA so we don't |
316 | +affect the following tests. |
317 | |
318 | >>> cprov.leave(a_team) |
319 | - |
320 | - >>> login('foo.bar@canonical.com') |
321 | - >>> cprov.archive.private = False |
322 | - >>> cprov.archive.buildd_secret = '' |
323 | - >>> login('celso.providelo@canonical.com') |
324 | + >>> cprov_private_ppa.disable() |
325 | |
326 | |
327 | == ArchivePackageCopyingView == |
328 | @@ -1304,12 +1298,10 @@ |
329 | it happens via 'delayed-copies' not the usual direct copying method. |
330 | See more information in scripts/packagecopier.py |
331 | |
332 | -First we will make Celso's PPA private. |
333 | +First we will enable Celso's private PPA. |
334 | |
335 | >>> login('foo.bar@canonical.com') |
336 | - |
337 | - >>> cprov.archive.buildd_secret = 'boing' |
338 | - >>> cprov.archive.private = True |
339 | + >>> cprov_private_ppa.enable() |
340 | |
341 | Then we will create a testing publication, that will be restricted. |
342 | |
343 | @@ -1320,7 +1312,7 @@ |
344 | >>> test_publisher.addFakeChroots(hoary) |
345 | >>> unused = test_publisher.setUpDefaultDistroSeries(hoary) |
346 | >>> private_source = test_publisher.createSource( |
347 | - ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1') |
348 | + ... cprov_private_ppa, 'foocomm', '1.0-1', new_version='2.0-1') |
349 | >>> transaction.commit() |
350 | |
351 | Now, as Celso we will try to copy the just created 'private' source to |
352 | @@ -1334,7 +1326,7 @@ |
353 | |
354 | >>> login('celso.providelo@canonical.com') |
355 | >>> view = create_initialized_view( |
356 | - ... cprov.archive, name="+copy-packages", |
357 | + ... cprov_private_ppa, name="+copy-packages", |
358 | ... form={ |
359 | ... 'field.selected_sources': [str(private_source.id)], |
360 | ... 'field.destination_archive': 'ubuntu-team/ppa', |
361 | |
362 | === modified file 'lib/lp/soyuz/browser/tests/archivesubscription-views.txt' |
363 | --- lib/lp/soyuz/browser/tests/archivesubscription-views.txt 2009-09-14 08:08:51 +0000 |
364 | +++ lib/lp/soyuz/browser/tests/archivesubscription-views.txt 2010-02-26 15:36:26 +0000 |
365 | @@ -22,18 +22,19 @@ |
366 | >>> login('foo.bar@canonical.com') |
367 | >>> from lp.registry.interfaces.person import IPersonSet |
368 | >>> cprov = getUtility(IPersonSet).getByName("cprov") |
369 | - >>> cprov.archive.buildd_secret = 'boing' |
370 | - >>> cprov.archive.private = True |
371 | + >>> cprov_private_ppa = factory.makeArchive( |
372 | + ... owner=cprov, private=True) |
373 | >>> mark = getUtility(IPersonSet).getByName("mark") |
374 | - >>> mark.archive.buildd_secret = 'boing' |
375 | - >>> mark.archive.private = True |
376 | + >>> mark_private_ppa = factory.makeArchive( |
377 | + ... owner=mark, private=True) |
378 | >>> transaction.commit() |
379 | >>> logout() |
380 | |
381 | The view includes a label property. |
382 | |
383 | >>> login('celso.providelo@canonical.com') |
384 | - >>> view = create_initialized_view(cprov.archive, name="+subscriptions") |
385 | + >>> view = create_initialized_view( |
386 | + ... cprov_private_ppa, name="+subscriptions") |
387 | >>> print view.label |
388 | Manage access to PPA for Celso Providelo |
389 | |
390 | @@ -46,7 +47,7 @@ |
391 | POSTing with out data just causes the validation to display: |
392 | |
393 | >>> view = create_initialized_view( |
394 | - ... cprov.archive, name="+subscriptions", |
395 | + ... cprov_private_ppa, name="+subscriptions", |
396 | ... server_url= |
397 | ... "https://launchpad.dev/~cprov/+archive/ppa/+subscriptions", |
398 | ... form={ |
399 | @@ -60,7 +61,7 @@ |
400 | The view can be used to add a new subscriber: |
401 | |
402 | >>> view = create_initialized_view( |
403 | - ... cprov.archive, name="+subscriptions", |
404 | + ... cprov_private_ppa, name="+subscriptions", |
405 | ... server_url= |
406 | ... "https://launchpad.dev/~cprov/+archive/ppa/+subscriptions", |
407 | ... form={ |
408 | @@ -100,7 +101,7 @@ |
409 | The same subscriber cannot be added a second time: |
410 | |
411 | >>> view = create_initialized_view( |
412 | - ... cprov.archive, name="+subscriptions", |
413 | + ... cprov_private_ppa, name="+subscriptions", |
414 | ... form={ |
415 | ... 'field.subscriber': 'spiv', |
416 | ... 'field.description': "spiv's still my friend", |
417 | @@ -118,7 +119,7 @@ |
418 | |
419 | >>> login('mark@example.com') |
420 | >>> view = create_initialized_view( |
421 | - ... mark.archive, name="+subscriptions", |
422 | + ... mark_private_ppa, name="+subscriptions", |
423 | ... form={ |
424 | ... 'field.subscriber': 'spiv', |
425 | ... 'field.description': "spiv's still my friend", |
426 | @@ -135,7 +136,7 @@ |
427 | |
428 | >>> transaction.commit() |
429 | >>> view = create_initialized_view( |
430 | - ... mark.archive, name="+subscriptions", |
431 | + ... mark_private_ppa, name="+subscriptions", |
432 | ... server_url= |
433 | ... "https://launchpad.dev/~cprov/+archive/ppa/+subscriptions", |
434 | ... form={ |
435 | @@ -153,7 +154,7 @@ |
436 | >>> import datetime |
437 | >>> future_date = datetime.date.today() + datetime.timedelta(30) |
438 | >>> view = create_initialized_view( |
439 | - ... mark.archive, name="+subscriptions", |
440 | + ... mark_private_ppa, name="+subscriptions", |
441 | ... server_url= |
442 | ... "https://launchpad.dev/~cprov/+archive/ppa/+subscriptions", |
443 | ... form={ |
444 | @@ -178,7 +179,7 @@ |
445 | >>> from lp.soyuz.interfaces.archivesubscriber import ( |
446 | ... IArchiveSubscriberSet) |
447 | >>> spiv_subscription = getUtility(IArchiveSubscriberSet).getByArchive( |
448 | - ... cprov.archive).one() |
449 | + ... cprov_private_ppa).one() |
450 | >>> view = create_initialized_view(spiv_subscription, name="+edit") |
451 | >>> print view.label |
452 | Edit Andrew Bennetts's access to PPA for Celso Providelo |
453 | @@ -280,7 +281,7 @@ |
454 | 2 |
455 | |
456 | The subscriptions_with_tokens property returns all the current archive |
457 | -subscriptions for the person, with the corresponding token for each - |
458 | +subscriptions for the person, with the corresponding token for each - |
459 | if one exists: |
460 | |
461 | >>> def print_subscriptions_with_tokens(): |
462 | @@ -301,7 +302,7 @@ |
463 | subscriptions_with_tokens property: |
464 | |
465 | >>> spiv = getUtility(IPersonSet).getByName('spiv') |
466 | - >>> new_token = cprov.archive.newAuthToken(spiv) |
467 | + >>> new_token = cprov_private_ppa.newAuthToken(spiv) |
468 | >>> view = create_initialized_view(spiv, name="+archivesubscriptions") |
469 | >>> print_subscriptions_with_tokens() |
470 | PPA for Mark Shuttleworth None |
471 | @@ -352,7 +353,7 @@ |
472 | Andrew Bennetts |
473 | |
474 | >>> print view.sources_list_entries.context.archive_url |
475 | - http://spiv:...@private-ppa.launchpad.dev/cprov/ppa/ubuntu |
476 | + http://spiv:...@private-ppa.launchpad.dev/cprov/ppa/... |
477 | |
478 | The view can also be used to regenerate the source.list entries. |
479 | |
480 | |
481 | === modified file 'lib/lp/soyuz/browser/tests/builder-views.txt' |
482 | --- lib/lp/soyuz/browser/tests/builder-views.txt 2010-01-14 02:15:08 +0000 |
483 | +++ lib/lp/soyuz/browser/tests/builder-views.txt 2010-02-26 15:36:26 +0000 |
484 | @@ -134,11 +134,11 @@ |
485 | ... IBuilderSet, IPersonSet) |
486 | |
487 | >>> cprov = getUtility(IPersonSet).getByName("cprov") |
488 | - >>> cprov.archive.buildd_secret = "secret" |
489 | - >>> cprov.archive.private = True |
490 | + >>> cprov_private_ppa = factory.makeArchive( |
491 | + ... owner=cprov, private=True) |
492 | |
493 | SoyuzTestPublisher is used to make a new publication only in Celso's |
494 | -PPA. |
495 | +private PPA. |
496 | |
497 | >>> from lp.soyuz.tests.test_publishing import ( |
498 | ... SoyuzTestPublisher) |
499 | @@ -151,7 +151,7 @@ |
500 | >>> private_source_pub = test_publisher.getPubSource( |
501 | ... status=PackagePublishingStatus.PUBLISHED, |
502 | ... sourcename='privacy-test', |
503 | - ... archive=cprov.archive) |
504 | + ... archive=cprov_private_ppa) |
505 | >>> [private_build] = private_source_pub.createMissingBuilds() |
506 | |
507 | Assign the build to the 'frog' builder: |
508 | |
509 | === modified file 'lib/lp/soyuz/doc/archive-dependencies.txt' |
510 | --- lib/lp/soyuz/doc/archive-dependencies.txt 2010-02-26 13:42:51 +0000 |
511 | +++ lib/lp/soyuz/doc/archive-dependencies.txt 2010-02-26 15:36:26 +0000 |
512 | @@ -225,11 +225,11 @@ |
513 | |
514 | >>> print_building_sources_list(a_build) |
515 | deb http://ftpmaster.internal/ubuntu hoary |
516 | - main restricted universe multiverse |
517 | + main restricted universe multiverse |
518 | deb http://ftpmaster.internal/ubuntu hoary-security |
519 | - main restricted universe multiverse |
520 | + main restricted universe multiverse |
521 | deb http://ftpmaster.internal/ubuntu hoary-updates |
522 | - main restricted universe multiverse |
523 | + main restricted universe multiverse |
524 | |
525 | Once we publish a test binary in Celso's PPA hoary/i386, |
526 | this archive becomes relevant for building, and thus listed in the |
527 | @@ -242,11 +242,11 @@ |
528 | >>> print_building_sources_list(a_build) |
529 | deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main |
530 | deb http://ftpmaster.internal/ubuntu hoary |
531 | - main restricted universe multiverse |
532 | + main restricted universe multiverse |
533 | deb http://ftpmaster.internal/ubuntu hoary-security |
534 | - main restricted universe multiverse |
535 | + main restricted universe multiverse |
536 | deb http://ftpmaster.internal/ubuntu hoary-updates |
537 | - main restricted universe multiverse |
538 | + main restricted universe multiverse |
539 | |
540 | Similarly, populated PPA dependencies are listed in the building |
541 | 'sources_list'. |
542 | @@ -264,32 +264,41 @@ |
543 | deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main |
544 | deb http://ppa.launchpad.dev/mark/ppa/ubuntu hoary main |
545 | deb http://ftpmaster.internal/ubuntu hoary |
546 | - main restricted universe multiverse |
547 | + main restricted universe multiverse |
548 | deb http://ftpmaster.internal/ubuntu hoary-security |
549 | main restricted universe multiverse |
550 | deb http://ftpmaster.internal/ubuntu hoary-updates |
551 | - main restricted universe multiverse |
552 | + main restricted universe multiverse |
553 | |
554 | The authentication information gets added for private PPA |
555 | -dependencies. |
556 | - |
557 | - >>> mark.archive.buildd_secret = "not-so-secret" |
558 | - >>> mark.archive.private = True |
559 | - |
560 | - >>> print_building_sources_list(a_build) |
561 | - deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main |
562 | - deb http://buildd:not-so-secret@private-ppa.launchpad.dev/mark/ppa/ubuntu |
563 | - hoary main |
564 | - deb http://ftpmaster.internal/ubuntu hoary |
565 | - main restricted universe multiverse |
566 | - deb http://ftpmaster.internal/ubuntu hoary-security |
567 | - main restricted universe multiverse |
568 | - deb http://ftpmaster.internal/ubuntu hoary-updates |
569 | - main restricted universe multiverse |
570 | - |
571 | -Good enough, let's delete the archive dependency on Mark's PPA. |
572 | - |
573 | +dependencies. We'll create a private PPA and then update cprov's PPA, |
574 | +removing the dependency on Mark's public PPA and adding one for the |
575 | +new private PPA. |
576 | + |
577 | + >>> private_ppa = factory.makeArchive( |
578 | + ... owner=mark, name='p3a', private=True, distribution=ubuntu) |
579 | + >>> pub_binaries = test_publisher.getPubBinaries( |
580 | + ... binaryname='dep-bin', archive=private_ppa, |
581 | + ... status=PackagePublishingStatus.PUBLISHED) |
582 | >>> cprov.archive.removeArchiveDependency(mark.archive) |
583 | + >>> archive_dependency = cprov.archive.addArchiveDependency( |
584 | + ... private_ppa, PackagePublishingPocket.RELEASE, |
585 | + ... getUtility(IComponentSet)['main']) |
586 | + |
587 | + >>> print_building_sources_list(a_build) |
588 | + deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main |
589 | + deb http://buildd:sekrit@private-ppa.launchpad.dev/mark/p3a/ubuntu |
590 | + hoary main |
591 | + deb http://ftpmaster.internal/ubuntu hoary |
592 | + main restricted universe multiverse |
593 | + deb http://ftpmaster.internal/ubuntu hoary-security |
594 | + main restricted universe multiverse |
595 | + deb http://ftpmaster.internal/ubuntu hoary-updates |
596 | + main restricted universe multiverse |
597 | + |
598 | +Remove the private PPA dependency before continuing. |
599 | + |
600 | + >>> cprov.archive.removeArchiveDependency(private_ppa) |
601 | |
602 | >>> cprov.archive.external_dependencies is None |
603 | True |
604 | |
605 | === modified file 'lib/lp/soyuz/doc/buildd-slavescanner.txt' |
606 | --- lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-01-29 17:15:31 +0000 |
607 | +++ lib/lp/soyuz/doc/buildd-slavescanner.txt 2010-02-26 15:36:26 +0000 |
608 | @@ -881,16 +881,19 @@ |
609 | published. We need to tweak the status of the publishing record again |
610 | to demonstrate this, and also make the archive private: |
611 | |
612 | - >>> build = getUtility(IBuildSet).getByQueueEntry(new_candidate) |
613 | - >>> source = build.sourcepackagerelease |
614 | - >>> secure_pub = removeSecurityProxy( |
615 | - ... build).current_source_publication.secure_record |
616 | +XXX Michael Nelson 2010-02-19 bug=394276 Please let's put some time |
617 | +aside to convert these to unit-tests. |
618 | + |
619 | + >>> naked_build = removeSecurityProxy( |
620 | + ... getUtility(IBuildSet).getByQueueEntry(new_candidate)) |
621 | + >>> original_archive = naked_build.archive |
622 | + >>> secure_pub = naked_build.current_source_publication.secure_record |
623 | >>> commit() |
624 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
625 | + >>> private_ppa = factory.makeArchive(private=True) |
626 | + >>> naked_build.archive = private_ppa |
627 | + >>> secure_pub.archive = private_ppa |
628 | >>> secure_pub.status = PackagePublishingStatus.PENDING |
629 | - >>> test_archive = secure_pub.archive |
630 | - >>> test_archive.private = True |
631 | - >>> test_archive.buildd_secret = "secret" |
632 | >>> commit() |
633 | >>> LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser) |
634 | |
635 | @@ -924,11 +927,9 @@ |
636 | making the build be superseded and no candidate is returned. |
637 | |
638 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
639 | - >>> secure_pub = removeSecurityProxy( |
640 | - ... build).current_source_publication.secure_record |
641 | + >>> secure_pub = naked_build.current_source_publication.secure_record |
642 | >>> secure_pub.status = PackagePublishingStatus.DELETED |
643 | - >>> secure_pub = removeSecurityProxy( |
644 | - ... build).current_source_publication.secure_record |
645 | + >>> secure_pub = naked_build.current_source_publication.secure_record |
646 | >>> secure_pub.status = PackagePublishingStatus.SUPERSEDED |
647 | >>> commit() |
648 | >>> LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser) |
649 | @@ -949,7 +950,8 @@ |
650 | |
651 | >>> commit() |
652 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
653 | - >>> test_archive.private = False |
654 | + >>> naked_build.archive = original_archive |
655 | + >>> secure_pub.archive = original_archive |
656 | >>> commit() |
657 | >>> LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser) |
658 | |
659 | @@ -1162,19 +1164,24 @@ |
660 | If the build is for a private PPA, the slave scanner will pass a |
661 | sources.list entry that contains a password to access the archive. |
662 | |
663 | -Making Celso's PPA private and set the buildd_secret (which is the |
664 | -password for the archive): |
665 | - |
666 | >>> from canonical.testing import LaunchpadZopelessLayer |
667 | >>> commit() |
668 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
669 | >>> login('foo.bar@canonical.com') |
670 | - >>> cprov_archive.private = True |
671 | - >>> cprov_archive.buildd_secret = "secret" |
672 | - >>> cprov_archive.require_virtualized = False |
673 | >>> build = getUtility(IBuildSet).getByQueueEntry(candidate) |
674 | >>> for build_file in build.sourcepackagerelease.files: |
675 | ... removeSecurityProxy(build_file).libraryfile.restricted = True |
676 | + >>> private_ppa = factory.makeArchive( |
677 | + ... owner=cprov_archive.owner, name='pppa', private=True, |
678 | + ... virtualized=False, distribution=ubuntu) |
679 | + |
680 | +It's necessary to publish some binaries into the private PPA, otherwise |
681 | +the PPA won't be included as a dependency in the sources list below. |
682 | + |
683 | + >>> binaries = test_publisher.getPubBinaries( |
684 | + ... distroseries=ubuntu['hoary'], archive=private_ppa, |
685 | + ... status=PackagePublishingStatus.PUBLISHED) |
686 | + >>> removeSecurityProxy(build).archive = private_ppa |
687 | >>> commit() |
688 | >>> LaunchpadZopelessLayer.switchDbUser(test_dbuser) |
689 | >>> login(ANONYMOUS) |
690 | @@ -1204,11 +1211,11 @@ |
691 | >>> removeSecurityProxy(a_builder)._dispatchBuildCandidate(candidate) |
692 | ensurepresent called, url=... |
693 | ensurepresent called, |
694 | - url=http://private-ppa.launchpad.dev/cprov/ppa/ubuntu/pool/main/m/mozilla-firefox/firefox_0.9.2.orig.tar.gz |
695 | - URL authorisation with buildd/secret |
696 | + url=http://private-ppa.../cprov/pppa/.../firefox_0.9.2.orig.tar.gz |
697 | + URL authorisation with buildd/sekrit |
698 | OkSlave BUILDING |
699 | Archives: |
700 | - deb http://buildd:secret@private-ppa.launchpad.dev/cprov/ppa/ubuntu hoary main |
701 | + deb http://buildd:sekrit@private-ppa.../cprov/pppa/ubuntu hoary main |
702 | deb http://ftpmaster.internal/ubuntu hoary |
703 | main restricted universe multiverse |
704 | deb http://ftpmaster.internal/ubuntu hoary-security |
705 | @@ -1295,7 +1302,10 @@ |
706 | >>> LaunchpadZopelessLayer.switchDbUser('launchpad') |
707 | >>> login('foo.bar@canonical.com') |
708 | |
709 | - >>> cprov_archive.private = False |
710 | +We'll switch the build's archive back to Celso's PPA and set the PPA to |
711 | +virtualized before adding the dependency on Mark's PPA. |
712 | + |
713 | + >>> removeSecurityProxy(build).archive = cprov_archive |
714 | >>> cprov_archive.require_virtualized = True |
715 | >>> for build_file in a_build.sourcepackagerelease.files: |
716 | ... removeSecurityProxy(build_file).libraryfile.restricted = False |
717 | |
718 | === modified file 'lib/lp/testing/factory.py' |
719 | --- lib/lp/testing/factory.py 2010-02-26 15:36:25 +0000 |
720 | +++ lib/lp/testing/factory.py 2010-02-26 15:36:26 +0000 |
721 | @@ -1558,7 +1558,8 @@ |
722 | return getUtility(IComponentSet).ensure(name) |
723 | |
724 | def makeArchive(self, distribution=None, owner=None, name=None, |
725 | - purpose=None, enabled=True, private=False): |
726 | + purpose=None, enabled=True, private=False, |
727 | + virtualized=True): |
728 | """Create and return a new arbitrary archive. |
729 | |
730 | :param distribution: Supply IDistribution, defaults to a new one |
731 | @@ -1567,7 +1568,9 @@ |
732 | makePerson(). |
733 | :param name: Name of the archive, defaults to a random string. |
734 | :param purpose: Supply ArchivePurpose, defaults to PPA. |
735 | - :param enabled: Whether the archive should be enabled. |
736 | + :param enabled: Whether the archive is enabled. |
737 | + :param private: Whether the archive is created private. |
738 | + :param virtualized: Whether the archive is virtualized. |
739 | """ |
740 | if distribution is None: |
741 | distribution = self.makeDistribution() |
742 | @@ -1588,7 +1591,8 @@ |
743 | |
744 | archive = getUtility(IArchiveSet).new( |
745 | owner=owner, purpose=purpose, |
746 | - distribution=distribution, name=name, enabled=enabled) |
747 | + distribution=distribution, name=name, enabled=enabled, |
748 | + require_virtualized=virtualized) |
749 | |
750 | if private: |
751 | archive.private = True |
This is the third 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-privatisati on-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: pastebin. ubuntu. com/378292/
http://
This branch fixes:
bin/test -vv -t publishing- security. txt -t tales.txt -t person-views.txt -t archive-views.txt -t archivesubscrip tion-views. txt -t builder-views.txt -t archive- dependencies. txt -t buildd- slavescanner. txt
Thanks.