Merge lp://staging/~al-maisan/launchpad/unembargo-email-316488 into lp://staging/launchpad/db-devel
- unembargo-email-316488
- Merge into db-devel
Proposed by
Muharem Hrnjadovic
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp://staging/~al-maisan/launchpad/unembargo-email-316488 |
Merge into: | lp://staging/launchpad/db-devel |
Diff against target: |
541 lines 6 files modified
lib/lp/soyuz/browser/tests/archive-views.txt (+25/-6) lib/lp/soyuz/doc/distroseriesqueue.txt (+43/-17) lib/lp/soyuz/model/queue.py (+48/-12) lib/lp/soyuz/scripts/tests/test_copypackage.py (+21/-3) lib/lp/soyuz/stories/webservice/xx-archive.txt (+24/-9) lib/lp/soyuz/tests/test_packageupload.py (+45/-6) |
To merge this branch: | bzr merge lp://staging/~al-maisan/launchpad/unembargo-email-316488 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email: mp+12603@code.staging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote : | # |
Revision history for this message
Brad Crittenden (bac) wrote : | # |
Hi Muharem,
The diff you pasted to https:/
--Brad
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/browser/tests/archive-views.txt' |
2 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-17 11:45:59 +0000 |
3 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:08:14 +0000 |
4 | @@ -1284,16 +1284,35 @@ |
5 | >>> hoary = ubuntu.getSeries('hoary') |
6 | >>> test_publisher.addFakeChroots(hoary) |
7 | >>> unused = test_publisher.setUpDefaultDistroSeries(hoary) |
8 | - >>> private_source = test_publisher.getPubSource( |
9 | - ... sourcename="private", version="1.0", archive=cprov.archive) |
10 | - |
11 | + >>> def _create_source(): |
12 | + ... """Create source with meaningful '.changes' file.""" |
13 | + ... archive = cprov.archive |
14 | + ... version = '1.0-1' |
15 | + ... new_version = '2.0-1' |
16 | + ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
17 | + ... |
18 | + ... changesfile_content = '' |
19 | + ... handle = open(changesfile_path, 'r') |
20 | + ... try: |
21 | + ... changesfile_content = handle.read() |
22 | + ... finally: |
23 | + ... handle.close() |
24 | + ... |
25 | + ... changesfile_content = changesfile_content.replace( |
26 | + ... version, new_version) |
27 | + ... source = test_publisher.getPubSource( |
28 | + ... sourcename='foocomm', archive=archive, version=new_version, |
29 | + ... changes_file_content=changesfile_content, distroseries=hoary) |
30 | + ... |
31 | + ... return source |
32 | + >>> private_source = _create_source() |
33 | >>> transaction.commit() |
34 | |
35 | Now, as Celso we will try to copy the just created 'private' source to |
36 | the public Ubuntu-team PPA, which is empty. |
37 | |
38 | >>> print private_source.displayname |
39 | - private 1.0 in hoary |
40 | + foocomm 2.0-1 in hoary |
41 | |
42 | >>> ubuntu_team_ppa.getPublishedSources().count() |
43 | 0 |
44 | @@ -1319,14 +1338,14 @@ |
45 | >>> for notification in view.request.response.notifications: |
46 | ... print extract_text(notification.message) |
47 | Packages copied to PPA for Ubuntu Team: |
48 | - Delayed copy of private - 1.0 (source) |
49 | + Delayed copy of foocomm - 2.0-1 (source) |
50 | |
51 | The delayed-copy request is waiting to be processed in the ACCEPTED |
52 | upload queue. |
53 | |
54 | >>> from lp.soyuz.interfaces.queue import IPackageUploadSet |
55 | >>> copy = getUtility(IPackageUploadSet).findSourceUpload( |
56 | - ... 'private', '1.0', ubuntu_team_ppa, ubuntu) |
57 | + ... 'foocomm', '2.0-1', ubuntu_team_ppa, ubuntu) |
58 | |
59 | >>> print copy.status.name |
60 | ACCEPTED |
61 | |
62 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt' |
63 | --- lib/lp/soyuz/doc/distroseriesqueue.txt 2009-08-28 06:41:25 +0000 |
64 | +++ lib/lp/soyuz/doc/distroseriesqueue.txt 2009-10-01 07:08:14 +0000 |
65 | @@ -1035,12 +1035,40 @@ |
66 | >>> from lp.registry.interfaces.gpg import IGPGKeySet |
67 | >>> testing_key = getUtility(IGPGKeySet).get(1) |
68 | |
69 | + >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher |
70 | + >>> test_publisher = SoyuzTestPublisher() |
71 | + >>> test_publisher.addFakeChroots(hoary) |
72 | + >>> ignore = test_publisher.setUpDefaultDistroSeries(hoary) |
73 | + >>> from lp.registry.interfaces.person import IPersonSet |
74 | + >>> cprov = getUtility(IPersonSet).getByName('cprov') |
75 | + |
76 | + >>> def _create_source(): |
77 | + ... """Create source with meaningful '.changes' file.""" |
78 | + ... archive = cprov.archive |
79 | + ... version = '1.0-1' |
80 | + ... new_version = '2.0-1' |
81 | + ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
82 | + ... |
83 | + ... changesfile_content = '' |
84 | + ... handle = open(changesfile_path, 'r') |
85 | + ... try: |
86 | + ... changesfile_content = handle.read() |
87 | + ... finally: |
88 | + ... handle.close() |
89 | + ... |
90 | + ... changesfile_content = changesfile_content.replace( |
91 | + ... version, new_version) |
92 | + ... source = test_publisher.getPubSource( |
93 | + ... sourcename='foocomm', archive=archive, version=new_version, |
94 | + ... changes_file_content=changesfile_content, distroseries=hoary) |
95 | + ... |
96 | + ... return source |
97 | + |
98 | +A 'delayed-copy' is a PackageUpload record. |
99 | + |
100 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
101 | - ... ubuntu.main_archive, breezy_autotest, |
102 | + ... ubuntu.main_archive, hoary, |
103 | ... PackagePublishingPocket.RELEASE, testing_key) |
104 | - |
105 | -A 'delayed-copy' is a PackageUpload record. |
106 | - |
107 | >>> verifyObject(IPackageUpload, delayed_copy) |
108 | True |
109 | |
110 | @@ -1064,7 +1092,7 @@ |
111 | Primary Archive for Ubuntu Linux |
112 | |
113 | >>> print delayed_copy.distroseries.displayname |
114 | - Breezy Badger Autotest |
115 | + Hoary |
116 | |
117 | >>> print delayed_copy.pocket.name |
118 | RELEASE |
119 | @@ -1087,11 +1115,9 @@ |
120 | Delayed copies are further manipulated exactly as normal uploads |
121 | are. Contents can be attached to it. |
122 | |
123 | - # Retrieve a SourcePackageRelease from the sampledata. |
124 | - >>> a_source_package = pmount.getVersion('0.1-2') |
125 | - >>> a_source_release = a_source_package.sourcepackagerelease |
126 | - |
127 | - >>> unused = delayed_copy.addSource(a_source_release) |
128 | + >>> a_source_package = _create_source() |
129 | + >>> transaction.commit() |
130 | + >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease) |
131 | |
132 | IPackageUpload.acceptFromCopy() simply checks and accepts a |
133 | delayed-copy record. Bugs mentioned in the changelog are closed by |
134 | @@ -1113,7 +1139,7 @@ |
135 | |
136 | >>> for pub_record in publishing_records: |
137 | ... print pub_record.displayname, pub_record.status.name |
138 | - pmount 0.1-2 in breezy-autotest PENDING |
139 | + foocomm 2.0-1 in hoary PENDING |
140 | |
141 | >>> print delayed_copy.status.name |
142 | DONE |
143 | @@ -1130,17 +1156,17 @@ |
144 | ... ubuntu.main_archive, breezy_autotest, |
145 | ... PackagePublishingPocket.RELEASE, testing_key) |
146 | |
147 | - >>> unused = dup_delayed_copy.addSource(a_source_release) |
148 | + >>> unused = dup_delayed_copy.addSource( |
149 | + ... a_source_package.sourcepackagerelease) |
150 | |
151 | Although it cannot be accepted. |
152 | |
153 | >>> dup_delayed_copy.acceptFromCopy() |
154 | Traceback (most recent call last): |
155 | ... |
156 | - QueueInconsistentStateError: The source pmount - 0.1-2 is already |
157 | - accepted in ubuntu/breezy-autotest and you cannot upload the same |
158 | - version within the same distribution. You have to modify the source |
159 | - version and re-upload. |
160 | + QueueInconsistentStateError: The source foocomm - 2.0-1 is already |
161 | + accepted in ubuntu/hoary and you cannot upload the same version within the |
162 | + same distribution. You have to modify the source version and re-upload. |
163 | |
164 | For detecting conflicting delayed copies we have to inspect the |
165 | ACCEPTED and DONE queue for uploads of sources matching a given |
166 | @@ -1148,7 +1174,7 @@ |
167 | distribution. |
168 | |
169 | >>> conflict = getUtility(IPackageUploadSet).findSourceUpload( |
170 | - ... 'pmount', '0.1-2', ubuntu.main_archive, ubuntu) |
171 | + ... 'foocomm', '2.0-1', ubuntu.main_archive, ubuntu) |
172 | |
173 | >>> conflict.id == delayed_copy.id |
174 | True |
175 | |
176 | === modified file 'lib/lp/soyuz/model/queue.py' |
177 | --- lib/lp/soyuz/model/queue.py 2009-09-15 09:24:15 +0000 |
178 | +++ lib/lp/soyuz/model/queue.py 2009-10-01 07:08:14 +0000 |
179 | @@ -367,6 +367,15 @@ |
180 | assert self.sources.count() == 1, ( |
181 | 'Source is mandatory for delayed copies.') |
182 | self.setAccepted() |
183 | + # The second assert guarantees that we'll actually have a SPR. |
184 | + spr = self.mySourcePackageRelease() |
185 | + # Use the changesfile of the original upload. |
186 | + changes_file_object = StringIO.StringIO( |
187 | + spr.package_upload.changesfile.read()) |
188 | + self.notify( |
189 | + announce_list=self.distroseries.changeslist, |
190 | + changes_file_object=changes_file_object, allow_unsigned=True) |
191 | + self.syncUpdate() |
192 | |
193 | def rejectFromQueue(self, logger=None, dry_run=False): |
194 | """See `IPackageUpload`.""" |
195 | @@ -487,6 +496,25 @@ |
196 | else: |
197 | return None |
198 | |
199 | + def mySourcePackageRelease(self): |
200 | + """The source package release related to this queue item. |
201 | + |
202 | + al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: |
203 | + The cached property version above behaves very finicky in |
204 | + tests and I've had a *hell* of a time revising these and |
205 | + making them pass. |
206 | + |
207 | + In any case, Celso's advice was to stay away from it |
208 | + and I am hence introducing this non-cached variant for |
209 | + usage inside the content class. |
210 | + """ |
211 | + if self.sources is not None and self.sources.count() > 0: |
212 | + return self.sources[0].sourcepackagerelease |
213 | + elif self.builds is not None and self.builds.count() > 0: |
214 | + return self.builds[0].build.sourcepackagerelease |
215 | + else: |
216 | + return None |
217 | + |
218 | def realiseUpload(self, logger=None): |
219 | """See `IPackageUpload`.""" |
220 | assert self.status == PackageUploadStatus.ACCEPTED, ( |
221 | @@ -563,9 +591,13 @@ |
222 | """Strip any PGP signature from the supplied changes lines.""" |
223 | text = "".join(changes_lines) |
224 | signed_message = signed_message_from_string(text) |
225 | - return signed_message.signedContent.splitlines(True) |
226 | + # For unsigned '.changes' files we'll get a None `signedContent`. |
227 | + if signed_message.signedContent is not None: |
228 | + return signed_message.signedContent.splitlines(True) |
229 | + else: |
230 | + return changes_lines |
231 | |
232 | - def _getChangesDict(self, changes_file_object=None): |
233 | + def _getChangesDict(self, changes_file_object=None, allow_unsigned=None): |
234 | """Return a dictionary with changes file tags in it.""" |
235 | changes_lines = None |
236 | if changes_file_object is None: |
237 | @@ -579,7 +611,14 @@ |
238 | if hasattr(changes_file_object, "seek"): |
239 | changes_file_object.seek(0) |
240 | |
241 | - unsigned = not self.signing_key |
242 | + # When the 'changesfile' content comes from a different |
243 | + # `PackageUpload` instance (e.g. when dealing with delayed copies) |
244 | + # we need to be able to specify the "allow unsigned" flag explicitly. |
245 | + # In that case the presence of the signing key is immaterial. |
246 | + if allow_unsigned is None: |
247 | + unsigned = not self.signing_key |
248 | + else: |
249 | + unsigned = allow_unsigned |
250 | changes = parse_tagfile_lines(changes_lines, allow_unsigned=unsigned) |
251 | |
252 | if self.isPPA(): |
253 | @@ -687,7 +726,7 @@ |
254 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
255 | |
256 | if self.sources or self.builds: |
257 | - message.SPR_URL = canonical_url(self.sourcepackagerelease) |
258 | + message.SPR_URL = canonical_url(self.mySourcePackageRelease()) |
259 | |
260 | def _sendRejectionNotification( |
261 | self, recipients, changes_lines, changes, summary_text, dry_run, |
262 | @@ -907,7 +946,8 @@ |
263 | self.displayname) |
264 | |
265 | def notify(self, announce_list=None, summary_text=None, |
266 | - changes_file_object=None, logger=None, dry_run=False): |
267 | + changes_file_object=None, logger=None, dry_run=False, |
268 | + allow_unsigned=None): |
269 | """See `IPackageUpload`.""" |
270 | |
271 | self.logger = logger |
272 | @@ -920,11 +960,6 @@ |
273 | debug(self.logger, "Not sending email, upload contains binaries.") |
274 | return |
275 | |
276 | - # Get the changes file from the librarian and parse the tags to |
277 | - # a dictionary. This can throw exceptions but since the tag file |
278 | - # already will have parsed elsewhere we don't need to worry about that |
279 | - # here. Any exceptions from the librarian can be left to the caller. |
280 | - |
281 | # XXX julian 2007-05-11: |
282 | # Requiring an open changesfile object is a bit ugly but it is |
283 | # required because of several problems: |
284 | @@ -934,7 +969,8 @@ |
285 | # the email's summary section. |
286 | # For now, it's just easier to re-read the original file if the caller |
287 | # requires us to do that instead of using the librarian's copy. |
288 | - changes, changes_lines = self._getChangesDict(changes_file_object) |
289 | + changes, changes_lines = self._getChangesDict( |
290 | + changes_file_object, allow_unsigned=allow_unsigned) |
291 | |
292 | # "files" will contain a list of tuples of filename,component,section. |
293 | # If files is empty, we don't need to send an email if this is not |
294 | @@ -1087,7 +1123,7 @@ |
295 | # the section of the source package uploaded in order to facilitate |
296 | # filtering on the part of the email recipients. |
297 | if self.sources: |
298 | - spr = self.sourcepackagerelease |
299 | + spr = self.mySourcePackageRelease() |
300 | xlp_component_header = 'component=%s, section=%s' % ( |
301 | spr.component.name, spr.section.name) |
302 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
303 | |
304 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' |
305 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-08-28 07:34:44 +0000 |
306 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-01 07:08:14 +0000 |
307 | @@ -50,6 +50,24 @@ |
308 | TestCase, TestCaseWithFactory) |
309 | |
310 | |
311 | +def _create_source(test_publisher, archive): |
312 | + """Create source with meaningful '.changes' file.""" |
313 | + changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes' |
314 | + |
315 | + changesfile_content = '' |
316 | + handle = open(changesfile_path, 'r') |
317 | + try: |
318 | + changesfile_content = handle.read() |
319 | + finally: |
320 | + handle.close() |
321 | + |
322 | + source = test_publisher.getPubSource( |
323 | + sourcename='foocomm', archive=archive, version='1.0-2', |
324 | + changes_file_content=changesfile_content) |
325 | + |
326 | + return source |
327 | + |
328 | + |
329 | class ReUploadFileTestCase(TestCaseWithFactory): |
330 | """Test `ILibraryFileAlias` reupload helper. |
331 | |
332 | @@ -770,7 +788,7 @@ |
333 | purpose=ArchivePurpose.PPA) |
334 | private_archive.buildd_secret = 'x' |
335 | private_archive.private = True |
336 | - source = self.test_publisher.getPubSource(archive=private_archive) |
337 | + source = _create_source(self.test_publisher, private_archive) |
338 | |
339 | archive = self.test_publisher.ubuntutest.main_archive |
340 | series = source.distroseries |
341 | @@ -899,7 +917,7 @@ |
342 | ppa.buildd_secret = 'x' |
343 | ppa.private = True |
344 | |
345 | - source = self.test_publisher.getPubSource(archive=ppa) |
346 | + source = _create_source(self.test_publisher, ppa) |
347 | self.test_publisher.getPubBinaries(pub_source=source) |
348 | |
349 | [build] = source.getBuilds() |
350 | @@ -944,7 +962,7 @@ |
351 | # The returned object has a more descriptive 'displayname' |
352 | # attribute than plain `IPackageUpload` instances. |
353 | self.assertEquals( |
354 | - 'Delayed copy of foo - 666 (source, i386, raw-dist-upgrader)', |
355 | + 'Delayed copy of foocomm - 1.0-2 (source, i386, raw-dist-upgrader)', |
356 | delayed_copy.displayname) |
357 | |
358 | # It is targeted to the right publishing context. |
359 | |
360 | === modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt' |
361 | --- lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-09-23 07:41:13 +0000 |
362 | +++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-10-01 07:08:14 +0000 |
363 | @@ -735,13 +735,29 @@ |
364 | |
365 | Make Celso's PPA private and create a private source publication. |
366 | |
367 | + >>> def _create_source(archive, version): |
368 | + ... """Create source with meaningful '.changes' file.""" |
369 | + ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) |
370 | + ... |
371 | + ... changesfile_content = '' |
372 | + ... handle = open(changesfile_path, 'r') |
373 | + ... try: |
374 | + ... changesfile_content = handle.read() |
375 | + ... finally: |
376 | + ... handle.close() |
377 | + ... |
378 | + ... source = test_publisher.getPubSource( |
379 | + ... sourcename='foocomm', archive=archive, version=version, |
380 | + ... changes_file_content=changesfile_content) |
381 | + ... |
382 | + ... return source |
383 | + |
384 | >>> login('foo.bar@canonical.com') |
385 | |
386 | >>> cprov.archive.buildd_secret = 'boing' |
387 | >>> cprov.archive.private = True |
388 | |
389 | - >>> private_publication = test_publisher.getPubSource( |
390 | - ... sourcename="private", version="1.0", archive=cprov.archive) |
391 | + >>> private_publication = _create_source(cprov.archive, '1.0-1') |
392 | |
393 | >>> logout() |
394 | |
395 | @@ -893,12 +909,12 @@ |
396 | Copying private sources to public archives works fine with |
397 | `syncSource` or `syncSources` operations. |
398 | |
399 | -We use `syncSource` to copy 'private - 1.0' source from Celso's |
400 | +We use `syncSource` to copy 'foocomm - 1.0-1' source from Celso's |
401 | private PPA to the ubuntu primary archive. |
402 | |
403 | >>> print cprov_webservice.named_post( |
404 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
405 | - ... source_name='private', version='1.0', to_pocket='release', |
406 | + ... source_name='foocomm', version='1.0-1', to_pocket='release', |
407 | ... from_archive=cprov_archive['self_link'], |
408 | ... to_series="hoary") |
409 | HTTP/1.1 200 Ok |
410 | @@ -908,13 +924,12 @@ |
411 | version. |
412 | |
413 | >>> login('foo.bar@canonical.com') |
414 | - >>> unused = test_publisher.getPubSource( |
415 | - ... sourcename="private", version="1.1", archive=cprov.archive) |
416 | + >>> unused = _create_source(cprov.archive, '1.0-2') |
417 | >>> logout() |
418 | |
419 | >>> print cprov_webservice.named_post( |
420 | ... ubuntu['main_archive_link'], 'syncSources', {}, |
421 | - ... source_names=['private'], to_pocket='release', |
422 | + ... source_names=['foocomm'], to_pocket='release', |
423 | ... from_archive=cprov_archive['self_link'], |
424 | ... to_series="hoary") |
425 | HTTP/1.1 200 Ok |
426 | @@ -925,12 +940,12 @@ |
427 | |
428 | >>> print cprov_webservice.named_post( |
429 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
430 | - ... source_name='private', version='1.1', to_pocket='release', |
431 | + ... source_name='foocomm', version='1.0-2', to_pocket='release', |
432 | ... from_archive=cprov_archive['self_link'], |
433 | ... to_series="hoary") |
434 | HTTP/1.1 400 Bad Request |
435 | ... |
436 | - CannotCopy: private 1.1 in hoary |
437 | + CannotCopy: foocomm 1.0-2 in hoary |
438 | (same version already uploaded and waiting in ACCEPTED queue) |
439 | |
440 | |
441 | |
442 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' |
443 | --- lib/lp/soyuz/tests/test_packageupload.py 2009-08-28 07:34:44 +0000 |
444 | +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-01 07:08:14 +0000 |
445 | @@ -12,10 +12,12 @@ |
446 | from canonical.config import config |
447 | from canonical.launchpad.scripts import BufferLogger |
448 | from canonical.testing import LaunchpadZopelessLayer |
449 | +from email import message_from_string |
450 | from lp.archiveuploader.tests import datadir |
451 | from lp.registry.interfaces.distribution import IDistributionSet |
452 | from lp.registry.interfaces.distroseries import DistroSeriesStatus |
453 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
454 | +from lp.services.mail import stub |
455 | from lp.soyuz.interfaces.archive import ArchivePurpose |
456 | from lp.soyuz.interfaces.build import BuildStatus |
457 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus |
458 | @@ -87,7 +89,18 @@ |
459 | ppa.buildd_secret = 'x' |
460 | ppa.private = True |
461 | |
462 | - source = self.test_publisher.getPubSource(archive=ppa, version='1.1') |
463 | + changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes' |
464 | + |
465 | + changesfile_content = '' |
466 | + handle = open(changesfile_path, 'r') |
467 | + try: |
468 | + changesfile_content = handle.read() |
469 | + finally: |
470 | + handle.close() |
471 | + |
472 | + source = self.test_publisher.getPubSource( |
473 | + sourcename='foocomm', archive=ppa, version='1.0-2', |
474 | + changes_file_content=changesfile_content) |
475 | delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
476 | self.test_publisher.ubuntutest.main_archive, |
477 | self.test_publisher.breezy_autotest, |
478 | @@ -95,6 +108,13 @@ |
479 | self.test_publisher.person.gpgkeys[0]) |
480 | |
481 | delayed_copy.addSource(source.sourcepackagerelease) |
482 | + |
483 | + announce_list = delayed_copy.distroseries.changeslist |
484 | + if announce_list is None or len(announce_list.strip()) == 0: |
485 | + announce_list = ('%s-changes@lists.ubuntu.com' % |
486 | + delayed_copy.distroseries.name) |
487 | + delayed_copy.distroseries.changeslist = announce_list |
488 | + |
489 | if not source_only: |
490 | self.test_publisher.getPubBinaries(pub_source=source) |
491 | custom_path = datadir( |
492 | @@ -162,7 +182,7 @@ |
493 | |
494 | # Create an ancestry publication in 'multiverse'. |
495 | ancestry_source = self.test_publisher.getPubSource( |
496 | - version='1.0', component='multiverse', |
497 | + sourcename='foocomm', version='1.0', component='multiverse', |
498 | status=PackagePublishingStatus.PUBLISHED) |
499 | self.test_publisher.getPubBinaries( |
500 | pub_source=ancestry_source, |
501 | @@ -187,6 +207,25 @@ |
502 | PackageUploadStatus.DONE, delayed_copy.status) |
503 | |
504 | self.layer.txn.commit() |
505 | + |
506 | + # Check the announcement email. |
507 | + from_addr, to_addrs, raw_msg = stub.test_emails.pop() |
508 | + # This is now a MIMEMultipart message. |
509 | + msg = message_from_string(raw_msg) |
510 | + body = msg.get_payload(0) |
511 | + body = body.get_payload(decode=True) |
512 | + |
513 | + self.assertEquals(from_addr, 'bounces@canonical.com') |
514 | + self.assertEquals( |
515 | + to_addrs, ['breezy-autotest-changes@lists.ubuntu.com']) |
516 | + |
517 | + expected_subject = ( |
518 | + '[ubuntutest/breezy-autotest-security]\n\t' |
519 | + 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)') |
520 | + self.assertEquals(msg['Subject'], expected_subject) |
521 | + |
522 | + self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low')) |
523 | + |
524 | self.layer.switchDbUser('launchpad') |
525 | |
526 | # One source and 2 binaries are pending publication. They all were |
527 | @@ -194,10 +233,10 @@ |
528 | # librarian. |
529 | self.assertEquals(3, len(pub_records)) |
530 | self.assertEquals( |
531 | - set(['foo 1.1 in breezy-autotest', |
532 | - 'foo-bin 1.1 in breezy-autotest hppa', |
533 | - 'foo-bin 1.1 in breezy-autotest i386', |
534 | - ]), |
535 | + set([ |
536 | + u'foocomm 1.0-2 in breezy-autotest', |
537 | + u'foo-bin 1.0-2 in breezy-autotest hppa', |
538 | + u'foo-bin 1.0-2 in breezy-autotest i386']), |
539 | set([pub.displayname for pub in pub_records])) |
540 | |
541 | for pub_record in pub_records: |
Hello there!
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.
Pre-implementation call with Celso.
Tests to run:
bin/test -vv -t package -t upload
P.S.: I retracted this branch from review an hour ago in order to fix 2 test failures I did not notice in time. Now everything is fixed and all the tests pass :)