Merge lp:~al-maisan/launchpad/unembargo-email-316488 into lp:launchpad/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:~al-maisan/launchpad/unembargo-email-316488
Merge into: lp: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:~al-maisan/launchpad/unembargo-email-316488
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+12603@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

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 :)

Revision history for this message
Brad Crittenden (bac) wrote :

Hi Muharem,

The diff you pasted to https://pastebin.canonical.com/22758/ looks good. Thanks for the changes.

--Brad

review: Approve (code)

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-09-17 11:45:59 +0000
+++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:08:14 +0000
@@ -1284,16 +1284,35 @@
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 >>> private_source = test_publisher.getPubSource(1287 >>> def _create_source():
1288 ... sourcename="private", version="1.0", archive=cprov.archive)1288 ... """Create source with meaningful '.changes' file."""
12891289 ... 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()
1290 >>> transaction.commit()1309 >>> transaction.commit()
12911310
1292Now, as Celso we will try to copy the just created 'private' source to1311Now, as Celso we will try to copy the just created 'private' source to
1293the public Ubuntu-team PPA, which is empty.1312the public Ubuntu-team PPA, which is empty.
12941313
1295 >>> print private_source.displayname1314 >>> print private_source.displayname
1296 private 1.0 in hoary1315 foocomm 2.0-1 in hoary
12971316
1298 >>> ubuntu_team_ppa.getPublishedSources().count()1317 >>> ubuntu_team_ppa.getPublishedSources().count()
1299 01318 0
@@ -1319,14 +1338,14 @@
1319 >>> for notification in view.request.response.notifications:1338 >>> for notification in view.request.response.notifications:
1320 ... print extract_text(notification.message)1339 ... print extract_text(notification.message)
1321 Packages copied to PPA for Ubuntu Team:1340 Packages copied to PPA for Ubuntu Team:
1322 Delayed copy of private - 1.0 (source)1341 Delayed copy of foocomm - 2.0-1 (source)
13231342
1324The delayed-copy request is waiting to be processed in the ACCEPTED1343The delayed-copy request is waiting to be processed in the ACCEPTED
1325upload queue.1344upload queue.
13261345
1327 >>> from lp.soyuz.interfaces.queue import IPackageUploadSet1346 >>> from lp.soyuz.interfaces.queue import IPackageUploadSet
1328 >>> copy = getUtility(IPackageUploadSet).findSourceUpload(1347 >>> copy = getUtility(IPackageUploadSet).findSourceUpload(
1329 ... 'private', '1.0', ubuntu_team_ppa, ubuntu)1348 ... 'foocomm', '2.0-1', ubuntu_team_ppa, ubuntu)
13301349
1331 >>> print copy.status.name1350 >>> print copy.status.name
1332 ACCEPTED1351 ACCEPTED
13331352
=== modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt'
--- lib/lp/soyuz/doc/distroseriesqueue.txt 2009-08-28 06:41:25 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue.txt 2009-10-01 07:08:14 +0000
@@ -1035,12 +1035,40 @@
1035 >>> from lp.registry.interfaces.gpg import IGPGKeySet1035 >>> from lp.registry.interfaces.gpg import IGPGKeySet
1036 >>> testing_key = getUtility(IGPGKeySet).get(1)1036 >>> testing_key = getUtility(IGPGKeySet).get(1)
10371037
1038 >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
1039 >>> test_publisher = SoyuzTestPublisher()
1040 >>> test_publisher.addFakeChroots(hoary)
1041 >>> ignore = test_publisher.setUpDefaultDistroSeries(hoary)
1042 >>> from lp.registry.interfaces.person import IPersonSet
1043 >>> cprov = getUtility(IPersonSet).getByName('cprov')
1044
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.
1068
1038 >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(1069 >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(
1039 ... ubuntu.main_archive, breezy_autotest,1070 ... ubuntu.main_archive, hoary,
1040 ... PackagePublishingPocket.RELEASE, testing_key)1071 ... PackagePublishingPocket.RELEASE, testing_key)
1041
1042A 'delayed-copy' is a PackageUpload record.
1043
1044 >>> verifyObject(IPackageUpload, delayed_copy)1072 >>> verifyObject(IPackageUpload, delayed_copy)
1045 True1073 True
10461074
@@ -1064,7 +1092,7 @@
1064 Primary Archive for Ubuntu Linux1092 Primary Archive for Ubuntu Linux
10651093
1066 >>> print delayed_copy.distroseries.displayname1094 >>> print delayed_copy.distroseries.displayname
1067 Breezy Badger Autotest1095 Hoary
10681096
1069 >>> print delayed_copy.pocket.name1097 >>> print delayed_copy.pocket.name
1070 RELEASE1098 RELEASE
@@ -1087,11 +1115,9 @@
1087Delayed copies are further manipulated exactly as normal uploads1115Delayed copies are further manipulated exactly as normal uploads
1088are. Contents can be attached to it.1116are. Contents can be attached to it.
10891117
1090 # Retrieve a SourcePackageRelease from the sampledata.1118 >>> a_source_package = _create_source()
1091 >>> a_source_package = pmount.getVersion('0.1-2')1119 >>> transaction.commit()
1092 >>> a_source_release = a_source_package.sourcepackagerelease1120 >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease)
1093
1094 >>> unused = delayed_copy.addSource(a_source_release)
10951121
1096IPackageUpload.acceptFromCopy() simply checks and accepts a1122IPackageUpload.acceptFromCopy() simply checks and accepts a
1097delayed-copy record. Bugs mentioned in the changelog are closed by1123delayed-copy record. Bugs mentioned in the changelog are closed by
@@ -1113,7 +1139,7 @@
11131139
1114 >>> for pub_record in publishing_records:1140 >>> for pub_record in publishing_records:
1115 ... print pub_record.displayname, pub_record.status.name1141 ... print pub_record.displayname, pub_record.status.name
1116 pmount 0.1-2 in breezy-autotest PENDING1142 foocomm 2.0-1 in hoary PENDING
11171143
1118 >>> print delayed_copy.status.name1144 >>> print delayed_copy.status.name
1119 DONE1145 DONE
@@ -1130,17 +1156,17 @@
1130 ... ubuntu.main_archive, breezy_autotest,1156 ... ubuntu.main_archive, breezy_autotest,
1131 ... PackagePublishingPocket.RELEASE, testing_key)1157 ... PackagePublishingPocket.RELEASE, testing_key)
11321158
1133 >>> unused = dup_delayed_copy.addSource(a_source_release)1159 >>> unused = dup_delayed_copy.addSource(
1160 ... a_source_package.sourcepackagerelease)
11341161
1135Although it cannot be accepted.1162Although it cannot be accepted.
11361163
1137 >>> dup_delayed_copy.acceptFromCopy()1164 >>> dup_delayed_copy.acceptFromCopy()
1138 Traceback (most recent call last):1165 Traceback (most recent call last):
1139 ...1166 ...
1140 QueueInconsistentStateError: The source pmount - 0.1-2 is already1167 QueueInconsistentStateError: The source foocomm - 2.0-1 is already
1141 accepted in ubuntu/breezy-autotest and you cannot upload the same1168 accepted in ubuntu/hoary and you cannot upload the same version within the
1142 version within the same distribution. You have to modify the source1169 same distribution. You have to modify the source version and re-upload.
1143 version and re-upload.
11441170
1145For detecting conflicting delayed copies we have to inspect the1171For detecting conflicting delayed copies we have to inspect the
1146ACCEPTED and DONE queue for uploads of sources matching a given1172ACCEPTED and DONE queue for uploads of sources matching a given
@@ -1148,7 +1174,7 @@
1148distribution.1174distribution.
11491175
1150 >>> conflict = getUtility(IPackageUploadSet).findSourceUpload(1176 >>> conflict = getUtility(IPackageUploadSet).findSourceUpload(
1151 ... 'pmount', '0.1-2', ubuntu.main_archive, ubuntu)1177 ... 'foocomm', '2.0-1', ubuntu.main_archive, ubuntu)
11521178
1153 >>> conflict.id == delayed_copy.id1179 >>> conflict.id == delayed_copy.id
1154 True1180 True
11551181
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2009-09-15 09:24:15 +0000
+++ lib/lp/soyuz/model/queue.py 2009-10-01 07:08:14 +0000
@@ -367,6 +367,15 @@
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()
370379
371 def rejectFromQueue(self, logger=None, dry_run=False):380 def rejectFromQueue(self, logger=None, dry_run=False):
372 """See `IPackageUpload`."""381 """See `IPackageUpload`."""
@@ -487,6 +496,25 @@
487 else:496 else:
488 return None497 return None
489498
499 def mySourcePackageRelease(self):
500 """The source package release related to this queue item.
501
502 al-maisan, Wed, 30 Sep 2009 17:58:31 +0200:
503 The cached property version above behaves very finicky in
504 tests and I've had a *hell* of a time revising these and
505 making them pass.
506
507 In any case, Celso's advice was to stay away from it
508 and I am hence introducing this non-cached variant for
509 usage inside the content class.
510 """
511 if self.sources is not None and self.sources.count() > 0:
512 return self.sources[0].sourcepackagerelease
513 elif self.builds is not None and self.builds.count() > 0:
514 return self.builds[0].build.sourcepackagerelease
515 else:
516 return None
517
490 def realiseUpload(self, logger=None):518 def realiseUpload(self, logger=None):
491 """See `IPackageUpload`."""519 """See `IPackageUpload`."""
492 assert self.status == PackageUploadStatus.ACCEPTED, (520 assert self.status == PackageUploadStatus.ACCEPTED, (
@@ -563,9 +591,13 @@
563 """Strip any PGP signature from the supplied changes lines."""591 """Strip any PGP signature from the supplied changes lines."""
564 text = "".join(changes_lines)592 text = "".join(changes_lines)
565 signed_message = signed_message_from_string(text)593 signed_message = signed_message_from_string(text)
566 return signed_message.signedContent.splitlines(True)594 # For unsigned '.changes' files we'll get a None `signedContent`.
595 if signed_message.signedContent is not None:
596 return signed_message.signedContent.splitlines(True)
597 else:
598 return changes_lines
567599
568 def _getChangesDict(self, changes_file_object=None):600 def _getChangesDict(self, changes_file_object=None, allow_unsigned=None):
569 """Return a dictionary with changes file tags in it."""601 """Return a dictionary with changes file tags in it."""
570 changes_lines = None602 changes_lines = None
571 if changes_file_object is None:603 if changes_file_object is None:
@@ -579,7 +611,14 @@
579 if hasattr(changes_file_object, "seek"):611 if hasattr(changes_file_object, "seek"):
580 changes_file_object.seek(0)612 changes_file_object.seek(0)
581613
582 unsigned = not self.signing_key614 # When the 'changesfile' content comes from a different
615 # `PackageUpload` instance (e.g. when dealing with delayed copies)
616 # we need to be able to specify the "allow unsigned" flag explicitly.
617 # In that case the presence of the signing key is immaterial.
618 if allow_unsigned is None:
619 unsigned = not self.signing_key
620 else:
621 unsigned = allow_unsigned
583 changes = parse_tagfile_lines(changes_lines, allow_unsigned=unsigned)622 changes = parse_tagfile_lines(changes_lines, allow_unsigned=unsigned)
584623
585 if self.isPPA():624 if self.isPPA():
@@ -687,7 +726,7 @@
687 message.ORIGIN = '\nOrigin: %s' % changes['origin']726 message.ORIGIN = '\nOrigin: %s' % changes['origin']
688727
689 if self.sources or self.builds:728 if self.sources or self.builds:
690 message.SPR_URL = canonical_url(self.sourcepackagerelease)729 message.SPR_URL = canonical_url(self.mySourcePackageRelease())
691730
692 def _sendRejectionNotification(731 def _sendRejectionNotification(
693 self, recipients, changes_lines, changes, summary_text, dry_run,732 self, recipients, changes_lines, changes, summary_text, dry_run,
@@ -907,7 +946,8 @@
907 self.displayname)946 self.displayname)
908947
909 def notify(self, announce_list=None, summary_text=None,948 def notify(self, announce_list=None, summary_text=None,
910 changes_file_object=None, logger=None, dry_run=False):949 changes_file_object=None, logger=None, dry_run=False,
950 allow_unsigned=None):
911 """See `IPackageUpload`."""951 """See `IPackageUpload`."""
912952
913 self.logger = logger953 self.logger = logger
@@ -920,11 +960,6 @@
920 debug(self.logger, "Not sending email, upload contains binaries.")960 debug(self.logger, "Not sending email, upload contains binaries.")
921 return961 return
922962
923 # Get the changes file from the librarian and parse the tags to
924 # a dictionary. This can throw exceptions but since the tag file
925 # already will have parsed elsewhere we don't need to worry about that
926 # here. Any exceptions from the librarian can be left to the caller.
927
928 # XXX julian 2007-05-11:963 # XXX julian 2007-05-11:
929 # Requiring an open changesfile object is a bit ugly but it is964 # Requiring an open changesfile object is a bit ugly but it is
930 # required because of several problems:965 # required because of several problems:
@@ -934,7 +969,8 @@
934 # the email's summary section.969 # the email's summary section.
935 # For now, it's just easier to re-read the original file if the caller970 # For now, it's just easier to re-read the original file if the caller
936 # requires us to do that instead of using the librarian's copy.971 # requires us to do that instead of using the librarian's copy.
937 changes, changes_lines = self._getChangesDict(changes_file_object)972 changes, changes_lines = self._getChangesDict(
973 changes_file_object, allow_unsigned=allow_unsigned)
938974
939 # "files" will contain a list of tuples of filename,component,section.975 # "files" will contain a list of tuples of filename,component,section.
940 # If files is empty, we don't need to send an email if this is not976 # If files is empty, we don't need to send an email if this is not
@@ -1087,7 +1123,7 @@
1087 # the section of the source package uploaded in order to facilitate1123 # the section of the source package uploaded in order to facilitate
1088 # filtering on the part of the email recipients.1124 # filtering on the part of the email recipients.
1089 if self.sources:1125 if self.sources:
1090 spr = self.sourcepackagerelease1126 spr = self.mySourcePackageRelease()
1091 xlp_component_header = 'component=%s, section=%s' % (1127 xlp_component_header = 'component=%s, section=%s' % (
1092 spr.component.name, spr.section.name)1128 spr.component.name, spr.section.name)
1093 extra_headers['X-Launchpad-Component'] = xlp_component_header1129 extra_headers['X-Launchpad-Component'] = xlp_component_header
10941130
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-08-28 07:34:44 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-01 07:08:14 +0000
@@ -50,6 +50,24 @@
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
53class ReUploadFileTestCase(TestCaseWithFactory):71class ReUploadFileTestCase(TestCaseWithFactory):
54 """Test `ILibraryFileAlias` reupload helper.72 """Test `ILibraryFileAlias` reupload helper.
5573
@@ -770,7 +788,7 @@
770 purpose=ArchivePurpose.PPA)788 purpose=ArchivePurpose.PPA)
771 private_archive.buildd_secret = 'x'789 private_archive.buildd_secret = 'x'
772 private_archive.private = True790 private_archive.private = True
773 source = self.test_publisher.getPubSource(archive=private_archive)791 source = _create_source(self.test_publisher, private_archive)
774792
775 archive = self.test_publisher.ubuntutest.main_archive793 archive = self.test_publisher.ubuntutest.main_archive
776 series = source.distroseries794 series = source.distroseries
@@ -899,7 +917,7 @@
899 ppa.buildd_secret = 'x'917 ppa.buildd_secret = 'x'
900 ppa.private = True918 ppa.private = True
901919
902 source = self.test_publisher.getPubSource(archive=ppa)920 source = _create_source(self.test_publisher, ppa)
903 self.test_publisher.getPubBinaries(pub_source=source)921 self.test_publisher.getPubBinaries(pub_source=source)
904922
905 [build] = source.getBuilds()923 [build] = source.getBuilds()
@@ -944,7 +962,7 @@
944 # The returned object has a more descriptive 'displayname'962 # The returned object has a more descriptive 'displayname'
945 # attribute than plain `IPackageUpload` instances.963 # attribute than plain `IPackageUpload` instances.
946 self.assertEquals(964 self.assertEquals(
947 'Delayed copy of foo - 666 (source, i386, raw-dist-upgrader)',965 'Delayed copy of foocomm - 1.0-2 (source, i386, raw-dist-upgrader)',
948 delayed_copy.displayname)966 delayed_copy.displayname)
949967
950 # It is targeted to the right publishing context.968 # It is targeted to the right publishing context.
951969
=== modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt'
--- lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-09-23 07:41:13 +0000
+++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-10-01 07:08:14 +0000
@@ -735,13 +735,29 @@
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
738 >>> login('foo.bar@canonical.com')755 >>> login('foo.bar@canonical.com')
739756
740 >>> cprov.archive.buildd_secret = 'boing'757 >>> cprov.archive.buildd_secret = 'boing'
741 >>> cprov.archive.private = True758 >>> cprov.archive.private = True
742759
743 >>> private_publication = test_publisher.getPubSource(760 >>> private_publication = _create_source(cprov.archive, '1.0-1')
744 ... sourcename="private", version="1.0", archive=cprov.archive)
745761
746 >>> logout()762 >>> logout()
747763
@@ -893,12 +909,12 @@
893Copying private sources to public archives works fine with909Copying private sources to public archives works fine with
894`syncSource` or `syncSources` operations.910`syncSource` or `syncSources` operations.
895911
896We use `syncSource` to copy 'private - 1.0' source from Celso's912We use `syncSource` to copy 'foocomm - 1.0-1' source from Celso's
897private PPA to the ubuntu primary archive.913private PPA to the ubuntu primary archive.
898914
899 >>> print cprov_webservice.named_post(915 >>> print cprov_webservice.named_post(
900 ... ubuntu['main_archive_link'], 'syncSource', {},916 ... ubuntu['main_archive_link'], 'syncSource', {},
901 ... source_name='private', version='1.0', to_pocket='release',917 ... source_name='foocomm', version='1.0-1', to_pocket='release',
902 ... from_archive=cprov_archive['self_link'],918 ... from_archive=cprov_archive['self_link'],
903 ... to_series="hoary")919 ... to_series="hoary")
904 HTTP/1.1 200 Ok920 HTTP/1.1 200 Ok
@@ -908,13 +924,12 @@
908version.924version.
909925
910 >>> login('foo.bar@canonical.com')926 >>> login('foo.bar@canonical.com')
911 >>> unused = test_publisher.getPubSource(927 >>> unused = _create_source(cprov.archive, '1.0-2')
912 ... sourcename="private", version="1.1", archive=cprov.archive)
913 >>> logout()928 >>> logout()
914929
915 >>> print cprov_webservice.named_post(930 >>> print cprov_webservice.named_post(
916 ... ubuntu['main_archive_link'], 'syncSources', {},931 ... ubuntu['main_archive_link'], 'syncSources', {},
917 ... source_names=['private'], to_pocket='release',932 ... source_names=['foocomm'], to_pocket='release',
918 ... from_archive=cprov_archive['self_link'],933 ... from_archive=cprov_archive['self_link'],
919 ... to_series="hoary")934 ... to_series="hoary")
920 HTTP/1.1 200 Ok935 HTTP/1.1 200 Ok
@@ -925,12 +940,12 @@
925940
926 >>> print cprov_webservice.named_post(941 >>> print cprov_webservice.named_post(
927 ... ubuntu['main_archive_link'], 'syncSource', {},942 ... ubuntu['main_archive_link'], 'syncSource', {},
928 ... source_name='private', version='1.1', to_pocket='release',943 ... source_name='foocomm', version='1.0-2', to_pocket='release',
929 ... from_archive=cprov_archive['self_link'],944 ... from_archive=cprov_archive['self_link'],
930 ... to_series="hoary")945 ... to_series="hoary")
931 HTTP/1.1 400 Bad Request946 HTTP/1.1 400 Bad Request
932 ...947 ...
933 CannotCopy: private 1.1 in hoary948 CannotCopy: foocomm 1.0-2 in hoary
934 (same version already uploaded and waiting in ACCEPTED queue)949 (same version already uploaded and waiting in ACCEPTED queue)
935950
936951
937952
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2009-08-28 07:34:44 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-01 07:08:14 +0000
@@ -12,10 +12,12 @@
12from canonical.config import config12from canonical.config import config
13from canonical.launchpad.scripts import BufferLogger13from canonical.launchpad.scripts import BufferLogger
14from canonical.testing import LaunchpadZopelessLayer14from canonical.testing import LaunchpadZopelessLayer
15from email import message_from_string
15from lp.archiveuploader.tests import datadir16from lp.archiveuploader.tests import datadir
16from lp.registry.interfaces.distribution import IDistributionSet17from lp.registry.interfaces.distribution import IDistributionSet
17from lp.registry.interfaces.distroseries import DistroSeriesStatus18from lp.registry.interfaces.distroseries import DistroSeriesStatus
18from lp.registry.interfaces.pocket import PackagePublishingPocket19from lp.registry.interfaces.pocket import PackagePublishingPocket
20from lp.services.mail import stub
19from lp.soyuz.interfaces.archive import ArchivePurpose21from lp.soyuz.interfaces.archive import ArchivePurpose
20from lp.soyuz.interfaces.build import BuildStatus22from lp.soyuz.interfaces.build import BuildStatus
21from lp.soyuz.interfaces.publishing import PackagePublishingStatus23from lp.soyuz.interfaces.publishing import PackagePublishingStatus
@@ -87,7 +89,18 @@
87 ppa.buildd_secret = 'x'89 ppa.buildd_secret = 'x'
88 ppa.private = True90 ppa.private = True
8991
90 source = self.test_publisher.getPubSource(archive=ppa, version='1.1')92 changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes'
93
94 changesfile_content = ''
95 handle = open(changesfile_path, 'r')
96 try:
97 changesfile_content = handle.read()
98 finally:
99 handle.close()
100
101 source = self.test_publisher.getPubSource(
102 sourcename='foocomm', archive=ppa, version='1.0-2',
103 changes_file_content=changesfile_content)
91 delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(104 delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy(
92 self.test_publisher.ubuntutest.main_archive,105 self.test_publisher.ubuntutest.main_archive,
93 self.test_publisher.breezy_autotest,106 self.test_publisher.breezy_autotest,
@@ -95,6 +108,13 @@
95 self.test_publisher.person.gpgkeys[0])108 self.test_publisher.person.gpgkeys[0])
96109
97 delayed_copy.addSource(source.sourcepackagerelease)110 delayed_copy.addSource(source.sourcepackagerelease)
111
112 announce_list = delayed_copy.distroseries.changeslist
113 if announce_list is None or len(announce_list.strip()) == 0:
114 announce_list = ('%s-changes@lists.ubuntu.com' %
115 delayed_copy.distroseries.name)
116 delayed_copy.distroseries.changeslist = announce_list
117
98 if not source_only:118 if not source_only:
99 self.test_publisher.getPubBinaries(pub_source=source)119 self.test_publisher.getPubBinaries(pub_source=source)
100 custom_path = datadir(120 custom_path = datadir(
@@ -162,7 +182,7 @@
162182
163 # Create an ancestry publication in 'multiverse'.183 # Create an ancestry publication in 'multiverse'.
164 ancestry_source = self.test_publisher.getPubSource(184 ancestry_source = self.test_publisher.getPubSource(
165 version='1.0', component='multiverse',185 sourcename='foocomm', version='1.0', component='multiverse',
166 status=PackagePublishingStatus.PUBLISHED)186 status=PackagePublishingStatus.PUBLISHED)
167 self.test_publisher.getPubBinaries(187 self.test_publisher.getPubBinaries(
168 pub_source=ancestry_source,188 pub_source=ancestry_source,
@@ -187,6 +207,25 @@
187 PackageUploadStatus.DONE, delayed_copy.status)207 PackageUploadStatus.DONE, delayed_copy.status)
188208
189 self.layer.txn.commit()209 self.layer.txn.commit()
210
211 # Check the announcement email.
212 from_addr, to_addrs, raw_msg = stub.test_emails.pop()
213 # This is now a MIMEMultipart message.
214 msg = message_from_string(raw_msg)
215 body = msg.get_payload(0)
216 body = body.get_payload(decode=True)
217
218 self.assertEquals(from_addr, 'bounces@canonical.com')
219 self.assertEquals(
220 to_addrs, ['breezy-autotest-changes@lists.ubuntu.com'])
221
222 expected_subject = (
223 '[ubuntutest/breezy-autotest-security]\n\t'
224 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)')
225 self.assertEquals(msg['Subject'], expected_subject)
226
227 self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low'))
228
190 self.layer.switchDbUser('launchpad')229 self.layer.switchDbUser('launchpad')
191230
192 # One source and 2 binaries are pending publication. They all were231 # One source and 2 binaries are pending publication. They all were
@@ -194,10 +233,10 @@
194 # librarian.233 # librarian.
195 self.assertEquals(3, len(pub_records))234 self.assertEquals(3, len(pub_records))
196 self.assertEquals(235 self.assertEquals(
197 set(['foo 1.1 in breezy-autotest',236 set([
198 'foo-bin 1.1 in breezy-autotest hppa',237 u'foocomm 1.0-2 in breezy-autotest',
199 'foo-bin 1.1 in breezy-autotest i386',238 u'foo-bin 1.0-2 in breezy-autotest hppa',
200 ]),239 u'foo-bin 1.0-2 in breezy-autotest i386']),
201 set([pub.displayname for pub in pub_records]))240 set([pub.displayname for pub in pub_records]))
202241
203 for pub_record in pub_records:242 for pub_record in pub_records:

Subscribers

People subscribed via source and target branches

to status/vote changes: