Merge lp://staging/~al-maisan/launchpad/unembargo-443075 into lp://staging/launchpad
- unembargo-443075
- Merge into devel
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp://staging/~al-maisan/launchpad/unembargo-443075 | ||||
Merge into: | lp://staging/launchpad | ||||
Diff against target: |
354 lines 8 files modified
lib/lp/soyuz/browser/tests/archive-views.txt (+2/-22) lib/lp/soyuz/doc/distroseriesqueue.txt (+2/-23) lib/lp/soyuz/interfaces/publishing.py (+1/-1) lib/lp/soyuz/model/queue.py (+22/-12) lib/lp/soyuz/scripts/tests/test_copypackage.py (+3/-20) lib/lp/soyuz/stories/webservice/xx-archive.txt (+4/-19) lib/lp/soyuz/tests/test_packageupload.py (+11/-4) lib/lp/soyuz/tests/test_publishing.py (+35/-0) |
||||
To merge this branch: | bzr merge lp://staging/~al-maisan/launchpad/unembargo-443075 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | Approve | ||
Review via email: mp+13114@code.staging.launchpad.net |
Commit message
Description of the change
Muharem Hrnjadovic (al-maisan) wrote : | # |
Abel Deuring (adeuring) wrote : | # |
Hi Muharem,
nice work, just a few cosmetic remarks, see below.
Abel
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -367,15 +367,6 @@
> assert self.sources.
> 'Source is mandatory for delayed copies.')
> self.setAccepted()
> - # The second assert guarantees that we'll actually have a SPR.
> - spr = self.mySourcePa
> - # Use the changesfile of the original upload.
> - changes_file_object = StringIO.StringIO(
> - spr.package_
> - self.notify(
> - announce_
> - changes_
> - self.syncUpdate()
>
> def rejectFromQueue
> """See `IPackageUpload
> @@ -496,6 +487,7 @@
> else:
> return None
>
> + @property
> def mySourcePackage
> """The source package release related to this queue item.
As a Property, this should be named my_source_
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -198,6 +198,9 @@
> self.assertEquals(
> PackageUploadSt
>
> + # Make sure no announcement email was sent at this point.
> + self.assertEqua
> +
> self.layer.
> self.layer.
>
> @@ -210,22 +213,26 @@
>
> # Check the announcement email.
> from_addr, to_addrs, raw_msg = stub.test_
> - # This is now a MIMEMultipart message.
> msg = message_
> body = msg.get_payload(0)
> body = body.get_
>
> - self.assertEqua
> self.assertEquals(
> - to_addrs, ['<email address hidden>'])
> + str(to_addrs), "['<email address hidden>']")
>
> expected_subject = (
> '[ubuntutest/
> 'dist-upgrader_
> self.assertEqua
>
> - self.assertTrue
> -
> + self.assertEqua
> + 'foocomm (1.0-2) breezy; urgency=low\n\n'
> + ' * Initial version\n\n'
> + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
> + 'Changed-By: Foo Bar <email address hidden>\n'
> + 'Maintainer: Launchpad team <email address hidden>\n'
> + 'http://
This line is a bit too long. Could you split itto two lines? (OK,
breaking the URL into two lin...
Abel Deuring (adeuring) wrote : | # |
Sorry, forgot another nitpick:
> > + self.assertEqua
> > + 'foocomm (1.0-2) breezy; urgency=low\n\n'
> > + ' * Initial version\n\n'
> > + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
> > + 'Changed-By: Foo Bar <email address hidden>\n'
> > + 'Maintainer: Launchpad team <email address hidden>\n'
> > + 'http://
> autotest/
IIRC, we agreed in a reviewer meeting a month ago or so to use
the expected value as the first parameter. So, could you move "body" a bit down?
Muharem Hrnjadovic (al-maisan) wrote : | # |
Abel Deuring wrote:
> Review: Approve
> Hi Muharem,
>
> nice work, just a few cosmetic remarks, see below.
Hello Abel,
I am thanking you for the prompt review. All your suggestion were
accommodated except for one. Please see the enclosed incremental diff as
well as my replies below for more detail.
>
> Abel
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -367,15 +367,6 @@
>> assert self.sources.
>> 'Source is mandatory for delayed copies.')
>> self.setAccepted()
>> - # The second assert guarantees that we'll actually have a SPR.
>> - spr = self.mySourcePa
>> - # Use the changesfile of the original upload.
>> - changes_file_object = StringIO.StringIO(
>> - spr.package_
>> - self.notify(
>> - announce_
>> - changes_
>> - self.syncUpdate()
>>
>> def rejectFromQueue
>> """See `IPackageUpload
>> @@ -496,6 +487,7 @@
>> else:
>> return None
>>
>> + @property
>> def mySourcePackage
>> """The source package release related to this queue item.
>
> As a Property, this should be named my_source_
Fixed.
>
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -198,6 +198,9 @@
>> self.assertEquals(
>> PackageUploadSt
>>
>> + # Make sure no announcement email was sent at this point.
>> + self.assertEqua
>> +
>> self.layer.
>> self.layer.
>>
>> @@ -210,22 +213,26 @@
>>
>> # Check the announcement email.
>> from_addr, to_addrs, raw_msg = stub.test_
>> - # This is now a MIMEMultipart message.
>> msg = message_
>> body = msg.get_payload(0)
>> body = body.get_
>>
>> - self.assertEqua
>> self.assertEquals(
>> - to_addrs, ['<email address hidden>'])
>> + str(to_addrs), "['<email address hidden>']")
>>
>> expected_subject = (
>> '[ubuntutest/
>> 'dist-upgrader_
>> self.assertEqua
>>
>> - self.assertTrue
>> -
>> + self.assertEqua
>> + 'foocomm (1.0-2) breezy; urgency=low\n\n'
>> + ' * Initial version\n\n'
>> + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
...
1 | === modified file 'lib/lp/soyuz/model/queue.py' |
2 | --- lib/lp/soyuz/model/queue.py 2009-10-09 09:43:12 +0000 |
3 | +++ lib/lp/soyuz/model/queue.py 2009-10-09 11:09:28 +0000 |
4 | @@ -488,7 +488,7 @@ |
5 | return None |
6 | |
7 | @property |
8 | - def mySourcePackageRelease(self): |
9 | + def my_source_package_release(self): |
10 | """The source package release related to this queue item. |
11 | |
12 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: |
13 | @@ -736,7 +736,7 @@ |
14 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
15 | |
16 | if self.sources or self.builds: |
17 | - message.SPR_URL = canonical_url(self.mySourcePackageRelease) |
18 | + message.SPR_URL = canonical_url(self.my_source_package_release) |
19 | |
20 | def _sendRejectionNotification( |
21 | self, recipients, changes_lines, changes, summary_text, dry_run, |
22 | @@ -1133,7 +1133,7 @@ |
23 | # the section of the source package uploaded in order to facilitate |
24 | # filtering on the part of the email recipients. |
25 | if self.sources: |
26 | - spr = self.mySourcePackageRelease |
27 | + spr = self.my_source_package_release |
28 | xlp_component_header = 'component=%s, section=%s' % ( |
29 | spr.component.name, spr.section.name) |
30 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
31 | |
32 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' |
33 | --- lib/lp/soyuz/tests/test_packageupload.py 2009-10-07 08:28:03 +0000 |
34 | +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 11:12:08 +0000 |
35 | @@ -232,7 +232,7 @@ |
36 | 'Changed-By: Foo Bar <foo.bar@canonical.com>\n' |
37 | 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n' |
38 | 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n') |
39 | - |
40 | + |
41 | self.layer.switchDbUser('launchpad') |
42 | |
43 | # One source and 2 binaries are pending publication. They all were |
44 | |
45 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' |
46 | --- lib/lp/soyuz/tests/test_publishing.py 2009-10-05 18:29:12 +0000 |
47 | +++ lib/lp/soyuz/tests/test_publishing.py 2009-10-09 11:12:47 +0000 |
48 | @@ -385,7 +385,7 @@ |
49 | return [BinaryPackagePublishingHistory.get(pub.id) |
50 | for pub in secure_pub_binaries] |
51 | |
52 | - def _findFile(self, top, name_fragment): |
53 | + def _findChangesFile(self, top, name_fragment): |
54 | """File with given name fragment in directory tree starting at top.""" |
55 | for root, dirs, files in os.walk(top, topdown=False): |
56 | for name in files: |
57 | @@ -399,8 +399,8 @@ |
58 | """Create source with meaningful '.changes' file.""" |
59 | top = 'lib/lp/archiveuploader/tests/data/suite' |
60 | name_fragment = '%s_%s' % (sourcename, version) |
61 | - changesfile_path = self._findFile(top, name_fragment) |
62 | - |
63 | + changesfile_path = self._findChangesFile(top, name_fragment) |
64 | + |
65 | source = None |
66 | |
67 | if changesfile_path is not None: |
68 | @@ -412,12 +412,12 @@ |
69 | changesfile_content = handle.read() |
70 | finally: |
71 | handle.close() |
72 | - |
73 | + |
74 | source = self.getPubSource( |
75 | sourcename=sourcename, archive=archive, version=new_version, |
76 | changes_file_content=changesfile_content, |
77 | distroseries=distroseries) |
78 | - |
79 | + |
80 | return source |
81 | |
82 |
Abel Deuring (adeuring) wrote : | # |
Hi Muharem,
On 09.10.2009 17:57, Muharem Hrnjadovic wrote:
> Abel Deuring wrote:
>> Review: Approve
>> Hi Muharem,
>>
>> nice work, just a few cosmetic remarks, see below.
>
> Hello Abel,
>
> I am thanking you for the prompt review. All your suggestion were
> accommodated except for one. Please see the enclosed incremental diff as
> well as my replies below for more detail.
>
>> Abel
>>
>>> === modified file 'lib/lp/
>>> --- lib/lp/
>>> +++ lib/lp/
>>> @@ -198,6 +198,9 @@
>>> self.assertEquals(
>>> PackageUploadSt
>>>
>>> + # Make sure no announcement email was sent at this point.
>>> + self.assertEqua
>>> +
>>> self.layer.
>>> self.layer.
>>>
>>> @@ -210,22 +213,26 @@
>>>
>>> # Check the announcement email.
>>> from_addr, to_addrs, raw_msg = stub.test_
>>> - # This is now a MIMEMultipart message.
>>> msg = message_
>>> body = msg.get_payload(0)
>>> body = body.get_
>>>
>>> - self.assertEqua
>>> self.assertEquals(
>>> - to_addrs, ['<email address hidden>'])
>>> + str(to_addrs), "['<email address hidden>']")
>>>
>>> expected_subject = (
>>> '[ubuntutest/
>>> 'dist-upgrader_
>>> self.assertEqua
>>>
>>> - self.assertTrue
>>> -
>>> + self.assertEqua
>>> + 'foocomm (1.0-2) breezy; urgency=low\n\n'
>>> + ' * Initial version\n\n'
>>> + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
>>> + 'Changed-By: Foo Bar <email address hidden>\n'
>>> + 'Maintainer: Launchpad team <email address hidden>\n'
>>> + 'http://
>> This line is a bit too long. Could you split itto two lines? (OK,
>> breaking the URL into two line does ot look nice either...
>
> With your permission I'd like to leave it as it is.
Hrmm, OK... I am not that sure but let's leave it.
Abel
Preview Diff
1 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' |
2 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:05:22 +0000 |
3 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-09 11:16:19 +0000 |
4 | @@ -1284,28 +1284,8 @@ |
5 | >>> hoary = ubuntu.getSeries('hoary') |
6 | >>> test_publisher.addFakeChroots(hoary) |
7 | >>> unused = test_publisher.setUpDefaultDistroSeries(hoary) |
8 | - >>> def _create_source(): |
9 | - ... """Create source with meaningful '.changes' file.""" |
10 | - ... archive = cprov.archive |
11 | - ... version = '1.0-1' |
12 | - ... new_version = '2.0-1' |
13 | - ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
14 | - ... |
15 | - ... changesfile_content = '' |
16 | - ... handle = open(changesfile_path, 'r') |
17 | - ... try: |
18 | - ... changesfile_content = handle.read() |
19 | - ... finally: |
20 | - ... handle.close() |
21 | - ... |
22 | - ... changesfile_content = changesfile_content.replace( |
23 | - ... version, new_version) |
24 | - ... source = test_publisher.getPubSource( |
25 | - ... sourcename='foocomm', archive=archive, version=new_version, |
26 | - ... changes_file_content=changesfile_content, distroseries=hoary) |
27 | - ... |
28 | - ... return source |
29 | - >>> private_source = _create_source() |
30 | + >>> private_source = test_publisher.createSource( |
31 | + ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1') |
32 | >>> transaction.commit() |
33 | |
34 | Now, as Celso we will try to copy the just created 'private' source to |
35 | |
36 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt' |
37 | --- lib/lp/soyuz/doc/distroseriesqueue.txt 2009-09-30 16:00:11 +0000 |
38 | +++ lib/lp/soyuz/doc/distroseriesqueue.txt 2009-10-09 11:16:19 +0000 |
39 | @@ -1042,28 +1042,6 @@ |
40 | >>> from lp.registry.interfaces.person import IPersonSet |
41 | >>> cprov = getUtility(IPersonSet).getByName('cprov') |
42 | |
43 | - >>> def _create_source(): |
44 | - ... """Create source with meaningful '.changes' file.""" |
45 | - ... archive = cprov.archive |
46 | - ... version = '1.0-1' |
47 | - ... new_version = '2.0-1' |
48 | - ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
49 | - ... |
50 | - ... changesfile_content = '' |
51 | - ... handle = open(changesfile_path, 'r') |
52 | - ... try: |
53 | - ... changesfile_content = handle.read() |
54 | - ... finally: |
55 | - ... handle.close() |
56 | - ... |
57 | - ... changesfile_content = changesfile_content.replace( |
58 | - ... version, new_version) |
59 | - ... source = test_publisher.getPubSource( |
60 | - ... sourcename='foocomm', archive=archive, version=new_version, |
61 | - ... changes_file_content=changesfile_content, distroseries=hoary) |
62 | - ... |
63 | - ... return source |
64 | - |
65 | A 'delayed-copy' is a PackageUpload record. |
66 | |
67 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
68 | @@ -1115,7 +1093,8 @@ |
69 | Delayed copies are further manipulated exactly as normal uploads |
70 | are. Contents can be attached to it. |
71 | |
72 | - >>> a_source_package = _create_source() |
73 | + >>> a_source_package = test_publisher.createSource( |
74 | + ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1') |
75 | >>> transaction.commit() |
76 | >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease) |
77 | |
78 | |
79 | === modified file 'lib/lp/soyuz/interfaces/publishing.py' |
80 | --- lib/lp/soyuz/interfaces/publishing.py 2009-09-24 14:36:12 +0000 |
81 | +++ lib/lp/soyuz/interfaces/publishing.py 2009-10-09 11:16:19 +0000 |
82 | @@ -508,7 +508,7 @@ |
83 | "Return an ISourcePackage meta object correspondent to the " |
84 | "sourcepackagerelease attribute inside a specific distroseries") |
85 | meta_sourcepackagerelease = Attribute( |
86 | - "Return an IDistribuitionSourcePackageRelease meta object " |
87 | + "Return an IDistributionSourcePackageRelease meta object " |
88 | "correspondent to the sourcepackagerelease attribute") |
89 | meta_supersededby = Attribute( |
90 | "Return an IDistribuitionSourcePackageRelease meta object " |
91 | |
92 | === modified file 'lib/lp/soyuz/model/queue.py' |
93 | --- lib/lp/soyuz/model/queue.py 2009-10-01 07:05:22 +0000 |
94 | +++ lib/lp/soyuz/model/queue.py 2009-10-09 11:16:19 +0000 |
95 | @@ -367,15 +367,6 @@ |
96 | assert self.sources.count() == 1, ( |
97 | 'Source is mandatory for delayed copies.') |
98 | self.setAccepted() |
99 | - # The second assert guarantees that we'll actually have a SPR. |
100 | - spr = self.mySourcePackageRelease() |
101 | - # Use the changesfile of the original upload. |
102 | - changes_file_object = StringIO.StringIO( |
103 | - spr.package_upload.changesfile.read()) |
104 | - self.notify( |
105 | - announce_list=self.distroseries.changeslist, |
106 | - changes_file_object=changes_file_object, allow_unsigned=True) |
107 | - self.syncUpdate() |
108 | |
109 | def rejectFromQueue(self, logger=None, dry_run=False): |
110 | """See `IPackageUpload`.""" |
111 | @@ -496,7 +487,8 @@ |
112 | else: |
113 | return None |
114 | |
115 | - def mySourcePackageRelease(self): |
116 | + @property |
117 | + def my_source_package_release(self): |
118 | """The source package release related to this queue item. |
119 | |
120 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: |
121 | @@ -548,6 +540,13 @@ |
122 | if self.is_delayed_copy: |
123 | for pub_record in publishing_records: |
124 | pub_record.overrideFromAncestry() |
125 | + |
126 | + # Grab the .changes file of the original source package while |
127 | + # it's available. |
128 | + changes_file = None |
129 | + if ISourcePackagePublishingHistory.providedBy(pub_record): |
130 | + changes_file = pub_record.sourcepackagerelease.package_upload.changesfile |
131 | + |
132 | for new_file in update_files_privacy(pub_record): |
133 | debug(logger, |
134 | "Re-uploaded %s to librarian" % new_file.filename) |
135 | @@ -557,6 +556,17 @@ |
136 | pub_record.createMissingBuilds( |
137 | pas_verify=pas_verify, logger=logger) |
138 | |
139 | + if changes_file is not None: |
140 | + debug( |
141 | + logger, |
142 | + "sending email to %s" % self.distroseries.changeslist) |
143 | + changes_file_object = StringIO.StringIO(changes_file.read()) |
144 | + self.notify( |
145 | + announce_list=self.distroseries.changeslist, |
146 | + changes_file_object=changes_file_object, |
147 | + allow_unsigned=True, logger=logger) |
148 | + self.syncUpdate() |
149 | + |
150 | self.setDone() |
151 | |
152 | return publishing_records |
153 | @@ -726,7 +736,7 @@ |
154 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
155 | |
156 | if self.sources or self.builds: |
157 | - message.SPR_URL = canonical_url(self.mySourcePackageRelease()) |
158 | + message.SPR_URL = canonical_url(self.my_source_package_release) |
159 | |
160 | def _sendRejectionNotification( |
161 | self, recipients, changes_lines, changes, summary_text, dry_run, |
162 | @@ -1123,7 +1133,7 @@ |
163 | # the section of the source package uploaded in order to facilitate |
164 | # filtering on the part of the email recipients. |
165 | if self.sources: |
166 | - spr = self.mySourcePackageRelease() |
167 | + spr = self.my_source_package_release |
168 | xlp_component_header = 'component=%s, section=%s' % ( |
169 | spr.component.name, spr.section.name) |
170 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
171 | |
172 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' |
173 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-09-29 17:27:52 +0000 |
174 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-09 11:16:19 +0000 |
175 | @@ -50,24 +50,6 @@ |
176 | TestCase, TestCaseWithFactory) |
177 | |
178 | |
179 | -def _create_source(test_publisher, archive): |
180 | - """Create source with meaningful '.changes' file.""" |
181 | - changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes' |
182 | - |
183 | - changesfile_content = '' |
184 | - handle = open(changesfile_path, 'r') |
185 | - try: |
186 | - changesfile_content = handle.read() |
187 | - finally: |
188 | - handle.close() |
189 | - |
190 | - source = test_publisher.getPubSource( |
191 | - sourcename='foocomm', archive=archive, version='1.0-2', |
192 | - changes_file_content=changesfile_content) |
193 | - |
194 | - return source |
195 | - |
196 | - |
197 | class ReUploadFileTestCase(TestCaseWithFactory): |
198 | """Test `ILibraryFileAlias` reupload helper. |
199 | |
200 | @@ -788,7 +770,8 @@ |
201 | purpose=ArchivePurpose.PPA) |
202 | private_archive.buildd_secret = 'x' |
203 | private_archive.private = True |
204 | - source = _create_source(self.test_publisher, private_archive) |
205 | + source = self.test_publisher.createSource( |
206 | + private_archive, 'foocomm', '1.0-2') |
207 | |
208 | archive = self.test_publisher.ubuntutest.main_archive |
209 | series = source.distroseries |
210 | @@ -917,7 +900,7 @@ |
211 | ppa.buildd_secret = 'x' |
212 | ppa.private = True |
213 | |
214 | - source = _create_source(self.test_publisher, ppa) |
215 | + source = self.test_publisher.createSource(ppa, 'foocomm', '1.0-2') |
216 | self.test_publisher.getPubBinaries(pub_source=source) |
217 | |
218 | [build] = source.getBuilds() |
219 | |
220 | === modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt' |
221 | --- lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-09-30 10:43:08 +0000 |
222 | +++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-10-09 11:16:19 +0000 |
223 | @@ -735,29 +735,13 @@ |
224 | |
225 | Make Celso's PPA private and create a private source publication. |
226 | |
227 | - >>> def _create_source(archive, version): |
228 | - ... """Create source with meaningful '.changes' file.""" |
229 | - ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
230 | - ... |
231 | - ... changesfile_content = '' |
232 | - ... handle = open(changesfile_path, 'r') |
233 | - ... try: |
234 | - ... changesfile_content = handle.read() |
235 | - ... finally: |
236 | - ... handle.close() |
237 | - ... |
238 | - ... source = test_publisher.getPubSource( |
239 | - ... sourcename='foocomm', archive=archive, version=version, |
240 | - ... changes_file_content=changesfile_content) |
241 | - ... |
242 | - ... return source |
243 | - |
244 | >>> login('foo.bar@canonical.com') |
245 | |
246 | >>> cprov.archive.buildd_secret = 'boing' |
247 | >>> cprov.archive.private = True |
248 | |
249 | - >>> private_publication = _create_source(cprov.archive, '1.0-1') |
250 | + >>> private_publication = test_publisher.createSource( |
251 | + ... cprov.archive, 'foocomm', '1.0-1') |
252 | |
253 | >>> logout() |
254 | |
255 | @@ -924,7 +908,8 @@ |
256 | version. |
257 | |
258 | >>> login('foo.bar@canonical.com') |
259 | - >>> unused = _create_source(cprov.archive, '1.0-2') |
260 | + >>> unused = test_publisher.createSource( |
261 | + ... cprov.archive, 'foocomm', '1.0-2') |
262 | >>> logout() |
263 | |
264 | >>> print cprov_webservice.named_post( |
265 | |
266 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' |
267 | --- lib/lp/soyuz/tests/test_packageupload.py 2009-09-29 17:16:01 +0000 |
268 | +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 11:16:19 +0000 |
269 | @@ -198,6 +198,9 @@ |
270 | self.assertEquals( |
271 | PackageUploadStatus.ACCEPTED, delayed_copy.status) |
272 | |
273 | + # Make sure no announcement email was sent at this point. |
274 | + self.assertEquals(len(stub.test_emails), 0) |
275 | + |
276 | self.layer.txn.commit() |
277 | self.layer.switchDbUser(self.dbuser) |
278 | |
279 | @@ -210,21 +213,25 @@ |
280 | |
281 | # Check the announcement email. |
282 | from_addr, to_addrs, raw_msg = stub.test_emails.pop() |
283 | - # This is now a MIMEMultipart message. |
284 | msg = message_from_string(raw_msg) |
285 | body = msg.get_payload(0) |
286 | body = body.get_payload(decode=True) |
287 | |
288 | - self.assertEquals(from_addr, 'bounces@canonical.com') |
289 | self.assertEquals( |
290 | - to_addrs, ['breezy-autotest-changes@lists.ubuntu.com']) |
291 | + str(to_addrs), "['breezy-autotest-changes@lists.ubuntu.com']") |
292 | |
293 | expected_subject = ( |
294 | '[ubuntutest/breezy-autotest-security]\n\t' |
295 | 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)') |
296 | self.assertEquals(msg['Subject'], expected_subject) |
297 | |
298 | - self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low')) |
299 | + self.assertEquals(body, |
300 | + 'foocomm (1.0-2) breezy; urgency=low\n\n' |
301 | + ' * Initial version\n\n' |
302 | + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n' |
303 | + 'Changed-By: Foo Bar <foo.bar@canonical.com>\n' |
304 | + 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n' |
305 | + 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n') |
306 | |
307 | self.layer.switchDbUser('launchpad') |
308 | |
309 | |
310 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' |
311 | --- lib/lp/soyuz/tests/test_publishing.py 2009-09-10 08:56:15 +0000 |
312 | +++ lib/lp/soyuz/tests/test_publishing.py 2009-10-09 11:16:19 +0000 |
313 | @@ -385,6 +385,41 @@ |
314 | return [BinaryPackagePublishingHistory.get(pub.id) |
315 | for pub in secure_pub_binaries] |
316 | |
317 | + def _findChangesFile(self, top, name_fragment): |
318 | + """File with given name fragment in directory tree starting at top.""" |
319 | + for root, dirs, files in os.walk(top, topdown=False): |
320 | + for name in files: |
321 | + if name.endswith('.changes') and name.find(name_fragment) > -1: |
322 | + return os.path.join(root, name) |
323 | + return None |
324 | + |
325 | + def createSource( |
326 | + self, archive, sourcename, version, distroseries=None, |
327 | + new_version=None): |
328 | + """Create source with meaningful '.changes' file.""" |
329 | + top = 'lib/lp/archiveuploader/tests/data/suite' |
330 | + name_fragment = '%s_%s' % (sourcename, version) |
331 | + changesfile_path = self._findChangesFile(top, name_fragment) |
332 | + |
333 | + source = None |
334 | + |
335 | + if changesfile_path is not None: |
336 | + if new_version is None: |
337 | + new_version = version |
338 | + changesfile_content = '' |
339 | + handle = open(changesfile_path, 'r') |
340 | + try: |
341 | + changesfile_content = handle.read() |
342 | + finally: |
343 | + handle.close() |
344 | + |
345 | + source = self.getPubSource( |
346 | + sourcename=sourcename, archive=archive, version=new_version, |
347 | + changes_file_content=changesfile_content, |
348 | + distroseries=distroseries) |
349 | + |
350 | + return source |
351 | + |
352 | |
353 | class TestNativePublishingBase(unittest.TestCase, SoyuzTestPublisher): |
354 | layer = LaunchpadZopelessLayer |
This branch fixes bug #443075. When security fix packages are un-embargo'ed
they are copied to the primary archive. Since they become publicly available
now an announcement email needs to be sent out.
Please note: the branch at hand was tested on Soyuz dogfood to make sure
that all the tricky bits between the normal/restricted librarian work as
expected.
Pre-implementation call with Julian.
Tests to run:
bin/test -t archive-views -t distroseriesqueue -t test_copypackage -t xx-archive -t test_packageupload -t soyuz.tests. test_publishing