Merge lp:~al-maisan/launchpad/unembargo-443075 into lp:launchpad

Proposed by Muharem Hrnjadovic
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
Reviewer Review Type Date Requested Status
Abel Deuring (community) Approve
Review via email: mp+13114@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

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

Revision history for this message
Abel Deuring (adeuring) wrote :
Download full text (5.5 KiB)

Hi Muharem,

nice work, just a few cosmetic remarks, see below.

Abel

> === modified file 'lib/lp/soyuz/model/queue.py'
> --- lib/lp/soyuz/model/queue.py 2009-10-01 07:05:22 +0000
> +++ lib/lp/soyuz/model/queue.py 2009-10-09 09:50:27 +0000
> @@ -367,15 +367,6 @@
> assert self.sources.count() == 1, (
> 'Source is mandatory for delayed copies.')
> self.setAccepted()
> - # The second assert guarantees that we'll actually have a SPR.
> - spr = self.mySourcePackageRelease()
> - # Use the changesfile of the original upload.
> - changes_file_object = StringIO.StringIO(
> - spr.package_upload.changesfile.read())
> - self.notify(
> - announce_list=self.distroseries.changeslist,
> - changes_file_object=changes_file_object, allow_unsigned=True)
> - self.syncUpdate()
>
> def rejectFromQueue(self, logger=None, dry_run=False):
> """See `IPackageUpload`."""
> @@ -496,6 +487,7 @@
> else:
> return None
>
> + @property
> def mySourcePackageRelease(self):
> """The source package release related to this queue item.

As a Property, this should be named my_source_package_release

> === modified file 'lib/lp/soyuz/tests/test_packageupload.py'
> --- lib/lp/soyuz/tests/test_packageupload.py 2009-09-29 17:16:01 +0000
> +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 09:50:27 +0000
> @@ -198,6 +198,9 @@
> self.assertEquals(
> PackageUploadStatus.ACCEPTED, delayed_copy.status)
>
> + # Make sure no announcement email was sent at this point.
> + self.assertEquals(len(stub.test_emails), 0)
> +
> self.layer.txn.commit()
> self.layer.switchDbUser(self.dbuser)
>
> @@ -210,22 +213,26 @@
>
> # Check the announcement email.
> from_addr, to_addrs, raw_msg = stub.test_emails.pop()
> - # This is now a MIMEMultipart message.
> msg = message_from_string(raw_msg)
> body = msg.get_payload(0)
> body = body.get_payload(decode=True)
>
> - self.assertEquals(from_addr, '<email address hidden>')
> self.assertEquals(
> - to_addrs, ['<email address hidden>'])
> + str(to_addrs), "['<email address hidden>']")
>
> expected_subject = (
> '[ubuntutest/breezy-autotest-security]\n\t'
> 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)')
> self.assertEquals(msg['Subject'], expected_subject)
>
> - self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low'))
> -
> + self.assertEquals(body,
> + '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://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n')

This line is a bit too long. Could you split itto two lines? (OK,
breaking the URL into two lin...

Read more...

review: Approve
Revision history for this message
Abel Deuring (adeuring) wrote :

Sorry, forgot another nitpick:

> > + self.assertEquals(body,
> > + '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://launchpad.dev/ubuntutest/breezy-
> autotest/+source/foocomm/1.0-2\n')

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?

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :
Download full text (6.1 KiB)

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/soyuz/model/queue.py'
>> --- lib/lp/soyuz/model/queue.py 2009-10-01 07:05:22 +0000
>> +++ lib/lp/soyuz/model/queue.py 2009-10-09 09:50:27 +0000
>> @@ -367,15 +367,6 @@
>> assert self.sources.count() == 1, (
>> 'Source is mandatory for delayed copies.')
>> self.setAccepted()
>> - # The second assert guarantees that we'll actually have a SPR.
>> - spr = self.mySourcePackageRelease()
>> - # Use the changesfile of the original upload.
>> - changes_file_object = StringIO.StringIO(
>> - spr.package_upload.changesfile.read())
>> - self.notify(
>> - announce_list=self.distroseries.changeslist,
>> - changes_file_object=changes_file_object, allow_unsigned=True)
>> - self.syncUpdate()
>>
>> def rejectFromQueue(self, logger=None, dry_run=False):
>> """See `IPackageUpload`."""
>> @@ -496,6 +487,7 @@
>> else:
>> return None
>>
>> + @property
>> def mySourcePackageRelease(self):
>> """The source package release related to this queue item.
>
> As a Property, this should be named my_source_package_release

