Merge lp:~al-maisan/launchpad/unembargo-443075 into lp:launchpad
- unembargo-443075
- Merge into devel
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~al-maisan/launchpad/unembargo-443075 | ||||
Merge into: | lp: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:~al-maisan/launchpad/unembargo-443075 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | Approve | ||
Review via email: mp+13114@code.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 | 488 | return None | 488 | return None |
6 | 489 | 489 | ||
7 | 490 | @property | 490 | @property |
9 | 491 | def mySourcePackageRelease(self): | 491 | def my_source_package_release(self): |
10 | 492 | """The source package release related to this queue item. | 492 | """The source package release related to this queue item. |
11 | 493 | 493 | ||
12 | 494 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: | 494 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: |
13 | @@ -736,7 +736,7 @@ | |||
14 | 736 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] | 736 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
15 | 737 | 737 | ||
16 | 738 | if self.sources or self.builds: | 738 | if self.sources or self.builds: |
18 | 739 | message.SPR_URL = canonical_url(self.mySourcePackageRelease) | 739 | message.SPR_URL = canonical_url(self.my_source_package_release) |
19 | 740 | 740 | ||
20 | 741 | def _sendRejectionNotification( | 741 | def _sendRejectionNotification( |
21 | 742 | self, recipients, changes_lines, changes, summary_text, dry_run, | 742 | self, recipients, changes_lines, changes, summary_text, dry_run, |
22 | @@ -1133,7 +1133,7 @@ | |||
23 | 1133 | # the section of the source package uploaded in order to facilitate | 1133 | # the section of the source package uploaded in order to facilitate |
24 | 1134 | # filtering on the part of the email recipients. | 1134 | # filtering on the part of the email recipients. |
25 | 1135 | if self.sources: | 1135 | if self.sources: |
27 | 1136 | spr = self.mySourcePackageRelease | 1136 | spr = self.my_source_package_release |
28 | 1137 | xlp_component_header = 'component=%s, section=%s' % ( | 1137 | xlp_component_header = 'component=%s, section=%s' % ( |
29 | 1138 | spr.component.name, spr.section.name) | 1138 | spr.component.name, spr.section.name) |
30 | 1139 | extra_headers['X-Launchpad-Component'] = xlp_component_header | 1139 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
31 | 1140 | 1140 | ||
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 | 232 | 'Changed-By: Foo Bar <foo.bar@canonical.com>\n' | 232 | 'Changed-By: Foo Bar <foo.bar@canonical.com>\n' |
37 | 233 | 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n' | 233 | 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n' |
38 | 234 | 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n') | 234 | 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n') |
40 | 235 | 235 | ||
41 | 236 | self.layer.switchDbUser('launchpad') | 236 | self.layer.switchDbUser('launchpad') |
42 | 237 | 237 | ||
43 | 238 | # One source and 2 binaries are pending publication. They all were | 238 | # One source and 2 binaries are pending publication. They all were |
44 | 239 | 239 | ||
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 | 385 | return [BinaryPackagePublishingHistory.get(pub.id) | 385 | return [BinaryPackagePublishingHistory.get(pub.id) |
50 | 386 | for pub in secure_pub_binaries] | 386 | for pub in secure_pub_binaries] |
51 | 387 | 387 | ||
53 | 388 | def _findFile(self, top, name_fragment): | 388 | def _findChangesFile(self, top, name_fragment): |
54 | 389 | """File with given name fragment in directory tree starting at top.""" | 389 | """File with given name fragment in directory tree starting at top.""" |
55 | 390 | for root, dirs, files in os.walk(top, topdown=False): | 390 | for root, dirs, files in os.walk(top, topdown=False): |
56 | 391 | for name in files: | 391 | for name in files: |
57 | @@ -399,8 +399,8 @@ | |||
58 | 399 | """Create source with meaningful '.changes' file.""" | 399 | """Create source with meaningful '.changes' file.""" |
59 | 400 | top = 'lib/lp/archiveuploader/tests/data/suite' | 400 | top = 'lib/lp/archiveuploader/tests/data/suite' |
60 | 401 | name_fragment = '%s_%s' % (sourcename, version) | 401 | name_fragment = '%s_%s' % (sourcename, version) |
63 | 402 | changesfile_path = self._findFile(top, name_fragment) | 402 | changesfile_path = self._findChangesFile(top, name_fragment) |
64 | 403 | 403 | ||
65 | 404 | source = None | 404 | source = None |
66 | 405 | 405 | ||
67 | 406 | if changesfile_path is not None: | 406 | if changesfile_path is not None: |
68 | @@ -412,12 +412,12 @@ | |||
69 | 412 | changesfile_content = handle.read() | 412 | changesfile_content = handle.read() |
70 | 413 | finally: | 413 | finally: |
71 | 414 | handle.close() | 414 | handle.close() |
73 | 415 | 415 | ||
74 | 416 | source = self.getPubSource( | 416 | source = self.getPubSource( |
75 | 417 | sourcename=sourcename, archive=archive, version=new_version, | 417 | sourcename=sourcename, archive=archive, version=new_version, |
76 | 418 | changes_file_content=changesfile_content, | 418 | changes_file_content=changesfile_content, |
77 | 419 | distroseries=distroseries) | 419 | distroseries=distroseries) |
79 | 420 | 420 | ||
80 | 421 | return source | 421 | return source |
81 | 422 | 422 | ||
82 | 423 | 423 |
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 | 1284 | >>> hoary = ubuntu.getSeries('hoary') | 1284 | >>> hoary = ubuntu.getSeries('hoary') |
6 | 1285 | >>> test_publisher.addFakeChroots(hoary) | 1285 | >>> test_publisher.addFakeChroots(hoary) |
7 | 1286 | >>> unused = test_publisher.setUpDefaultDistroSeries(hoary) | 1286 | >>> unused = test_publisher.setUpDefaultDistroSeries(hoary) |
30 | 1287 | >>> def _create_source(): | 1287 | >>> private_source = test_publisher.createSource( |
31 | 1288 | ... """Create source with meaningful '.changes' file.""" | 1288 | ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1') |
10 | 1289 | ... archive = cprov.archive | ||
11 | 1290 | ... version = '1.0-1' | ||
12 | 1291 | ... new_version = '2.0-1' | ||
13 | 1292 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
14 | 1293 | ... | ||
15 | 1294 | ... changesfile_content = '' | ||
16 | 1295 | ... handle = open(changesfile_path, 'r') | ||
17 | 1296 | ... try: | ||
18 | 1297 | ... changesfile_content = handle.read() | ||
19 | 1298 | ... finally: | ||
20 | 1299 | ... handle.close() | ||
21 | 1300 | ... | ||
22 | 1301 | ... changesfile_content = changesfile_content.replace( | ||
23 | 1302 | ... version, new_version) | ||
24 | 1303 | ... source = test_publisher.getPubSource( | ||
25 | 1304 | ... sourcename='foocomm', archive=archive, version=new_version, | ||
26 | 1305 | ... changes_file_content=changesfile_content, distroseries=hoary) | ||
27 | 1306 | ... | ||
28 | 1307 | ... return source | ||
29 | 1308 | >>> private_source = _create_source() | ||
32 | 1309 | >>> transaction.commit() | 1289 | >>> transaction.commit() |
33 | 1310 | 1290 | ||
34 | 1311 | Now, as Celso we will try to copy the just created 'private' source to | 1291 | Now, as Celso we will try to copy the just created 'private' source to |
35 | 1312 | 1292 | ||
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 | 1042 | >>> from lp.registry.interfaces.person import IPersonSet | 1042 | >>> from lp.registry.interfaces.person import IPersonSet |
41 | 1043 | >>> cprov = getUtility(IPersonSet).getByName('cprov') | 1043 | >>> cprov = getUtility(IPersonSet).getByName('cprov') |
42 | 1044 | 1044 | ||
43 | 1045 | >>> def _create_source(): | ||
44 | 1046 | ... """Create source with meaningful '.changes' file.""" | ||
45 | 1047 | ... archive = cprov.archive | ||
46 | 1048 | ... version = '1.0-1' | ||
47 | 1049 | ... new_version = '2.0-1' | ||
48 | 1050 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
49 | 1051 | ... | ||
50 | 1052 | ... changesfile_content = '' | ||
51 | 1053 | ... handle = open(changesfile_path, 'r') | ||
52 | 1054 | ... try: | ||
53 | 1055 | ... changesfile_content = handle.read() | ||
54 | 1056 | ... finally: | ||
55 | 1057 | ... handle.close() | ||
56 | 1058 | ... | ||
57 | 1059 | ... changesfile_content = changesfile_content.replace( | ||
58 | 1060 | ... version, new_version) | ||
59 | 1061 | ... source = test_publisher.getPubSource( | ||
60 | 1062 | ... sourcename='foocomm', archive=archive, version=new_version, | ||
61 | 1063 | ... changes_file_content=changesfile_content, distroseries=hoary) | ||
62 | 1064 | ... | ||
63 | 1065 | ... return source | ||
64 | 1066 | |||
65 | 1067 | A 'delayed-copy' is a PackageUpload record. | 1045 | A 'delayed-copy' is a PackageUpload record. |
66 | 1068 | 1046 | ||
67 | 1069 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( | 1047 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
68 | @@ -1115,7 +1093,8 @@ | |||
69 | 1115 | Delayed copies are further manipulated exactly as normal uploads | 1093 | Delayed copies are further manipulated exactly as normal uploads |
70 | 1116 | are. Contents can be attached to it. | 1094 | are. Contents can be attached to it. |
71 | 1117 | 1095 | ||
73 | 1118 | >>> a_source_package = _create_source() | 1096 | >>> a_source_package = test_publisher.createSource( |
74 | 1097 | ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1') | ||
75 | 1119 | >>> transaction.commit() | 1098 | >>> transaction.commit() |
76 | 1120 | >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease) | 1099 | >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease) |
77 | 1121 | 1100 | ||
78 | 1122 | 1101 | ||
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 | 508 | "Return an ISourcePackage meta object correspondent to the " | 508 | "Return an ISourcePackage meta object correspondent to the " |
84 | 509 | "sourcepackagerelease attribute inside a specific distroseries") | 509 | "sourcepackagerelease attribute inside a specific distroseries") |
85 | 510 | meta_sourcepackagerelease = Attribute( | 510 | meta_sourcepackagerelease = Attribute( |
87 | 511 | "Return an IDistribuitionSourcePackageRelease meta object " | 511 | "Return an IDistributionSourcePackageRelease meta object " |
88 | 512 | "correspondent to the sourcepackagerelease attribute") | 512 | "correspondent to the sourcepackagerelease attribute") |
89 | 513 | meta_supersededby = Attribute( | 513 | meta_supersededby = Attribute( |
90 | 514 | "Return an IDistribuitionSourcePackageRelease meta object " | 514 | "Return an IDistribuitionSourcePackageRelease meta object " |
91 | 515 | 515 | ||
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 | 367 | assert self.sources.count() == 1, ( | 367 | assert self.sources.count() == 1, ( |
97 | 368 | 'Source is mandatory for delayed copies.') | 368 | 'Source is mandatory for delayed copies.') |
98 | 369 | self.setAccepted() | 369 | self.setAccepted() |
99 | 370 | # The second assert guarantees that we'll actually have a SPR. | ||
100 | 371 | spr = self.mySourcePackageRelease() | ||
101 | 372 | # Use the changesfile of the original upload. | ||
102 | 373 | changes_file_object = StringIO.StringIO( | ||
103 | 374 | spr.package_upload.changesfile.read()) | ||
104 | 375 | self.notify( | ||
105 | 376 | announce_list=self.distroseries.changeslist, | ||
106 | 377 | changes_file_object=changes_file_object, allow_unsigned=True) | ||
107 | 378 | self.syncUpdate() | ||
108 | 379 | 370 | ||
109 | 380 | def rejectFromQueue(self, logger=None, dry_run=False): | 371 | def rejectFromQueue(self, logger=None, dry_run=False): |
110 | 381 | """See `IPackageUpload`.""" | 372 | """See `IPackageUpload`.""" |
111 | @@ -496,7 +487,8 @@ | |||
112 | 496 | else: | 487 | else: |
113 | 497 | return None | 488 | return None |
114 | 498 | 489 | ||
116 | 499 | def mySourcePackageRelease(self): | 490 | @property |
117 | 491 | def my_source_package_release(self): | ||
118 | 500 | """The source package release related to this queue item. | 492 | """The source package release related to this queue item. |
119 | 501 | 493 | ||
120 | 502 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: | 494 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: |
121 | @@ -548,6 +540,13 @@ | |||
122 | 548 | if self.is_delayed_copy: | 540 | if self.is_delayed_copy: |
123 | 549 | for pub_record in publishing_records: | 541 | for pub_record in publishing_records: |
124 | 550 | pub_record.overrideFromAncestry() | 542 | pub_record.overrideFromAncestry() |
125 | 543 | |||
126 | 544 | # Grab the .changes file of the original source package while | ||
127 | 545 | # it's available. | ||
128 | 546 | changes_file = None | ||
129 | 547 | if ISourcePackagePublishingHistory.providedBy(pub_record): | ||
130 | 548 | changes_file = pub_record.sourcepackagerelease.package_upload.changesfile | ||
131 | 549 | |||
132 | 551 | for new_file in update_files_privacy(pub_record): | 550 | for new_file in update_files_privacy(pub_record): |
133 | 552 | debug(logger, | 551 | debug(logger, |
134 | 553 | "Re-uploaded %s to librarian" % new_file.filename) | 552 | "Re-uploaded %s to librarian" % new_file.filename) |
135 | @@ -557,6 +556,17 @@ | |||
136 | 557 | pub_record.createMissingBuilds( | 556 | pub_record.createMissingBuilds( |
137 | 558 | pas_verify=pas_verify, logger=logger) | 557 | pas_verify=pas_verify, logger=logger) |
138 | 559 | 558 | ||
139 | 559 | if changes_file is not None: | ||
140 | 560 | debug( | ||
141 | 561 | logger, | ||
142 | 562 | "sending email to %s" % self.distroseries.changeslist) | ||
143 | 563 | changes_file_object = StringIO.StringIO(changes_file.read()) | ||
144 | 564 | self.notify( | ||
145 | 565 | announce_list=self.distroseries.changeslist, | ||
146 | 566 | changes_file_object=changes_file_object, | ||
147 | 567 | allow_unsigned=True, logger=logger) | ||
148 | 568 | self.syncUpdate() | ||
149 | 569 | |||
150 | 560 | self.setDone() | 570 | self.setDone() |
151 | 561 | 571 | ||
152 | 562 | return publishing_records | 572 | return publishing_records |
153 | @@ -726,7 +736,7 @@ | |||
154 | 726 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] | 736 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
155 | 727 | 737 | ||
156 | 728 | if self.sources or self.builds: | 738 | if self.sources or self.builds: |
158 | 729 | message.SPR_URL = canonical_url(self.mySourcePackageRelease()) | 739 | message.SPR_URL = canonical_url(self.my_source_package_release) |
159 | 730 | 740 | ||
160 | 731 | def _sendRejectionNotification( | 741 | def _sendRejectionNotification( |
161 | 732 | self, recipients, changes_lines, changes, summary_text, dry_run, | 742 | self, recipients, changes_lines, changes, summary_text, dry_run, |
162 | @@ -1123,7 +1133,7 @@ | |||
163 | 1123 | # the section of the source package uploaded in order to facilitate | 1133 | # the section of the source package uploaded in order to facilitate |
164 | 1124 | # filtering on the part of the email recipients. | 1134 | # filtering on the part of the email recipients. |
165 | 1125 | if self.sources: | 1135 | if self.sources: |
167 | 1126 | spr = self.mySourcePackageRelease() | 1136 | spr = self.my_source_package_release |
168 | 1127 | xlp_component_header = 'component=%s, section=%s' % ( | 1137 | xlp_component_header = 'component=%s, section=%s' % ( |
169 | 1128 | spr.component.name, spr.section.name) | 1138 | spr.component.name, spr.section.name) |
170 | 1129 | extra_headers['X-Launchpad-Component'] = xlp_component_header | 1139 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
171 | 1130 | 1140 | ||
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 | 50 | TestCase, TestCaseWithFactory) | 50 | TestCase, TestCaseWithFactory) |
177 | 51 | 51 | ||
178 | 52 | 52 | ||
179 | 53 | def _create_source(test_publisher, archive): | ||
180 | 54 | """Create source with meaningful '.changes' file.""" | ||
181 | 55 | changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes' | ||
182 | 56 | |||
183 | 57 | changesfile_content = '' | ||
184 | 58 | handle = open(changesfile_path, 'r') | ||
185 | 59 | try: | ||
186 | 60 | changesfile_content = handle.read() | ||
187 | 61 | finally: | ||
188 | 62 | handle.close() | ||
189 | 63 | |||
190 | 64 | source = test_publisher.getPubSource( | ||
191 | 65 | sourcename='foocomm', archive=archive, version='1.0-2', | ||
192 | 66 | changes_file_content=changesfile_content) | ||
193 | 67 | |||
194 | 68 | return source | ||
195 | 69 | |||
196 | 70 | |||
197 | 71 | class ReUploadFileTestCase(TestCaseWithFactory): | 53 | class ReUploadFileTestCase(TestCaseWithFactory): |
198 | 72 | """Test `ILibraryFileAlias` reupload helper. | 54 | """Test `ILibraryFileAlias` reupload helper. |
199 | 73 | 55 | ||
200 | @@ -788,7 +770,8 @@ | |||
201 | 788 | purpose=ArchivePurpose.PPA) | 770 | purpose=ArchivePurpose.PPA) |
202 | 789 | private_archive.buildd_secret = 'x' | 771 | private_archive.buildd_secret = 'x' |
203 | 790 | private_archive.private = True | 772 | private_archive.private = True |
205 | 791 | source = _create_source(self.test_publisher, private_archive) | 773 | source = self.test_publisher.createSource( |
206 | 774 | private_archive, 'foocomm', '1.0-2') | ||
207 | 792 | 775 | ||
208 | 793 | archive = self.test_publisher.ubuntutest.main_archive | 776 | archive = self.test_publisher.ubuntutest.main_archive |
209 | 794 | series = source.distroseries | 777 | series = source.distroseries |
210 | @@ -917,7 +900,7 @@ | |||
211 | 917 | ppa.buildd_secret = 'x' | 900 | ppa.buildd_secret = 'x' |
212 | 918 | ppa.private = True | 901 | ppa.private = True |
213 | 919 | 902 | ||
215 | 920 | source = _create_source(self.test_publisher, ppa) | 903 | source = self.test_publisher.createSource(ppa, 'foocomm', '1.0-2') |
216 | 921 | self.test_publisher.getPubBinaries(pub_source=source) | 904 | self.test_publisher.getPubBinaries(pub_source=source) |
217 | 922 | 905 | ||
218 | 923 | [build] = source.getBuilds() | 906 | [build] = source.getBuilds() |
219 | 924 | 907 | ||
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 | 735 | 735 | ||
225 | 736 | Make Celso's PPA private and create a private source publication. | 736 | Make Celso's PPA private and create a private source publication. |
226 | 737 | 737 | ||
227 | 738 | >>> def _create_source(archive, version): | ||
228 | 739 | ... """Create source with meaningful '.changes' file.""" | ||
229 | 740 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
230 | 741 | ... | ||
231 | 742 | ... changesfile_content = '' | ||
232 | 743 | ... handle = open(changesfile_path, 'r') | ||
233 | 744 | ... try: | ||
234 | 745 | ... changesfile_content = handle.read() | ||
235 | 746 | ... finally: | ||
236 | 747 | ... handle.close() | ||
237 | 748 | ... | ||
238 | 749 | ... source = test_publisher.getPubSource( | ||
239 | 750 | ... sourcename='foocomm', archive=archive, version=version, | ||
240 | 751 | ... changes_file_content=changesfile_content) | ||
241 | 752 | ... | ||
242 | 753 | ... return source | ||
243 | 754 | |||
244 | 755 | >>> login('foo.bar@canonical.com') | 738 | >>> login('foo.bar@canonical.com') |
245 | 756 | 739 | ||
246 | 757 | >>> cprov.archive.buildd_secret = 'boing' | 740 | >>> cprov.archive.buildd_secret = 'boing' |
247 | 758 | >>> cprov.archive.private = True | 741 | >>> cprov.archive.private = True |
248 | 759 | 742 | ||
250 | 760 | >>> private_publication = _create_source(cprov.archive, '1.0-1') | 743 | >>> private_publication = test_publisher.createSource( |
251 | 744 | ... cprov.archive, 'foocomm', '1.0-1') | ||
252 | 761 | 745 | ||
253 | 762 | >>> logout() | 746 | >>> logout() |
254 | 763 | 747 | ||
255 | @@ -924,7 +908,8 @@ | |||
256 | 924 | version. | 908 | version. |
257 | 925 | 909 | ||
258 | 926 | >>> login('foo.bar@canonical.com') | 910 | >>> login('foo.bar@canonical.com') |
260 | 927 | >>> unused = _create_source(cprov.archive, '1.0-2') | 911 | >>> unused = test_publisher.createSource( |
261 | 912 | ... cprov.archive, 'foocomm', '1.0-2') | ||
262 | 928 | >>> logout() | 913 | >>> logout() |
263 | 929 | 914 | ||
264 | 930 | >>> print cprov_webservice.named_post( | 915 | >>> print cprov_webservice.named_post( |
265 | 931 | 916 | ||
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 | 198 | self.assertEquals( | 198 | self.assertEquals( |
271 | 199 | PackageUploadStatus.ACCEPTED, delayed_copy.status) | 199 | PackageUploadStatus.ACCEPTED, delayed_copy.status) |
272 | 200 | 200 | ||
273 | 201 | # Make sure no announcement email was sent at this point. | ||
274 | 202 | self.assertEquals(len(stub.test_emails), 0) | ||
275 | 203 | |||
276 | 201 | self.layer.txn.commit() | 204 | self.layer.txn.commit() |
277 | 202 | self.layer.switchDbUser(self.dbuser) | 205 | self.layer.switchDbUser(self.dbuser) |
278 | 203 | 206 | ||
279 | @@ -210,21 +213,25 @@ | |||
280 | 210 | 213 | ||
281 | 211 | # Check the announcement email. | 214 | # Check the announcement email. |
282 | 212 | from_addr, to_addrs, raw_msg = stub.test_emails.pop() | 215 | from_addr, to_addrs, raw_msg = stub.test_emails.pop() |
283 | 213 | # This is now a MIMEMultipart message. | ||
284 | 214 | msg = message_from_string(raw_msg) | 216 | msg = message_from_string(raw_msg) |
285 | 215 | body = msg.get_payload(0) | 217 | body = msg.get_payload(0) |
286 | 216 | body = body.get_payload(decode=True) | 218 | body = body.get_payload(decode=True) |
287 | 217 | 219 | ||
288 | 218 | self.assertEquals(from_addr, 'bounces@canonical.com') | ||
289 | 219 | self.assertEquals( | 220 | self.assertEquals( |
291 | 220 | to_addrs, ['breezy-autotest-changes@lists.ubuntu.com']) | 221 | str(to_addrs), "['breezy-autotest-changes@lists.ubuntu.com']") |
292 | 221 | 222 | ||
293 | 222 | expected_subject = ( | 223 | expected_subject = ( |
294 | 223 | '[ubuntutest/breezy-autotest-security]\n\t' | 224 | '[ubuntutest/breezy-autotest-security]\n\t' |
295 | 224 | 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)') | 225 | 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)') |
296 | 225 | self.assertEquals(msg['Subject'], expected_subject) | 226 | self.assertEquals(msg['Subject'], expected_subject) |
297 | 226 | 227 | ||
299 | 227 | self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low')) | 228 | self.assertEquals(body, |
300 | 229 | 'foocomm (1.0-2) breezy; urgency=low\n\n' | ||
301 | 230 | ' * Initial version\n\n' | ||
302 | 231 | 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n' | ||
303 | 232 | 'Changed-By: Foo Bar <foo.bar@canonical.com>\n' | ||
304 | 233 | 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n' | ||
305 | 234 | 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n') | ||
306 | 228 | 235 | ||
307 | 229 | self.layer.switchDbUser('launchpad') | 236 | self.layer.switchDbUser('launchpad') |
308 | 230 | 237 | ||
309 | 231 | 238 | ||
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 | 385 | return [BinaryPackagePublishingHistory.get(pub.id) | 385 | return [BinaryPackagePublishingHistory.get(pub.id) |
315 | 386 | for pub in secure_pub_binaries] | 386 | for pub in secure_pub_binaries] |
316 | 387 | 387 | ||
317 | 388 | def _findChangesFile(self, top, name_fragment): | ||
318 | 389 | """File with given name fragment in directory tree starting at top.""" | ||
319 | 390 | for root, dirs, files in os.walk(top, topdown=False): | ||
320 | 391 | for name in files: | ||
321 | 392 | if name.endswith('.changes') and name.find(name_fragment) > -1: | ||
322 | 393 | return os.path.join(root, name) | ||
323 | 394 | return None | ||
324 | 395 | |||
325 | 396 | def createSource( | ||
326 | 397 | self, archive, sourcename, version, distroseries=None, | ||
327 | 398 | new_version=None): | ||
328 | 399 | """Create source with meaningful '.changes' file.""" | ||
329 | 400 | top = 'lib/lp/archiveuploader/tests/data/suite' | ||
330 | 401 | name_fragment = '%s_%s' % (sourcename, version) | ||
331 | 402 | changesfile_path = self._findChangesFile(top, name_fragment) | ||
332 | 403 | |||
333 | 404 | source = None | ||
334 | 405 | |||
335 | 406 | if changesfile_path is not None: | ||
336 | 407 | if new_version is None: | ||
337 | 408 | new_version = version | ||
338 | 409 | changesfile_content = '' | ||
339 | 410 | handle = open(changesfile_path, 'r') | ||
340 | 411 | try: | ||
341 | 412 | changesfile_content = handle.read() | ||
342 | 413 | finally: | ||
343 | 414 | handle.close() | ||
344 | 415 | |||
345 | 416 | source = self.getPubSource( | ||
346 | 417 | sourcename=sourcename, archive=archive, version=new_version, | ||
347 | 418 | changes_file_content=changesfile_content, | ||
348 | 419 | distroseries=distroseries) | ||
349 | 420 | |||
350 | 421 | return source | ||
351 | 422 | |||
352 | 388 | 423 | ||
353 | 389 | class TestNativePublishingBase(unittest.TestCase, SoyuzTestPublisher): | 424 | class TestNativePublishingBase(unittest.TestCase, SoyuzTestPublisher): |
354 | 390 | layer = LaunchpadZopelessLayer | 425 | 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