Merge lp:~al-maisan/launchpad/unembargo-email-316488 into lp:launchpad/db-devel
- unembargo-email-316488
- Merge into db-devel
Proposed by
Muharem Hrnjadovic
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email: mp+12603@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote : | # |
Revision history for this message
Brad Crittenden (bac) wrote : | # |
Hi Muharem,
The diff you pasted to https:/
--Brad
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' | |||
2 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-17 11:45:59 +0000 | |||
3 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-10-01 07:08:14 +0000 | |||
4 | @@ -1284,16 +1284,35 @@ | |||
5 | 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) |
11 | 1287 | >>> private_source = test_publisher.getPubSource( | 1287 | >>> def _create_source(): |
12 | 1288 | ... sourcename="private", version="1.0", archive=cprov.archive) | 1288 | ... """Create source with meaningful '.changes' file.""" |
13 | 1289 | 1289 | ... archive = cprov.archive | |
14 | 1290 | ... version = '1.0-1' | ||
15 | 1291 | ... new_version = '2.0-1' | ||
16 | 1292 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
17 | 1293 | ... | ||
18 | 1294 | ... changesfile_content = '' | ||
19 | 1295 | ... handle = open(changesfile_path, 'r') | ||
20 | 1296 | ... try: | ||
21 | 1297 | ... changesfile_content = handle.read() | ||
22 | 1298 | ... finally: | ||
23 | 1299 | ... handle.close() | ||
24 | 1300 | ... | ||
25 | 1301 | ... changesfile_content = changesfile_content.replace( | ||
26 | 1302 | ... version, new_version) | ||
27 | 1303 | ... source = test_publisher.getPubSource( | ||
28 | 1304 | ... sourcename='foocomm', archive=archive, version=new_version, | ||
29 | 1305 | ... changes_file_content=changesfile_content, distroseries=hoary) | ||
30 | 1306 | ... | ||
31 | 1307 | ... return source | ||
32 | 1308 | >>> private_source = _create_source() | ||
33 | 1290 | >>> transaction.commit() | 1309 | >>> transaction.commit() |
34 | 1291 | 1310 | ||
35 | 1292 | Now, as Celso we will try to copy the just created 'private' source to | 1311 | Now, as Celso we will try to copy the just created 'private' source to |
36 | 1293 | the public Ubuntu-team PPA, which is empty. | 1312 | the public Ubuntu-team PPA, which is empty. |
37 | 1294 | 1313 | ||
38 | 1295 | >>> print private_source.displayname | 1314 | >>> print private_source.displayname |
40 | 1296 | private 1.0 in hoary | 1315 | foocomm 2.0-1 in hoary |
41 | 1297 | 1316 | ||
42 | 1298 | >>> ubuntu_team_ppa.getPublishedSources().count() | 1317 | >>> ubuntu_team_ppa.getPublishedSources().count() |
43 | 1299 | 0 | 1318 | 0 |
44 | @@ -1319,14 +1338,14 @@ | |||
45 | 1319 | >>> for notification in view.request.response.notifications: | 1338 | >>> for notification in view.request.response.notifications: |
46 | 1320 | ... print extract_text(notification.message) | 1339 | ... print extract_text(notification.message) |
47 | 1321 | Packages copied to PPA for Ubuntu Team: | 1340 | Packages copied to PPA for Ubuntu Team: |
49 | 1322 | Delayed copy of private - 1.0 (source) | 1341 | Delayed copy of foocomm - 2.0-1 (source) |
50 | 1323 | 1342 | ||
51 | 1324 | The delayed-copy request is waiting to be processed in the ACCEPTED | 1343 | The delayed-copy request is waiting to be processed in the ACCEPTED |
52 | 1325 | upload queue. | 1344 | upload queue. |
53 | 1326 | 1345 | ||
54 | 1327 | >>> from lp.soyuz.interfaces.queue import IPackageUploadSet | 1346 | >>> from lp.soyuz.interfaces.queue import IPackageUploadSet |
55 | 1328 | >>> copy = getUtility(IPackageUploadSet).findSourceUpload( | 1347 | >>> copy = getUtility(IPackageUploadSet).findSourceUpload( |
57 | 1329 | ... 'private', '1.0', ubuntu_team_ppa, ubuntu) | 1348 | ... 'foocomm', '2.0-1', ubuntu_team_ppa, ubuntu) |
58 | 1330 | 1349 | ||
59 | 1331 | >>> print copy.status.name | 1350 | >>> print copy.status.name |
60 | 1332 | ACCEPTED | 1351 | ACCEPTED |
61 | 1333 | 1352 | ||
62 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt' | |||
63 | --- lib/lp/soyuz/doc/distroseriesqueue.txt 2009-08-28 06:41:25 +0000 | |||
64 | +++ lib/lp/soyuz/doc/distroseriesqueue.txt 2009-10-01 07:08:14 +0000 | |||
65 | @@ -1035,12 +1035,40 @@ | |||
66 | 1035 | >>> from lp.registry.interfaces.gpg import IGPGKeySet | 1035 | >>> from lp.registry.interfaces.gpg import IGPGKeySet |
67 | 1036 | >>> testing_key = getUtility(IGPGKeySet).get(1) | 1036 | >>> testing_key = getUtility(IGPGKeySet).get(1) |
68 | 1037 | 1037 | ||
69 | 1038 | >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher | ||
70 | 1039 | >>> test_publisher = SoyuzTestPublisher() | ||
71 | 1040 | >>> test_publisher.addFakeChroots(hoary) | ||
72 | 1041 | >>> ignore = test_publisher.setUpDefaultDistroSeries(hoary) | ||
73 | 1042 | >>> from lp.registry.interfaces.person import IPersonSet | ||
74 | 1043 | >>> cprov = getUtility(IPersonSet).getByName('cprov') | ||
75 | 1044 | |||
76 | 1045 | >>> def _create_source(): | ||
77 | 1046 | ... """Create source with meaningful '.changes' file.""" | ||
78 | 1047 | ... archive = cprov.archive | ||
79 | 1048 | ... version = '1.0-1' | ||
80 | 1049 | ... new_version = '2.0-1' | ||
81 | 1050 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
82 | 1051 | ... | ||
83 | 1052 | ... changesfile_content = '' | ||
84 | 1053 | ... handle = open(changesfile_path, 'r') | ||
85 | 1054 | ... try: | ||
86 | 1055 | ... changesfile_content = handle.read() | ||
87 | 1056 | ... finally: | ||
88 | 1057 | ... handle.close() | ||
89 | 1058 | ... | ||
90 | 1059 | ... changesfile_content = changesfile_content.replace( | ||
91 | 1060 | ... version, new_version) | ||
92 | 1061 | ... source = test_publisher.getPubSource( | ||
93 | 1062 | ... sourcename='foocomm', archive=archive, version=new_version, | ||
94 | 1063 | ... changes_file_content=changesfile_content, distroseries=hoary) | ||
95 | 1064 | ... | ||
96 | 1065 | ... return source | ||
97 | 1066 | |||
98 | 1067 | A 'delayed-copy' is a PackageUpload record. | ||
99 | 1068 | |||
100 | 1038 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( | 1069 | >>> delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
102 | 1039 | ... ubuntu.main_archive, breezy_autotest, | 1070 | ... ubuntu.main_archive, hoary, |
103 | 1040 | ... PackagePublishingPocket.RELEASE, testing_key) | 1071 | ... PackagePublishingPocket.RELEASE, testing_key) |
104 | 1041 | |||
105 | 1042 | A 'delayed-copy' is a PackageUpload record. | ||
106 | 1043 | |||
107 | 1044 | >>> verifyObject(IPackageUpload, delayed_copy) | 1072 | >>> verifyObject(IPackageUpload, delayed_copy) |
108 | 1045 | True | 1073 | True |
109 | 1046 | 1074 | ||
110 | @@ -1064,7 +1092,7 @@ | |||
111 | 1064 | Primary Archive for Ubuntu Linux | 1092 | Primary Archive for Ubuntu Linux |
112 | 1065 | 1093 | ||
113 | 1066 | >>> print delayed_copy.distroseries.displayname | 1094 | >>> print delayed_copy.distroseries.displayname |
115 | 1067 | Breezy Badger Autotest | 1095 | Hoary |
116 | 1068 | 1096 | ||
117 | 1069 | >>> print delayed_copy.pocket.name | 1097 | >>> print delayed_copy.pocket.name |
118 | 1070 | RELEASE | 1098 | RELEASE |
119 | @@ -1087,11 +1115,9 @@ | |||
120 | 1087 | Delayed copies are further manipulated exactly as normal uploads | 1115 | Delayed copies are further manipulated exactly as normal uploads |
121 | 1088 | are. Contents can be attached to it. | 1116 | are. Contents can be attached to it. |
122 | 1089 | 1117 | ||
128 | 1090 | # Retrieve a SourcePackageRelease from the sampledata. | 1118 | >>> a_source_package = _create_source() |
129 | 1091 | >>> a_source_package = pmount.getVersion('0.1-2') | 1119 | >>> transaction.commit() |
130 | 1092 | >>> a_source_release = a_source_package.sourcepackagerelease | 1120 | >>> unused = delayed_copy.addSource(a_source_package.sourcepackagerelease) |
126 | 1093 | |||
127 | 1094 | >>> unused = delayed_copy.addSource(a_source_release) | ||
131 | 1095 | 1121 | ||
132 | 1096 | IPackageUpload.acceptFromCopy() simply checks and accepts a | 1122 | IPackageUpload.acceptFromCopy() simply checks and accepts a |
133 | 1097 | delayed-copy record. Bugs mentioned in the changelog are closed by | 1123 | delayed-copy record. Bugs mentioned in the changelog are closed by |
134 | @@ -1113,7 +1139,7 @@ | |||
135 | 1113 | 1139 | ||
136 | 1114 | >>> for pub_record in publishing_records: | 1140 | >>> for pub_record in publishing_records: |
137 | 1115 | ... print pub_record.displayname, pub_record.status.name | 1141 | ... print pub_record.displayname, pub_record.status.name |
139 | 1116 | pmount 0.1-2 in breezy-autotest PENDING | 1142 | foocomm 2.0-1 in hoary PENDING |
140 | 1117 | 1143 | ||
141 | 1118 | >>> print delayed_copy.status.name | 1144 | >>> print delayed_copy.status.name |
142 | 1119 | DONE | 1145 | DONE |
143 | @@ -1130,17 +1156,17 @@ | |||
144 | 1130 | ... ubuntu.main_archive, breezy_autotest, | 1156 | ... ubuntu.main_archive, breezy_autotest, |
145 | 1131 | ... PackagePublishingPocket.RELEASE, testing_key) | 1157 | ... PackagePublishingPocket.RELEASE, testing_key) |
146 | 1132 | 1158 | ||
148 | 1133 | >>> unused = dup_delayed_copy.addSource(a_source_release) | 1159 | >>> unused = dup_delayed_copy.addSource( |
149 | 1160 | ... a_source_package.sourcepackagerelease) | ||
150 | 1134 | 1161 | ||
151 | 1135 | Although it cannot be accepted. | 1162 | Although it cannot be accepted. |
152 | 1136 | 1163 | ||
153 | 1137 | >>> dup_delayed_copy.acceptFromCopy() | 1164 | >>> dup_delayed_copy.acceptFromCopy() |
154 | 1138 | Traceback (most recent call last): | 1165 | Traceback (most recent call last): |
155 | 1139 | ... | 1166 | ... |
160 | 1140 | QueueInconsistentStateError: The source pmount - 0.1-2 is already | 1167 | QueueInconsistentStateError: The source foocomm - 2.0-1 is already |
161 | 1141 | accepted in ubuntu/breezy-autotest and you cannot upload the same | 1168 | accepted in ubuntu/hoary and you cannot upload the same version within the |
162 | 1142 | version within the same distribution. You have to modify the source | 1169 | same distribution. You have to modify the source version and re-upload. |
159 | 1143 | version and re-upload. | ||
163 | 1144 | 1170 | ||
164 | 1145 | For detecting conflicting delayed copies we have to inspect the | 1171 | For detecting conflicting delayed copies we have to inspect the |
165 | 1146 | ACCEPTED and DONE queue for uploads of sources matching a given | 1172 | ACCEPTED and DONE queue for uploads of sources matching a given |
166 | @@ -1148,7 +1174,7 @@ | |||
167 | 1148 | distribution. | 1174 | distribution. |
168 | 1149 | 1175 | ||
169 | 1150 | >>> conflict = getUtility(IPackageUploadSet).findSourceUpload( | 1176 | >>> conflict = getUtility(IPackageUploadSet).findSourceUpload( |
171 | 1151 | ... 'pmount', '0.1-2', ubuntu.main_archive, ubuntu) | 1177 | ... 'foocomm', '2.0-1', ubuntu.main_archive, ubuntu) |
172 | 1152 | 1178 | ||
173 | 1153 | >>> conflict.id == delayed_copy.id | 1179 | >>> conflict.id == delayed_copy.id |
174 | 1154 | True | 1180 | True |
175 | 1155 | 1181 | ||
176 | === modified file 'lib/lp/soyuz/model/queue.py' | |||
177 | --- lib/lp/soyuz/model/queue.py 2009-09-15 09:24:15 +0000 | |||
178 | +++ lib/lp/soyuz/model/queue.py 2009-10-01 07:08:14 +0000 | |||
179 | @@ -367,6 +367,15 @@ | |||
180 | 367 | assert self.sources.count() == 1, ( | 367 | assert self.sources.count() == 1, ( |
181 | 368 | 'Source is mandatory for delayed copies.') | 368 | 'Source is mandatory for delayed copies.') |
182 | 369 | self.setAccepted() | 369 | self.setAccepted() |
183 | 370 | # The second assert guarantees that we'll actually have a SPR. | ||
184 | 371 | spr = self.mySourcePackageRelease() | ||
185 | 372 | # Use the changesfile of the original upload. | ||
186 | 373 | changes_file_object = StringIO.StringIO( | ||
187 | 374 | spr.package_upload.changesfile.read()) | ||
188 | 375 | self.notify( | ||
189 | 376 | announce_list=self.distroseries.changeslist, | ||
190 | 377 | changes_file_object=changes_file_object, allow_unsigned=True) | ||
191 | 378 | self.syncUpdate() | ||
192 | 370 | 379 | ||
193 | 371 | def rejectFromQueue(self, logger=None, dry_run=False): | 380 | def rejectFromQueue(self, logger=None, dry_run=False): |
194 | 372 | """See `IPackageUpload`.""" | 381 | """See `IPackageUpload`.""" |
195 | @@ -487,6 +496,25 @@ | |||
196 | 487 | else: | 496 | else: |
197 | 488 | return None | 497 | return None |
198 | 489 | 498 | ||
199 | 499 | def mySourcePackageRelease(self): | ||
200 | 500 | """The source package release related to this queue item. | ||
201 | 501 | |||
202 | 502 | al-maisan, Wed, 30 Sep 2009 17:58:31 +0200: | ||
203 | 503 | The cached property version above behaves very finicky in | ||
204 | 504 | tests and I've had a *hell* of a time revising these and | ||
205 | 505 | making them pass. | ||
206 | 506 | |||
207 | 507 | In any case, Celso's advice was to stay away from it | ||
208 | 508 | and I am hence introducing this non-cached variant for | ||
209 | 509 | usage inside the content class. | ||
210 | 510 | """ | ||
211 | 511 | if self.sources is not None and self.sources.count() > 0: | ||
212 | 512 | return self.sources[0].sourcepackagerelease | ||
213 | 513 | elif self.builds is not None and self.builds.count() > 0: | ||
214 | 514 | return self.builds[0].build.sourcepackagerelease | ||
215 | 515 | else: | ||
216 | 516 | return None | ||
217 | 517 | |||
218 | 490 | def realiseUpload(self, logger=None): | 518 | def realiseUpload(self, logger=None): |
219 | 491 | """See `IPackageUpload`.""" | 519 | """See `IPackageUpload`.""" |
220 | 492 | assert self.status == PackageUploadStatus.ACCEPTED, ( | 520 | assert self.status == PackageUploadStatus.ACCEPTED, ( |
221 | @@ -563,9 +591,13 @@ | |||
222 | 563 | """Strip any PGP signature from the supplied changes lines.""" | 591 | """Strip any PGP signature from the supplied changes lines.""" |
223 | 564 | text = "".join(changes_lines) | 592 | text = "".join(changes_lines) |
224 | 565 | signed_message = signed_message_from_string(text) | 593 | signed_message = signed_message_from_string(text) |
226 | 566 | return signed_message.signedContent.splitlines(True) | 594 | # For unsigned '.changes' files we'll get a None `signedContent`. |
227 | 595 | if signed_message.signedContent is not None: | ||
228 | 596 | return signed_message.signedContent.splitlines(True) | ||
229 | 597 | else: | ||
230 | 598 | return changes_lines | ||
231 | 567 | 599 | ||
233 | 568 | def _getChangesDict(self, changes_file_object=None): | 600 | def _getChangesDict(self, changes_file_object=None, allow_unsigned=None): |
234 | 569 | """Return a dictionary with changes file tags in it.""" | 601 | """Return a dictionary with changes file tags in it.""" |
235 | 570 | changes_lines = None | 602 | changes_lines = None |
236 | 571 | if changes_file_object is None: | 603 | if changes_file_object is None: |
237 | @@ -579,7 +611,14 @@ | |||
238 | 579 | if hasattr(changes_file_object, "seek"): | 611 | if hasattr(changes_file_object, "seek"): |
239 | 580 | changes_file_object.seek(0) | 612 | changes_file_object.seek(0) |
240 | 581 | 613 | ||
242 | 582 | unsigned = not self.signing_key | 614 | # When the 'changesfile' content comes from a different |
243 | 615 | # `PackageUpload` instance (e.g. when dealing with delayed copies) | ||
244 | 616 | # we need to be able to specify the "allow unsigned" flag explicitly. | ||
245 | 617 | # In that case the presence of the signing key is immaterial. | ||
246 | 618 | if allow_unsigned is None: | ||
247 | 619 | unsigned = not self.signing_key | ||
248 | 620 | else: | ||
249 | 621 | unsigned = allow_unsigned | ||
250 | 583 | changes = parse_tagfile_lines(changes_lines, allow_unsigned=unsigned) | 622 | changes = parse_tagfile_lines(changes_lines, allow_unsigned=unsigned) |
251 | 584 | 623 | ||
252 | 585 | if self.isPPA(): | 624 | if self.isPPA(): |
253 | @@ -687,7 +726,7 @@ | |||
254 | 687 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] | 726 | message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
255 | 688 | 727 | ||
256 | 689 | if self.sources or self.builds: | 728 | if self.sources or self.builds: |
258 | 690 | message.SPR_URL = canonical_url(self.sourcepackagerelease) | 729 | message.SPR_URL = canonical_url(self.mySourcePackageRelease()) |
259 | 691 | 730 | ||
260 | 692 | def _sendRejectionNotification( | 731 | def _sendRejectionNotification( |
261 | 693 | self, recipients, changes_lines, changes, summary_text, dry_run, | 732 | self, recipients, changes_lines, changes, summary_text, dry_run, |
262 | @@ -907,7 +946,8 @@ | |||
263 | 907 | self.displayname) | 946 | self.displayname) |
264 | 908 | 947 | ||
265 | 909 | def notify(self, announce_list=None, summary_text=None, | 948 | def notify(self, announce_list=None, summary_text=None, |
267 | 910 | changes_file_object=None, logger=None, dry_run=False): | 949 | changes_file_object=None, logger=None, dry_run=False, |
268 | 950 | allow_unsigned=None): | ||
269 | 911 | """See `IPackageUpload`.""" | 951 | """See `IPackageUpload`.""" |
270 | 912 | 952 | ||
271 | 913 | self.logger = logger | 953 | self.logger = logger |
272 | @@ -920,11 +960,6 @@ | |||
273 | 920 | debug(self.logger, "Not sending email, upload contains binaries.") | 960 | debug(self.logger, "Not sending email, upload contains binaries.") |
274 | 921 | return | 961 | return |
275 | 922 | 962 | ||
276 | 923 | # Get the changes file from the librarian and parse the tags to | ||
277 | 924 | # a dictionary. This can throw exceptions but since the tag file | ||
278 | 925 | # already will have parsed elsewhere we don't need to worry about that | ||
279 | 926 | # here. Any exceptions from the librarian can be left to the caller. | ||
280 | 927 | |||
281 | 928 | # XXX julian 2007-05-11: | 963 | # XXX julian 2007-05-11: |
282 | 929 | # Requiring an open changesfile object is a bit ugly but it is | 964 | # Requiring an open changesfile object is a bit ugly but it is |
283 | 930 | # required because of several problems: | 965 | # required because of several problems: |
284 | @@ -934,7 +969,8 @@ | |||
285 | 934 | # the email's summary section. | 969 | # the email's summary section. |
286 | 935 | # For now, it's just easier to re-read the original file if the caller | 970 | # For now, it's just easier to re-read the original file if the caller |
287 | 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. |
289 | 937 | changes, changes_lines = self._getChangesDict(changes_file_object) | 972 | changes, changes_lines = self._getChangesDict( |
290 | 973 | changes_file_object, allow_unsigned=allow_unsigned) | ||
291 | 938 | 974 | ||
292 | 939 | # "files" will contain a list of tuples of filename,component,section. | 975 | # "files" will contain a list of tuples of filename,component,section. |
293 | 940 | # If files is empty, we don't need to send an email if this is not | 976 | # If files is empty, we don't need to send an email if this is not |
294 | @@ -1087,7 +1123,7 @@ | |||
295 | 1087 | # the section of the source package uploaded in order to facilitate | 1123 | # the section of the source package uploaded in order to facilitate |
296 | 1088 | # filtering on the part of the email recipients. | 1124 | # filtering on the part of the email recipients. |
297 | 1089 | if self.sources: | 1125 | if self.sources: |
299 | 1090 | spr = self.sourcepackagerelease | 1126 | spr = self.mySourcePackageRelease() |
300 | 1091 | xlp_component_header = 'component=%s, section=%s' % ( | 1127 | xlp_component_header = 'component=%s, section=%s' % ( |
301 | 1092 | spr.component.name, spr.section.name) | 1128 | spr.component.name, spr.section.name) |
302 | 1093 | extra_headers['X-Launchpad-Component'] = xlp_component_header | 1129 | extra_headers['X-Launchpad-Component'] = xlp_component_header |
303 | 1094 | 1130 | ||
304 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' | |||
305 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-08-28 07:34:44 +0000 | |||
306 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-01 07:08:14 +0000 | |||
307 | @@ -50,6 +50,24 @@ | |||
308 | 50 | TestCase, TestCaseWithFactory) | 50 | TestCase, TestCaseWithFactory) |
309 | 51 | 51 | ||
310 | 52 | 52 | ||
311 | 53 | def _create_source(test_publisher, archive): | ||
312 | 54 | """Create source with meaningful '.changes' file.""" | ||
313 | 55 | changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-2_binary/foocomm_1.0-2_i386.changes' | ||
314 | 56 | |||
315 | 57 | changesfile_content = '' | ||
316 | 58 | handle = open(changesfile_path, 'r') | ||
317 | 59 | try: | ||
318 | 60 | changesfile_content = handle.read() | ||
319 | 61 | finally: | ||
320 | 62 | handle.close() | ||
321 | 63 | |||
322 | 64 | source = test_publisher.getPubSource( | ||
323 | 65 | sourcename='foocomm', archive=archive, version='1.0-2', | ||
324 | 66 | changes_file_content=changesfile_content) | ||
325 | 67 | |||
326 | 68 | return source | ||
327 | 69 | |||
328 | 70 | |||
329 | 53 | class ReUploadFileTestCase(TestCaseWithFactory): | 71 | class ReUploadFileTestCase(TestCaseWithFactory): |
330 | 54 | """Test `ILibraryFileAlias` reupload helper. | 72 | """Test `ILibraryFileAlias` reupload helper. |
331 | 55 | 73 | ||
332 | @@ -770,7 +788,7 @@ | |||
333 | 770 | purpose=ArchivePurpose.PPA) | 788 | purpose=ArchivePurpose.PPA) |
334 | 771 | private_archive.buildd_secret = 'x' | 789 | private_archive.buildd_secret = 'x' |
335 | 772 | private_archive.private = True | 790 | private_archive.private = True |
337 | 773 | source = self.test_publisher.getPubSource(archive=private_archive) | 791 | source = _create_source(self.test_publisher, private_archive) |
338 | 774 | 792 | ||
339 | 775 | archive = self.test_publisher.ubuntutest.main_archive | 793 | archive = self.test_publisher.ubuntutest.main_archive |
340 | 776 | series = source.distroseries | 794 | series = source.distroseries |
341 | @@ -899,7 +917,7 @@ | |||
342 | 899 | ppa.buildd_secret = 'x' | 917 | ppa.buildd_secret = 'x' |
343 | 900 | ppa.private = True | 918 | ppa.private = True |
344 | 901 | 919 | ||
346 | 902 | source = self.test_publisher.getPubSource(archive=ppa) | 920 | source = _create_source(self.test_publisher, ppa) |
347 | 903 | self.test_publisher.getPubBinaries(pub_source=source) | 921 | self.test_publisher.getPubBinaries(pub_source=source) |
348 | 904 | 922 | ||
349 | 905 | [build] = source.getBuilds() | 923 | [build] = source.getBuilds() |
350 | @@ -944,7 +962,7 @@ | |||
351 | 944 | # The returned object has a more descriptive 'displayname' | 962 | # The returned object has a more descriptive 'displayname' |
352 | 945 | # attribute than plain `IPackageUpload` instances. | 963 | # attribute than plain `IPackageUpload` instances. |
353 | 946 | self.assertEquals( | 964 | self.assertEquals( |
355 | 947 | 'Delayed copy of foo - 666 (source, i386, raw-dist-upgrader)', | 965 | 'Delayed copy of foocomm - 1.0-2 (source, i386, raw-dist-upgrader)', |
356 | 948 | delayed_copy.displayname) | 966 | delayed_copy.displayname) |
357 | 949 | 967 | ||
358 | 950 | # It is targeted to the right publishing context. | 968 | # It is targeted to the right publishing context. |
359 | 951 | 969 | ||
360 | === modified file 'lib/lp/soyuz/stories/webservice/xx-archive.txt' | |||
361 | --- lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-09-23 07:41:13 +0000 | |||
362 | +++ lib/lp/soyuz/stories/webservice/xx-archive.txt 2009-10-01 07:08:14 +0000 | |||
363 | @@ -735,13 +735,29 @@ | |||
364 | 735 | 735 | ||
365 | 736 | Make Celso's PPA private and create a private source publication. | 736 | Make Celso's PPA private and create a private source publication. |
366 | 737 | 737 | ||
367 | 738 | >>> def _create_source(archive, version): | ||
368 | 739 | ... """Create source with meaningful '.changes' file.""" | ||
369 | 740 | ... changesfile_path = 'lib/lp/archiveuploader/tests/data/suite/foocomm_%s_binary/foocomm_%s_i386.changes' % ((version,)*2) | ||
370 | 741 | ... | ||
371 | 742 | ... changesfile_content = '' | ||
372 | 743 | ... handle = open(changesfile_path, 'r') | ||
373 | 744 | ... try: | ||
374 | 745 | ... changesfile_content = handle.read() | ||
375 | 746 | ... finally: | ||
376 | 747 | ... handle.close() | ||
377 | 748 | ... | ||
378 | 749 | ... source = test_publisher.getPubSource( | ||
379 | 750 | ... sourcename='foocomm', archive=archive, version=version, | ||
380 | 751 | ... changes_file_content=changesfile_content) | ||
381 | 752 | ... | ||
382 | 753 | ... return source | ||
383 | 754 | |||
384 | 738 | >>> login('foo.bar@canonical.com') | 755 | >>> login('foo.bar@canonical.com') |
385 | 739 | 756 | ||
386 | 740 | >>> cprov.archive.buildd_secret = 'boing' | 757 | >>> cprov.archive.buildd_secret = 'boing' |
387 | 741 | >>> cprov.archive.private = True | 758 | >>> cprov.archive.private = True |
388 | 742 | 759 | ||
391 | 743 | >>> private_publication = test_publisher.getPubSource( | 760 | >>> private_publication = _create_source(cprov.archive, '1.0-1') |
390 | 744 | ... sourcename="private", version="1.0", archive=cprov.archive) | ||
392 | 745 | 761 | ||
393 | 746 | >>> logout() | 762 | >>> logout() |
394 | 747 | 763 | ||
395 | @@ -893,12 +909,12 @@ | |||
396 | 893 | Copying private sources to public archives works fine with | 909 | Copying private sources to public archives works fine with |
397 | 894 | `syncSource` or `syncSources` operations. | 910 | `syncSource` or `syncSources` operations. |
398 | 895 | 911 | ||
400 | 896 | We use `syncSource` to copy 'private - 1.0' source from Celso's | 912 | We use `syncSource` to copy 'foocomm - 1.0-1' source from Celso's |
401 | 897 | private PPA to the ubuntu primary archive. | 913 | private PPA to the ubuntu primary archive. |
402 | 898 | 914 | ||
403 | 899 | >>> print cprov_webservice.named_post( | 915 | >>> print cprov_webservice.named_post( |
404 | 900 | ... ubuntu['main_archive_link'], 'syncSource', {}, | 916 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
406 | 901 | ... source_name='private', version='1.0', to_pocket='release', | 917 | ... source_name='foocomm', version='1.0-1', to_pocket='release', |
407 | 902 | ... from_archive=cprov_archive['self_link'], | 918 | ... from_archive=cprov_archive['self_link'], |
408 | 903 | ... to_series="hoary") | 919 | ... to_series="hoary") |
409 | 904 | HTTP/1.1 200 Ok | 920 | HTTP/1.1 200 Ok |
410 | @@ -908,13 +924,12 @@ | |||
411 | 908 | version. | 924 | version. |
412 | 909 | 925 | ||
413 | 910 | >>> login('foo.bar@canonical.com') | 926 | >>> login('foo.bar@canonical.com') |
416 | 911 | >>> unused = test_publisher.getPubSource( | 927 | >>> unused = _create_source(cprov.archive, '1.0-2') |
415 | 912 | ... sourcename="private", version="1.1", archive=cprov.archive) | ||
417 | 913 | >>> logout() | 928 | >>> logout() |
418 | 914 | 929 | ||
419 | 915 | >>> print cprov_webservice.named_post( | 930 | >>> print cprov_webservice.named_post( |
420 | 916 | ... ubuntu['main_archive_link'], 'syncSources', {}, | 931 | ... ubuntu['main_archive_link'], 'syncSources', {}, |
422 | 917 | ... source_names=['private'], to_pocket='release', | 932 | ... source_names=['foocomm'], to_pocket='release', |
423 | 918 | ... from_archive=cprov_archive['self_link'], | 933 | ... from_archive=cprov_archive['self_link'], |
424 | 919 | ... to_series="hoary") | 934 | ... to_series="hoary") |
425 | 920 | HTTP/1.1 200 Ok | 935 | HTTP/1.1 200 Ok |
426 | @@ -925,12 +940,12 @@ | |||
427 | 925 | 940 | ||
428 | 926 | >>> print cprov_webservice.named_post( | 941 | >>> print cprov_webservice.named_post( |
429 | 927 | ... ubuntu['main_archive_link'], 'syncSource', {}, | 942 | ... ubuntu['main_archive_link'], 'syncSource', {}, |
431 | 928 | ... source_name='private', version='1.1', to_pocket='release', | 943 | ... source_name='foocomm', version='1.0-2', to_pocket='release', |
432 | 929 | ... from_archive=cprov_archive['self_link'], | 944 | ... from_archive=cprov_archive['self_link'], |
433 | 930 | ... to_series="hoary") | 945 | ... to_series="hoary") |
434 | 931 | HTTP/1.1 400 Bad Request | 946 | HTTP/1.1 400 Bad Request |
435 | 932 | ... | 947 | ... |
437 | 933 | CannotCopy: private 1.1 in hoary | 948 | CannotCopy: foocomm 1.0-2 in hoary |
438 | 934 | (same version already uploaded and waiting in ACCEPTED queue) | 949 | (same version already uploaded and waiting in ACCEPTED queue) |
439 | 935 | 950 | ||
440 | 936 | 951 | ||
441 | 937 | 952 | ||
442 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' | |||
443 | --- lib/lp/soyuz/tests/test_packageupload.py 2009-08-28 07:34:44 +0000 | |||
444 | +++ lib/lp/soyuz/tests/test_packageupload.py 2009-10-01 07:08:14 +0000 | |||
445 | @@ -12,10 +12,12 @@ | |||
446 | 12 | from canonical.config import config | 12 | from canonical.config import config |
447 | 13 | from canonical.launchpad.scripts import BufferLogger | 13 | from canonical.launchpad.scripts import BufferLogger |
448 | 14 | from canonical.testing import LaunchpadZopelessLayer | 14 | from canonical.testing import LaunchpadZopelessLayer |
449 | 15 | from email import message_from_string | ||
450 | 15 | from lp.archiveuploader.tests import datadir | 16 | from lp.archiveuploader.tests import datadir |
451 | 16 | from lp.registry.interfaces.distribution import IDistributionSet | 17 | from lp.registry.interfaces.distribution import IDistributionSet |
452 | 17 | from lp.registry.interfaces.distroseries import DistroSeriesStatus | 18 | from lp.registry.interfaces.distroseries import DistroSeriesStatus |
453 | 18 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 19 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
454 | 20 | from lp.services.mail import stub | ||
455 | 19 | from lp.soyuz.interfaces.archive import ArchivePurpose | 21 | from lp.soyuz.interfaces.archive import ArchivePurpose |
456 | 20 | from lp.soyuz.interfaces.build import BuildStatus | 22 | from lp.soyuz.interfaces.build import BuildStatus |
457 | 21 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus | 23 | from lp.soyuz.interfaces.publishing import PackagePublishingStatus |
458 | @@ -87,7 +89,18 @@ | |||
459 | 87 | ppa.buildd_secret = 'x' | 89 | ppa.buildd_secret = 'x' |
460 | 88 | ppa.private = True | 90 | ppa.private = True |
461 | 89 | 91 | ||
463 | 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' |
464 | 93 | |||
465 | 94 | changesfile_content = '' | ||
466 | 95 | handle = open(changesfile_path, 'r') | ||
467 | 96 | try: | ||
468 | 97 | changesfile_content = handle.read() | ||
469 | 98 | finally: | ||
470 | 99 | handle.close() | ||
471 | 100 | |||
472 | 101 | source = self.test_publisher.getPubSource( | ||
473 | 102 | sourcename='foocomm', archive=ppa, version='1.0-2', | ||
474 | 103 | changes_file_content=changesfile_content) | ||
475 | 91 | delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( | 104 | delayed_copy = getUtility(IPackageUploadSet).createDelayedCopy( |
476 | 92 | self.test_publisher.ubuntutest.main_archive, | 105 | self.test_publisher.ubuntutest.main_archive, |
477 | 93 | self.test_publisher.breezy_autotest, | 106 | self.test_publisher.breezy_autotest, |
478 | @@ -95,6 +108,13 @@ | |||
479 | 95 | self.test_publisher.person.gpgkeys[0]) | 108 | self.test_publisher.person.gpgkeys[0]) |
480 | 96 | 109 | ||
481 | 97 | delayed_copy.addSource(source.sourcepackagerelease) | 110 | delayed_copy.addSource(source.sourcepackagerelease) |
482 | 111 | |||
483 | 112 | announce_list = delayed_copy.distroseries.changeslist | ||
484 | 113 | if announce_list is None or len(announce_list.strip()) == 0: | ||
485 | 114 | announce_list = ('%s-changes@lists.ubuntu.com' % | ||
486 | 115 | delayed_copy.distroseries.name) | ||
487 | 116 | delayed_copy.distroseries.changeslist = announce_list | ||
488 | 117 | |||
489 | 98 | if not source_only: | 118 | if not source_only: |
490 | 99 | self.test_publisher.getPubBinaries(pub_source=source) | 119 | self.test_publisher.getPubBinaries(pub_source=source) |
491 | 100 | custom_path = datadir( | 120 | custom_path = datadir( |
492 | @@ -162,7 +182,7 @@ | |||
493 | 162 | 182 | ||
494 | 163 | # Create an ancestry publication in 'multiverse'. | 183 | # Create an ancestry publication in 'multiverse'. |
495 | 164 | ancestry_source = self.test_publisher.getPubSource( | 184 | ancestry_source = self.test_publisher.getPubSource( |
497 | 165 | version='1.0', component='multiverse', | 185 | sourcename='foocomm', version='1.0', component='multiverse', |
498 | 166 | status=PackagePublishingStatus.PUBLISHED) | 186 | status=PackagePublishingStatus.PUBLISHED) |
499 | 167 | self.test_publisher.getPubBinaries( | 187 | self.test_publisher.getPubBinaries( |
500 | 168 | pub_source=ancestry_source, | 188 | pub_source=ancestry_source, |
501 | @@ -187,6 +207,25 @@ | |||
502 | 187 | PackageUploadStatus.DONE, delayed_copy.status) | 207 | PackageUploadStatus.DONE, delayed_copy.status) |
503 | 188 | 208 | ||
504 | 189 | self.layer.txn.commit() | 209 | self.layer.txn.commit() |
505 | 210 | |||
506 | 211 | # Check the announcement email. | ||
507 | 212 | from_addr, to_addrs, raw_msg = stub.test_emails.pop() | ||
508 | 213 | # This is now a MIMEMultipart message. | ||
509 | 214 | msg = message_from_string(raw_msg) | ||
510 | 215 | body = msg.get_payload(0) | ||
511 | 216 | body = body.get_payload(decode=True) | ||
512 | 217 | |||
513 | 218 | self.assertEquals(from_addr, 'bounces@canonical.com') | ||
514 | 219 | self.assertEquals( | ||
515 | 220 | to_addrs, ['breezy-autotest-changes@lists.ubuntu.com']) | ||
516 | 221 | |||
517 | 222 | expected_subject = ( | ||
518 | 223 | '[ubuntutest/breezy-autotest-security]\n\t' | ||
519 | 224 | 'dist-upgrader_20060302.0120_all.tar.gz, foocomm 1.0-2 (Accepted)') | ||
520 | 225 | self.assertEquals(msg['Subject'], expected_subject) | ||
521 | 226 | |||
522 | 227 | self.assertTrue(body.startswith('foocomm (1.0-2) breezy; urgency=low')) | ||
523 | 228 | |||
524 | 190 | self.layer.switchDbUser('launchpad') | 229 | self.layer.switchDbUser('launchpad') |
525 | 191 | 230 | ||
526 | 192 | # One source and 2 binaries are pending publication. They all were | 231 | # One source and 2 binaries are pending publication. They all were |
527 | @@ -194,10 +233,10 @@ | |||
528 | 194 | # librarian. | 233 | # librarian. |
529 | 195 | self.assertEquals(3, len(pub_records)) | 234 | self.assertEquals(3, len(pub_records)) |
530 | 196 | self.assertEquals( | 235 | self.assertEquals( |
535 | 197 | set(['foo 1.1 in breezy-autotest', | 236 | set([ |
536 | 198 | 'foo-bin 1.1 in breezy-autotest hppa', | 237 | u'foocomm 1.0-2 in breezy-autotest', |
537 | 199 | 'foo-bin 1.1 in breezy-autotest i386', | 238 | u'foo-bin 1.0-2 in breezy-autotest hppa', |
538 | 200 | ]), | 239 | u'foo-bin 1.0-2 in breezy-autotest i386']), |
539 | 201 | set([pub.displayname for pub in pub_records])) | 240 | set([pub.displayname for pub in pub_records])) |
540 | 202 | 241 | ||
541 | 203 | for pub_record in pub_records: | 242 | for pub_record in pub_records: |
Hello there!
When security fix packages are un-embargo'ed they are copied to the primary
archive. Since they become publicly available now an announcement email needs
to be sent out.
Pre-implementation call with Celso.
Tests to run:
bin/test -vv -t package -t upload
P.S.: I retracted this branch from review an hour ago in order to fix 2 test failures I did not notice in time. Now everything is fixed and all the tests pass :)