Fixed.

>
>
>> === modified file 'lib/lp/soyuz/tests/test_packageupload.py'
>> --- lib/lp/soyuz/tests/test_packageupload.py 2009-09-29 17:16:01 +0000
>> +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 09:50:27 +0000
>> @@ -198,6 +198,9 @@
>> self.assertEquals(
>> PackageUploadStatus.ACCEPTED, delayed_copy.status)
>>
>> + # Make sure no announcement email was sent at this point.
>> + self.assertEquals(len(stub.test_emails), 0)
>> +
>> self.layer.txn.commit()
>> self.layer.switchDbUser(self.dbuser)
>>
>> @@ -210,22 +213,26 @@
>>
>> # Check the announcement email.
>> from_addr, to_addrs, raw_msg = stub.test_emails.pop()
>> - # This is now a MIMEMultipart message.
>> msg = message_from_string(raw_msg)
>> body = msg.get_payload(0)
>> body = body.get_payload(decode=True)
>>
>> - self.assertEquals(from_addr, '<email address hidden>')
>> self.assertEquals(
>> - to_addrs, ['<email address hidden>'])
>> + str(to_addrs), "['<email address hidden>']")
>>
>> expected_subject = (
>> '[ubuntutest/breezy-autotest-security]\n\t'
>> 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)')
>> self.assertEquals(msg['Subject'], expected_subject)
>>
>> - self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low'))
>> -
>> + self.assertEquals(body,
>> + 'foocomm (1.0-2) breezy; urgency=low\n\n'
>> + ' * Initial version\n\n'
>> + 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
...

Read more...

=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2009-10-09 09:43:12 +0000
+++ lib/lp/soyuz/model/queue.py 2009-10-09 11:09:28 +0000
@@ -488,7 +488,7 @@
488 return None488 return None
489489
490 @property490 @property
491 def mySourcePackageRelease(self):491 def my_source_package_release(self):
492 """The source package release related to this queue item.492 """The source package release related to this queue item.
493493
494 al-maisan, Wed, 30 Sep 2009 17:58:31 +0200:494 al-maisan, Wed, 30 Sep 2009 17:58:31 +0200:
@@ -736,7 +736,7 @@
736 message.ORIGIN = '\nOrigin: %s' % changes['origin']736 message.ORIGIN = '\nOrigin: %s' % changes['origin']
737737
738 if self.sources or self.builds:738 if self.sources or self.builds:
739 message.SPR_URL = canonical_url(self.mySourcePackageRelease)739 message.SPR_URL = canonical_url(self.my_source_package_release)
740740
741 def _sendRejectionNotification(741 def _sendRejectionNotification(
742 self, recipients, changes_lines, changes, summary_text, dry_run,742 self, recipients, changes_lines, changes, summary_text, dry_run,
@@ -1133,7 +1133,7 @@
1133 # the section of the source package uploaded in order to facilitate1133 # the section of the source package uploaded in order to facilitate
1134 # filtering on the part of the email recipients.1134 # filtering on the part of the email recipients.
1135 if self.sources:1135 if self.sources:
1136 spr = self.mySourcePackageRelease1136 spr = self.my_source_package_release
1137 xlp_component_header = 'component=%s, section=%s' % (1137 xlp_component_header = 'component=%s, section=%s' % (
1138 spr.component.name, spr.section.name)1138 spr.component.name, spr.section.name)
1139 extra_headers['X-Launchpad-Component'] = xlp_component_header1139 extra_headers['X-Launchpad-Component'] = xlp_component_header
11401140
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2009-10-07 08:28:03 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 11:12:08 +0000
@@ -232,7 +232,7 @@
232 'Changed-By: Foo Bar <foo.bar@canonical.com>\n'232 'Changed-By: Foo Bar <foo.bar@canonical.com>\n'
233 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n'233 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n'
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')
235 235
236 self.layer.switchDbUser('launchpad')236 self.layer.switchDbUser('launchpad')
237237
238 # One source and 2 binaries are pending publication. They all were238 # One source and 2 binaries are pending publication. They all were
239239
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2009-10-05 18:29:12 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2009-10-09 11:12:47 +0000
@@ -385,7 +385,7 @@
385 return [BinaryPackagePublishingHistory.get(pub.id)385 return [BinaryPackagePublishingHistory.get(pub.id)
386 for pub in secure_pub_binaries]386 for pub in secure_pub_binaries]
387387
388 def _findFile(self, top, name_fragment):388 def _findChangesFile(self, top, name_fragment):
389 """File with given name fragment in directory tree starting at top."""389 """File with given name fragment in directory tree starting at top."""
390 for root, dirs, files in os.walk(top, topdown=False):390 for root, dirs, files in os.walk(top, topdown=False):
391 for name in files:391 for name in files:
@@ -399,8 +399,8 @@
399 """Create source with meaningful '.changes' file."""399 """Create source with meaningful '.changes' file."""
400 top = 'lib/lp/archiveuploader/tests/data/suite'400 top = 'lib/lp/archiveuploader/tests/data/suite'
401 name_fragment = '%s_%s' % (sourcename, version)401 name_fragment = '%s_%s' % (sourcename, version)
402 changesfile_path = self._findFile(top, name_fragment)402 changesfile_path = self._findChangesFile(top, name_fragment)
403 403
404 source = None404 source = None
405405
406 if changesfile_path is not None:406 if changesfile_path is not None:
@@ -412,12 +412,12 @@
412 changesfile_content = handle.read()412 changesfile_content = handle.read()
413 finally:413 finally:
414 handle.close()414 handle.close()
415 415
416 source = self.getPubSource(416 source = self.getPubSource(
417 sourcename=sourcename, archive=archive, version=new_version,417 sourcename=sourcename, archive=archive, version=new_version,
418 changes_file_content=changesfile_content,418 changes_file_content=changesfile_content,
419 distroseries=distroseries)419 distroseries=distroseries)
420 420
421 return source421 return source
422422
423423
Revision history for this message
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/soyuz/tests/test_packageupload.py'
>>> --- lib/lp/soyuz/tests/test_packageupload.py 2009-09-29 17:16:01 +0000
>>> +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 09:50:27 +0000
>>> @@ -198,6 +198,9 @@
>>> self.assertEquals(
>>> PackageUploadStatus.ACCEPTED, delayed_copy.status)
>>>
>>> + # Make sure no announcement email was sent at this point.
>>> + self.assertEquals(len(stub.test_emails), 0)
>>> +
>>> self.layer.txn.commit()
>>> self.layer.switchDbUser(self.dbuser)
>>>
>>> @@ -210,22 +213,26 @@
>>>
>>> # Check the announcement email.
>>> from_addr, to_addrs, raw_msg = stub.test_emails.pop()
>>> - # This is now a MIMEMultipart message.
>>> msg = message_from_string(raw_msg)
>>> body = msg.get_payload(0)
>>> body = body.get_payload(decode=True)
>>>
>>> - self.assertEquals(from_addr, '<email address hidden>')
>>> self.assertEquals(
>>> - to_addrs, ['<email address hidden>'])
>>> + str(to_addrs), "['<email address hidden>']")
>>>
>>> expected_subject = (
>>> '[ubuntutest/breezy-autotest-security]\n\t'
>>> 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)')
>>> self.assertEquals(msg['Subject'], expected_subject)
>>>
>>> - self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low'))
>>> -
>>> + self.assertEquals(body,
>>> + '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://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n')
>> 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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/browser/tests/archive-views.txt'
--- lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:05:22 +0000
+++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-09 11:16:19 +0000
@@ -1284,28 +1284,8 @@
1284 >>> hoary = ubuntu.getSeries('hoary')1284 >>> hoary = ubuntu.getSeries('hoary')
1285 >>> test_publisher.addFakeChroots(hoary)1285 >>> test_publisher.addFakeChroots(hoary)
1286 >>> unused = test_publisher.setUpDefaultDistroSeries(hoary)1286 >>> unused = test_publisher.setUpDefaultDistroSeries(hoary)
1287 >>> def _create_source():1287 >>> private_source = test_publisher.createSource(
1288 ... """Create source with meaningful '.changes' file."""1288 ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1')
1289 ... archive = cprov.archive
1290 ... version = '1.0-1'
1291 ... new_version = '2.0-1'
1292 ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2)
1293 ...
1294 ... changesfile_content = ''
1295 ... handle = open(changesfile_path, 'r')
1296 ... try:
1297 ... changesfile_content = handle.read()
1298 ... finally:
1299 ... handle.close()
1300 ...
1301 ... changesfile_content = changesfile_content.replace(
1302 ... version, new_version)
1303 ... source = test_publisher.getPubSource(
1304 ... sourcename='foocomm', archive=archive, version=new_version,
1305 ... changes_file_content=changesfile_content, distroseries=hoary)
1306 ...
1307 ... return source
1308 >>> private_source = _create_source()
1309 >>> transaction.commit()1289 >>> transaction.commit()
13101290
1311Now, as Celso we will try to copy the just created 'private' source to1291Now, as Celso we will try to copy the just created 'private' source to
13121292
=== modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt'
--- lib/lp/soyuz/doc/distroseriesqueue.txt 2009-09-30 16:00:11 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue.txt 2009-10-09 11:16:19 +0000
@@ -1042,28 +1042,6 @@
1042 >>> from lp.registry.interfaces.person import IPersonSet1042 >>> from lp.registry.interfaces.person import IPersonSet
1043 >>> cprov = getUtility(IPersonSet).getByName('cprov')1043 >>> cprov = getUtility(IPersonSet).getByName('cprov')
10441044
1045 >>> def _create_source():
1046 ... """Create source with meaningful '.changes' file."""
1047 ... archive = cprov.archive
1048 ... version = '1.0-1'
1049 ... new_version = '2.0-1'
1050 ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2)
1051 ...
1052 ... changesfile_content = ''
1053 ... handle = open(changesfile_path, 'r')
1054 ... try:
1055 ... changesfile_content = handle.read()
1056 ... finally:
1057 ... handle.close()
1058 ...
1059 ... changesfile_content = changesfile_content.replace(
1060 ... version, new_version)
1061 ... source = test_publisher.getPubSource(
1062 ... sourcename='foocomm', archive=archive, version=new_version,
1063 ... changes_file_content=changesfile_content, distroseries=hoary)
1064 ...
1065 ... return source
1066
1067A 'delayed-copy' is a PackageUpload record.1045A 'delayed-copy' is a PackageUpload record.
10681046
1069 >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(1047 >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(
@@ -1115,7 +1093,8 @@
1115Delayed copies are further manipulated exactly as normal uploads1093Delayed copies are further manipulated exactly as normal uploads
1116are. Contents can be attached to it.1094are. Contents can be attached to it.
11171095
1118 >>> a_source_package = _create_source()1096 >>> a_source_package = test_publisher.createSource(
1097 ... cprov.archive, 'foocomm', '1.0-1', new_version='2.0-1')
1119 >>> transaction.commit()1098 >>> transaction.commit()
1120 >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease)1099 >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease)
11211100
11221101
=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
--- lib/lp/soyuz/interfaces/publishing.py 2009-09-24 14:36:12 +0000
+++ lib/lp/soyuz/interfaces/publishing.py 2009-10-09 11:16:19 +0000
@@ -508,7 +508,7 @@
508 "Return an ISourcePackage meta object correspondent to the "508 "Return an ISourcePackage meta object correspondent to the "
509 "sourcepackagerelease attribute inside a specific distroseries")509 "sourcepackagerelease attribute inside a specific distroseries")
510 meta_sourcepackagerelease = Attribute(510 meta_sourcepackagerelease = Attribute(
511 "Return an IDistribuitionSourcePackageRelease meta object "511 "Return an IDistributionSourcePackageRelease meta object "
512 "correspondent to the sourcepackagerelease attribute")512 "correspondent to the sourcepackagerelease attribute")
513 meta_supersededby = Attribute(513 meta_supersededby = Attribute(
514 "Return an IDistribuitionSourcePackageRelease meta object "514 "Return an IDistribuitionSourcePackageRelease meta object "
515515
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2009-10-01 07:05:22 +0000
+++ lib/lp/soyuz/model/queue.py 2009-10-09 11:16:19 +0000
@@ -367,15 +367,6 @@
367 assert self.sources.count() == 1, (367 assert self.sources.count() == 1, (
368 'Source is mandatory for delayed copies.')368 'Source is mandatory for delayed copies.')
369 self.setAccepted()369 self.setAccepted()
370 # The second assert guarantees that we'll actually have a SPR.
371 spr = self.mySourcePackageRelease()
372 # Use the changesfile of the original upload.
373 changes_file_object = StringIO.StringIO(
374 spr.package_upload.changesfile.read())
375 self.notify(
376 announce_list=self.distroseries.changeslist,
377 changes_file_object=changes_file_object, allow_unsigned=True)
378 self.syncUpdate()
379370
380 def rejectFromQueue(self, logger=None, dry_run=False):371 def rejectFromQueue(self, logger=None, dry_run=False):
381 """See `IPackageUpload`."""372 """See `IPackageUpload`."""
@@ -496,7 +487,8 @@
496 else:487 else:
497 return None488 return None
498489
499 def mySourcePackageRelease(self):490 @property
491 def my_source_package_release(self):
500 """The source package release related to this queue item.492 """The source package release related to this queue item.
501493
502 al-maisan, Wed, 30 Sep 2009 17:58:31 +0200:494 al-maisan, Wed, 30 Sep 2009 17:58:31 +0200:
@@ -548,6 +540,13 @@
548 if self.is_delayed_copy:540 if self.is_delayed_copy:
549 for pub_record in publishing_records:541 for pub_record in publishing_records:
550 pub_record.overrideFromAncestry()542 pub_record.overrideFromAncestry()
543
544 # Grab the .changes file of the original source package while
545 # it's available.
546 changes_file = None
547 if ISourcePackagePublishingHistory.providedBy(pub_record):
548 changes_file = pub_record.sourcepackagerelease.package_upload.changesfile
549
551 for new_file in update_files_privacy(pub_record):550 for new_file in update_files_privacy(pub_record):
552 debug(logger,551 debug(logger,
553 "Re-uploaded %s to librarian" % new_file.filename)552 "Re-uploaded %s to librarian" % new_file.filename)
@@ -557,6 +556,17 @@
557 pub_record.createMissingBuilds(556 pub_record.createMissingBuilds(
558 pas_verify=pas_verify, logger=logger)557 pas_verify=pas_verify, logger=logger)
559558
559 if changes_file is not None:
560 debug(
561 logger,
562 "sending email to %s" % self.distroseries.changeslist)
563 changes_file_object = StringIO.StringIO(changes_file.read())
564 self.notify(
565 announce_list=self.distroseries.changeslist,
566 changes_file_object=changes_file_object,
567 allow_unsigned=True, logger=logger)
568 self.syncUpdate()
569
560 self.setDone()570 self.setDone()
561571
562 return publishing_records572 return publishing_records
@@ -726,7 +736,7 @@
726 message.ORIGIN = '\nOrigin: %s' % changes['origin']736 message.ORIGIN = '\nOrigin: %s' % changes['origin']
727737
728 if self.sources or self.builds:738 if self.sources or self.builds:
729 message.SPR_URL = canonical_url(self.mySourcePackageRelease())739 message.SPR_URL = canonical_url(self.my_source_package_release)
730740
731 def _sendRejectionNotification(741 def _sendRejectionNotification(
732 self, recipients, changes_lines, changes, summary_text, dry_run,742 self, recipients, changes_lines, changes, summary_text, dry_run,
@@ -1123,7 +1133,7 @@
1123 # the section of the source package uploaded in order to facilitate1133 # the section of the source package uploaded in order to facilitate
1124 # filtering on the part of the email recipients.1134 # filtering on the part of the email recipients.
1125 if self.sources:1135 if self.sources:
1126 spr = self.mySourcePackageRelease()1136 spr = self.my_source_package_release
1127 xlp_component_header = 'component=%s, section=%s' % (1137 xlp_component_header = 'component=%s, section=%s' % (
1128 spr.component.name, spr.section.name)1138 spr.component.name, spr.section.name)
1129 extra_headers['X-Launchpad-Component'] = xlp_component_header1139 extra_headers['X-Launchpad-Component'] = xlp_component_header
11301140
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-09-29 17:27:52 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-09 11:16:19 +0000
@@ -50,24 +50,6 @@
50 TestCase, TestCaseWithFactory)50 TestCase, TestCaseWithFactory)
5151
5252
53def _create_source(test_publisher, archive):
54 """Create source with meaningful '.changes' file."""
55 changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes'
56
57 changesfile_content = ''
58 handle = open(changesfile_path, 'r')
59 try:
60 changesfile_content = handle.read()
61 finally:
62 handle.close()
63
64 source = test_publisher.getPubSource(
65 sourcename='foocomm', archive=archive, version='1.0-2',
66 changes_file_content=changesfile_content)
67
68 return source
69
70
71class ReUploadFileTestCase(TestCaseWithFactory):53class ReUploadFileTestCase(TestCaseWithFactory):
72 """Test `ILibraryFileAlias` reupload helper.54 """Test `ILibraryFileAlias` reupload helper.
7355
@@ -788,7 +770,8 @@
788 purpose=ArchivePurpose.PPA)770 purpose=ArchivePurpose.PPA)
789 private_archive.buildd_secret = 'x'771 private_archive.buildd_secret = 'x'
790 private_archive.private = True772 private_archive.private = True
791 source = _create_source(self.test_publisher, private_archive)773 source = self.test_publisher.createSource(
774 private_archive, 'foocomm', '1.0-2')
792775
793 archive = self.test_publisher.ubuntutest.main_archive776 archive = self.test_publisher.ubuntutest.main_archive
794 series = source.distroseries777 series = source.distroseries
@@ -917,7 +900,7 @@
917 ppa.buildd_secret = 'x'900 ppa.buildd_secret = 'x'
918 ppa.private = True901 ppa.private = True
919902
920 source = _create_source(self.test_publisher, ppa)903 source = self.test_publisher.createSource(ppa, 'foocomm', '1.0-2')
921 self.test_publisher.getPubBinaries(pub_source=source)904 self.test_publisher.getPubBinaries(pub_source=source)
922905
923 [build] = source.getBuilds()906 [build] = source.getBuilds()
924907
=== modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt'
--- lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-09-30 10:43:08 +0000
+++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-10-09 11:16:19 +0000
@@ -735,29 +735,13 @@
735735
736Make Celso's PPA private and create a private source publication.736Make Celso's PPA private and create a private source publication.
737737
738 >>> def _create_source(archive, version):
739 ... """Create source with meaningful '.changes' file."""
740 ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2)
741 ...
742 ... changesfile_content = ''
743 ... handle = open(changesfile_path, 'r')
744 ... try:
745 ... changesfile_content = handle.read()
746 ... finally:
747 ... handle.close()
748 ...
749 ... source = test_publisher.getPubSource(
750 ... sourcename='foocomm', archive=archive, version=version,
751 ... changes_file_content=changesfile_content)
752 ...
753 ... return source
754
755 >>> login('foo.bar@canonical.com')738 >>> login('foo.bar@canonical.com')
756739
757 >>> cprov.archive.buildd_secret = 'boing'740 >>> cprov.archive.buildd_secret = 'boing'
758 >>> cprov.archive.private = True741 >>> cprov.archive.private = True
759742
760 >>> private_publication = _create_source(cprov.archive, '1.0-1')743 >>> private_publication = test_publisher.createSource(
744 ... cprov.archive, 'foocomm', '1.0-1')
761745
762 >>> logout()746 >>> logout()
763747
@@ -924,7 +908,8 @@
924version.908version.
925909
926 >>> login('foo.bar@canonical.com')910 >>> login('foo.bar@canonical.com')
927 >>> unused = _create_source(cprov.archive, '1.0-2')911 >>> unused = test_publisher.createSource(
912 ... cprov.archive, 'foocomm', '1.0-2')
928 >>> logout()913 >>> logout()
929914
930 >>> print cprov_webservice.named_post(915 >>> print cprov_webservice.named_post(
931916
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2009-09-29 17:16:01 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-09 11:16:19 +0000
@@ -198,6 +198,9 @@
198 self.assertEquals(198 self.assertEquals(
199 PackageUploadStatus.ACCEPTED, delayed_copy.status)199 PackageUploadStatus.ACCEPTED, delayed_copy.status)
200200
201 # Make sure no announcement email was sent at this point.
202 self.assertEquals(len(stub.test_emails), 0)
203
201 self.layer.txn.commit()204 self.layer.txn.commit()
202 self.layer.switchDbUser(self.dbuser)205 self.layer.switchDbUser(self.dbuser)
203206
@@ -210,21 +213,25 @@
210213
211 # Check the announcement email.214 # Check the announcement email.
212 from_addr, to_addrs, raw_msg = stub.test_emails.pop()215 from_addr, to_addrs, raw_msg = stub.test_emails.pop()
213 # This is now a MIMEMultipart message.
214 msg = message_from_string(raw_msg)216 msg = message_from_string(raw_msg)
215 body = msg.get_payload(0)217 body = msg.get_payload(0)
216 body = body.get_payload(decode=True)218 body = body.get_payload(decode=True)
217219
218 self.assertEquals(from_addr, 'bounces@canonical.com')
219 self.assertEquals(220 self.assertEquals(
220 to_addrs, ['breezy-autotest-changes@lists.ubuntu.com'])221 str(to_addrs), "['breezy-autotest-changes@lists.ubuntu.com']")
221222
222 expected_subject = (223 expected_subject = (
223 '[ubuntutest/breezy-autotest-security]\n\t'224 '[ubuntutest/breezy-autotest-security]\n\t'
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)')
225 self.assertEquals(msg['Subject'], expected_subject)226 self.assertEquals(msg['Subject'], expected_subject)
226227
227 self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low'))228 self.assertEquals(body,
229 'foocomm (1.0-2) breezy; urgency=low\n\n'
230 ' * Initial version\n\n'
231 'Date: Thu, 16 Feb 2006 15:34:09 +0000\n'
232 'Changed-By: Foo Bar <foo.bar@canonical.com>\n'
233 'Maintainer: Launchpad team <launchpad@lists.canonical.com>\n'
234 'http://launchpad.dev/ubuntutest/breezy-autotest/+source/foocomm/1.0-2\n')
228235
229 self.layer.switchDbUser('launchpad')236 self.layer.switchDbUser('launchpad')
230237
231238
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2009-09-10 08:56:15 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2009-10-09 11:16:19 +0000
@@ -385,6 +385,41 @@
385 return [BinaryPackagePublishingHistory.get(pub.id)385 return [BinaryPackagePublishingHistory.get(pub.id)
386 for pub in secure_pub_binaries]386 for pub in secure_pub_binaries]
387387
388 def _findChangesFile(self, top, name_fragment):
389 """File with given name fragment in directory tree starting at top."""
390 for root, dirs, files in os.walk(top, topdown=False):
391 for name in files:
392 if name.endswith('.changes') and name.find(name_fragment) > -1:
393 return os.path.join(root, name)
394 return None
395
396 def createSource(
397 self, archive, sourcename, version, distroseries=None,
398 new_version=None):
399 """Create source with meaningful '.changes' file."""
400 top = 'lib/lp/archiveuploader/tests/data/suite'
401 name_fragment = '%s_%s' % (sourcename, version)
402 changesfile_path = self._findChangesFile(top, name_fragment)
403
404 source = None
405
406 if changesfile_path is not None:
407 if new_version is None:
408 new_version = version
409 changesfile_content = ''
410 handle = open(changesfile_path, 'r')
411 try:
412 changesfile_content = handle.read()
413 finally:
414 handle.close()
415
416 source = self.getPubSource(
417 sourcename=sourcename, archive=archive, version=new_version,
418 changes_file_content=changesfile_content,
419 distroseries=distroseries)
420
421 return source
422
388423
389class TestNativePublishingBase(unittest.TestCase, SoyuzTestPublisher):424class TestNativePublishingBase(unittest.TestCase, SoyuzTestPublisher):
390 layer = LaunchpadZopelessLayer425 layer = LaunchpadZopelessLayer