Merge lp:~wgrant/launchpad/test-ddeb-matching into lp:launchpad/db-devel
- test-ddeb-matching
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Māris Fogels |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9622 |
Proposed branch: | lp:~wgrant/launchpad/test-ddeb-matching |
Merge into: | lp:launchpad/db-devel |
Prerequisite: | lp:~wgrant/launchpad/refactor-nuf-creation |
Diff against target: |
962 lines (+226/-114) 17 files modified
lib/canonical/launchpad/testing/fakepackager.py (+2/-1) lib/lp/archiveuploader/nascentupload.py (+70/-52) lib/lp/archiveuploader/tests/nascentupload-announcements.txt (+20/-19) lib/lp/archiveuploader/tests/nascentupload-packageset.txt (+3/-3) lib/lp/archiveuploader/tests/nascentupload-security-uploads.txt (+2/-2) lib/lp/archiveuploader/tests/nascentupload.txt (+20/-19) lib/lp/archiveuploader/tests/test_nascentupload.py (+85/-0) lib/lp/archiveuploader/tests/test_nascentupload_documentation.py (+8/-3) lib/lp/archiveuploader/uploadprocessor.py (+2/-1) lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt (+1/-1) lib/lp/soyuz/doc/build-failedtoupload-workflow.txt (+1/-1) lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt (+3/-3) lib/lp/soyuz/doc/distroseriesqueue-debian-installer.txt (+1/-1) lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt (+4/-4) lib/lp/soyuz/doc/distroseriesqueue-translations.txt (+1/-1) lib/lp/soyuz/doc/distroseriesqueue.txt (+2/-2) lib/lp/soyuz/scripts/tests/test_queue.py (+1/-1) |
To merge this branch: | bzr merge lp:~wgrant/launchpad/test-ddeb-matching |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Māris Fogels (community) | code | Approve | |
Review via email: mp+31482@code.launchpad.net |
Commit message
Add unit tests for NascentUpload's DDEB matching code.
Description of the change
This branch factors out and adds unit tests for the DDEB-matching part of NascentUpload.
To make the tests less foul, I've altered NascentUpload to allow passing in an existing ChangesFile-like object, rather than requiring a path to a real file. This should eventually let us shrink existing tests throughout archiveuploader, and even remove test package data.
I've left the existing basic end-to-end test at the end of nascentupload-
William Grant (wgrant) wrote : | # |
> Hi William,
>
> This is a meaty change, lots of new code. Very nice. I especially like the
> refactoring of NascentUpload and _matchDDEBs(): both excellent changes.
>
> Here is the list of notes I took while reviewing the code:
>
> • Do ChangesFile objects have a .path attribute that you can use instead of
> string-sniffing in the constructor? If so, then perhaps you can push the
> fiddly conditional construction down into ChangesFile itself and at the same
> time eliminate the .changesfile_path attribute from the NascentUpload object.
> A NascentUpload.
> the conditional construction entirely.
Both fixed. All path-based NascentUpload() callsites updated to use NascentUpload.
> • Switching from .reject() to 'yield UploadError()' is a pretty big API
> change, however I do not see any code in the diff (besides the tests) that is
> impacted by it. Why not?
It's a pattern used throughout archiveuploader -- we call
run_and_
yielded errors.
> • It would be good to have a docstring for _matchDDEBs() that tells you that
> it is a generator method.
Missed that. Fixed.
> • I think the test names could be improved a bit: the comment should be used
> as test method name, because the comments tell you what the desired behaviour
> is. They tell you what the test is actually testing.
Fair point. Fixed.
> • You might be able to rewrite all those "self.assertEqu
> list(self.
> testtools.
> matchesDDEBs([]))
I opted to instead create a tiny domain-specific assertion method.
> With the above points taken into consideration, r=mars
Thanks.
Māris Fogels (mars) wrote : | # |
These changes still look good to me. I'll run it through ec2 land.
Maris
Preview Diff
1 | === modified file 'lib/canonical/launchpad/testing/fakepackager.py' | |||
2 | --- lib/canonical/launchpad/testing/fakepackager.py 2009-09-14 04:07:18 +0000 | |||
3 | +++ lib/canonical/launchpad/testing/fakepackager.py 2010-08-04 22:12:18 +0000 | |||
4 | @@ -278,7 +278,8 @@ | |||
5 | 278 | if suite is not None: | 278 | if suite is not None: |
6 | 279 | policy.setDistroSeriesAndPocket(suite) | 279 | policy.setDistroSeriesAndPocket(suite) |
7 | 280 | 280 | ||
9 | 281 | upload = NascentUpload(changesfile_path, policy, logger) | 281 | upload = NascentUpload.from_changesfile_path( |
10 | 282 | changesfile_path, policy, logger) | ||
11 | 282 | upload.process() | 283 | upload.process() |
12 | 283 | 284 | ||
13 | 284 | return upload | 285 | return upload |
14 | 285 | 286 | ||
15 | === modified file 'lib/lp/archiveuploader/nascentupload.py' | |||
16 | --- lib/lp/archiveuploader/nascentupload.py 2010-08-03 08:49:19 +0000 | |||
17 | +++ lib/lp/archiveuploader/nascentupload.py 2010-08-04 22:12:18 +0000 | |||
18 | @@ -86,24 +86,35 @@ | |||
19 | 86 | # Defined if we successfully do_accept() and storeObjectsInDatabase() | 86 | # Defined if we successfully do_accept() and storeObjectsInDatabase() |
20 | 87 | queue_root = None | 87 | queue_root = None |
21 | 88 | 88 | ||
24 | 89 | def __init__(self, changesfile_path, policy, logger): | 89 | def __init__(self, changesfile, policy, logger): |
25 | 90 | """Setup a ChangesFile based on given changesfile path. | 90 | """Setup a NascentUpload for the given ChangesFile. |
26 | 91 | 91 | ||
30 | 92 | May raise FatalUploadError due to unrecoverable problems building | 92 | :param changesfile: the ChangesFile object to be uploaded. |
31 | 93 | the ChangesFile object. | 93 | :param policy: the upload policy to be used. |
32 | 94 | Also store given and initialized Upload Policy, as 'policy' | 94 | :param logger: the logger to be used. |
33 | 95 | """ | 95 | """ |
34 | 96 | self.changesfile_path = changesfile_path | ||
35 | 97 | self.policy = policy | 96 | self.policy = policy |
36 | 98 | self.logger = logger | 97 | self.logger = logger |
37 | 99 | 98 | ||
38 | 100 | self.rejections = [] | 99 | self.rejections = [] |
39 | 101 | self.warnings = [] | 100 | self.warnings = [] |
40 | 102 | |||
41 | 103 | self.librarian = getUtility(ILibraryFileAliasSet) | 101 | self.librarian = getUtility(ILibraryFileAliasSet) |
42 | 102 | |||
43 | 103 | self.changes = changesfile | ||
44 | 104 | |||
45 | 105 | @classmethod | ||
46 | 106 | def from_changesfile_path(cls, changesfile_path, policy, logger): | ||
47 | 107 | """Create a NascentUpload from the given changesfile path. | ||
48 | 108 | |||
49 | 109 | May raise FatalUploadError due to unrecoverable problems building | ||
50 | 110 | the ChangesFile object. | ||
51 | 111 | |||
52 | 112 | :param changesfile_path: path to the changesfile to be uploaded. | ||
53 | 113 | :param policy: the upload policy to be used. | ||
54 | 114 | :param logger: the logger to be used. | ||
55 | 115 | """ | ||
56 | 104 | try: | 116 | try: |
59 | 105 | self.changes = ChangesFile( | 117 | changesfile = ChangesFile(changesfile_path, policy, logger) |
58 | 106 | changesfile_path, self.policy, self.logger) | ||
60 | 107 | except UploadError, e: | 118 | except UploadError, e: |
61 | 108 | # We can't run reject() because unfortunately we don't have | 119 | # We can't run reject() because unfortunately we don't have |
62 | 109 | # the address of the uploader to notify -- we broke in that | 120 | # the address of the uploader to notify -- we broke in that |
63 | @@ -112,6 +123,7 @@ | |||
64 | 112 | # rejection to the archive admins. For now, this will end | 123 | # rejection to the archive admins. For now, this will end |
65 | 113 | # up in the script log. | 124 | # up in the script log. |
66 | 114 | raise FatalUploadError(str(e)) | 125 | raise FatalUploadError(str(e)) |
67 | 126 | return cls(changesfile, policy, logger) | ||
68 | 115 | 127 | ||
69 | 116 | def process(self): | 128 | def process(self): |
70 | 117 | """Process this upload, checking it against policy, loading it into | 129 | """Process this upload, checking it against policy, loading it into |
71 | @@ -148,6 +160,7 @@ | |||
72 | 148 | self._check_sourceful_consistency() | 160 | self._check_sourceful_consistency() |
73 | 149 | if self.binaryful: | 161 | if self.binaryful: |
74 | 150 | self._check_binaryful_consistency() | 162 | self._check_binaryful_consistency() |
75 | 163 | self.run_and_collect_errors(self._matchDDEBs) | ||
76 | 151 | 164 | ||
77 | 152 | self.run_and_collect_errors(self.changes.verify) | 165 | self.run_and_collect_errors(self.changes.verify) |
78 | 153 | 166 | ||
79 | @@ -155,35 +168,6 @@ | |||
80 | 155 | for uploaded_file in self.changes.files: | 168 | for uploaded_file in self.changes.files: |
81 | 156 | self.run_and_collect_errors(uploaded_file.verify) | 169 | self.run_and_collect_errors(uploaded_file.verify) |
82 | 157 | 170 | ||
83 | 158 | unmatched_ddebs = {} | ||
84 | 159 | for uploaded_file in self.changes.files: | ||
85 | 160 | if isinstance(uploaded_file, DdebBinaryUploadFile): | ||
86 | 161 | ddeb_key = (uploaded_file.package, uploaded_file.version, | ||
87 | 162 | uploaded_file.architecture) | ||
88 | 163 | if ddeb_key in unmatched_ddebs: | ||
89 | 164 | self.reject("Duplicated debug packages: %s %s (%s)" % | ||
90 | 165 | ddeb_key) | ||
91 | 166 | else: | ||
92 | 167 | unmatched_ddebs[ddeb_key] = uploaded_file | ||
93 | 168 | |||
94 | 169 | for uploaded_file in self.changes.files: | ||
95 | 170 | # We need exactly a DEB, not a DDEB. | ||
96 | 171 | if (isinstance(uploaded_file, DebBinaryUploadFile) and | ||
97 | 172 | not isinstance(uploaded_file, DdebBinaryUploadFile)): | ||
98 | 173 | try: | ||
99 | 174 | matching_ddeb = unmatched_ddebs.pop( | ||
100 | 175 | (uploaded_file.package + '-dbgsym', | ||
101 | 176 | uploaded_file.version, | ||
102 | 177 | uploaded_file.architecture)) | ||
103 | 178 | except KeyError: | ||
104 | 179 | continue | ||
105 | 180 | uploaded_file.ddeb_file = matching_ddeb | ||
106 | 181 | matching_ddeb.deb_file = uploaded_file | ||
107 | 182 | |||
108 | 183 | if len(unmatched_ddebs) > 0: | ||
109 | 184 | self.reject("Orphaned debug packages: %s" % ', '.join('%s %s (%s)' % d | ||
110 | 185 | for d in unmatched_ddebs)) | ||
111 | 186 | |||
112 | 187 | if (len(self.changes.files) == 1 and | 171 | if (len(self.changes.files) == 1 and |
113 | 188 | isinstance(self.changes.files[0], CustomUploadFile)): | 172 | isinstance(self.changes.files[0], CustomUploadFile)): |
114 | 189 | self.logger.debug("Single Custom Upload detected.") | 173 | self.logger.debug("Single Custom Upload detected.") |
115 | @@ -197,7 +181,7 @@ | |||
116 | 197 | "Upload rejected because it contains binary packages.", | 181 | "Upload rejected because it contains binary packages.", |
117 | 198 | "Ensure you are using `debuild -S`, or an equivalent", | 182 | "Ensure you are using `debuild -S`, or an equivalent", |
118 | 199 | "command, to generate only the source package before", | 183 | "command, to generate only the source package before", |
120 | 200 | "re-uploading." | 184 | "re-uploading.", |
121 | 201 | ] | 185 | ] |
122 | 202 | if self.is_ppa: | 186 | if self.is_ppa: |
123 | 203 | messages.append( | 187 | messages.append( |
124 | @@ -241,7 +225,7 @@ | |||
125 | 241 | @property | 225 | @property |
126 | 242 | def filename(self): | 226 | def filename(self): |
127 | 243 | """Return the changesfile name.""" | 227 | """Return the changesfile name.""" |
129 | 244 | return os.path.basename(self.changesfile_path) | 228 | return os.path.basename(self.changesfile.filepath) |
130 | 245 | 229 | ||
131 | 246 | @property | 230 | @property |
132 | 247 | def is_new(self): | 231 | def is_new(self): |
133 | @@ -254,7 +238,6 @@ | |||
134 | 254 | # | 238 | # |
135 | 255 | # Overall consistency checks | 239 | # Overall consistency checks |
136 | 256 | # | 240 | # |
137 | 257 | |||
138 | 258 | def _check_overall_consistency(self): | 241 | def _check_overall_consistency(self): |
139 | 259 | """Heuristics checks on upload contents and declared architecture. | 242 | """Heuristics checks on upload contents and declared architecture. |
140 | 260 | 243 | ||
141 | @@ -329,7 +312,8 @@ | |||
142 | 329 | """Heuristic checks on a sourceful upload. | 312 | """Heuristic checks on a sourceful upload. |
143 | 330 | 313 | ||
144 | 331 | Raises AssertionError when called for a non-sourceful upload. | 314 | Raises AssertionError when called for a non-sourceful upload. |
146 | 332 | Ensures a sourceful upload has exactly one DSC. | 315 | Ensures a sourceful upload has exactly one DSC. All further source |
147 | 316 | checks are performed later by the DSC. | ||
148 | 333 | """ | 317 | """ |
149 | 334 | assert self.sourceful, ( | 318 | assert self.sourceful, ( |
150 | 335 | "Source consistency check called for a non-source upload") | 319 | "Source consistency check called for a non-source upload") |
151 | @@ -369,10 +353,49 @@ | |||
152 | 369 | if len(considered_archs) > max: | 353 | if len(considered_archs) > max: |
153 | 370 | self.reject("Upload has more architetures than it is supported.") | 354 | self.reject("Upload has more architetures than it is supported.") |
154 | 371 | 355 | ||
155 | 356 | def _matchDDEBs(self): | ||
156 | 357 | """Check and link DEBs and DDEBs in the upload. | ||
157 | 358 | |||
158 | 359 | Matches each DDEB to its corresponding DEB, adding links in both | ||
159 | 360 | directions. Unmatched or duplicated DDEBs result in upload errors. | ||
160 | 361 | |||
161 | 362 | This method is an error generator, i.e, it returns an iterator over | ||
162 | 363 | all exceptions that are generated while processing all mentioned | ||
163 | 364 | files. | ||
164 | 365 | """ | ||
165 | 366 | unmatched_ddebs = {} | ||
166 | 367 | for uploaded_file in self.changes.files: | ||
167 | 368 | if isinstance(uploaded_file, DdebBinaryUploadFile): | ||
168 | 369 | ddeb_key = (uploaded_file.package, uploaded_file.version, | ||
169 | 370 | uploaded_file.architecture) | ||
170 | 371 | if ddeb_key in unmatched_ddebs: | ||
171 | 372 | yield UploadError( | ||
172 | 373 | "Duplicated debug packages: %s %s (%s)" % ddeb_key) | ||
173 | 374 | else: | ||
174 | 375 | unmatched_ddebs[ddeb_key] = uploaded_file | ||
175 | 376 | |||
176 | 377 | for uploaded_file in self.changes.files: | ||
177 | 378 | # We need exactly a DEB, not a DDEB. | ||
178 | 379 | if (isinstance(uploaded_file, DebBinaryUploadFile) and | ||
179 | 380 | not isinstance(uploaded_file, DdebBinaryUploadFile)): | ||
180 | 381 | try: | ||
181 | 382 | matching_ddeb = unmatched_ddebs.pop( | ||
182 | 383 | (uploaded_file.package + '-dbgsym', | ||
183 | 384 | uploaded_file.version, | ||
184 | 385 | uploaded_file.architecture)) | ||
185 | 386 | except KeyError: | ||
186 | 387 | continue | ||
187 | 388 | uploaded_file.ddeb_file = matching_ddeb | ||
188 | 389 | matching_ddeb.deb_file = uploaded_file | ||
189 | 390 | |||
190 | 391 | if len(unmatched_ddebs) > 0: | ||
191 | 392 | yield UploadError( | ||
192 | 393 | "Orphaned debug packages: %s" % ', '.join( | ||
193 | 394 | '%s %s (%s)' % d for d in unmatched_ddebs)) | ||
194 | 395 | |||
195 | 372 | # | 396 | # |
196 | 373 | # Helpers for warnings and rejections | 397 | # Helpers for warnings and rejections |
197 | 374 | # | 398 | # |
198 | 375 | |||
199 | 376 | def run_and_check_error(self, callable): | 399 | def run_and_check_error(self, callable): |
200 | 377 | """Run the given callable and process errors and warnings. | 400 | """Run the given callable and process errors and warnings. |
201 | 378 | 401 | ||
202 | @@ -471,7 +494,6 @@ | |||
203 | 471 | # | 494 | # |
204 | 472 | # Signature and ACL stuff | 495 | # Signature and ACL stuff |
205 | 473 | # | 496 | # |
206 | 474 | |||
207 | 475 | def verify_acl(self): | 497 | def verify_acl(self): |
208 | 476 | """Check the signer's upload rights. | 498 | """Check the signer's upload rights. |
209 | 477 | 499 | ||
210 | @@ -501,7 +523,7 @@ | |||
211 | 501 | ISourcePackageNameSet).queryByName(self.changes.dsc.package) | 523 | ISourcePackageNameSet).queryByName(self.changes.dsc.package) |
212 | 502 | 524 | ||
213 | 503 | rejection_reason = archive.checkUpload( | 525 | rejection_reason = archive.checkUpload( |
215 | 504 | uploader, self.policy.distroseries, source_name, | 526 | uploader, self.policy.distroseries, source_name, |
216 | 505 | self.changes.dsc.component, self.policy.pocket, not self.is_new) | 527 | self.changes.dsc.component, self.policy.pocket, not self.is_new) |
217 | 506 | 528 | ||
218 | 507 | if rejection_reason is not None: | 529 | if rejection_reason is not None: |
219 | @@ -510,7 +532,6 @@ | |||
220 | 510 | # | 532 | # |
221 | 511 | # Handling checking of versions and overrides | 533 | # Handling checking of versions and overrides |
222 | 512 | # | 534 | # |
223 | 513 | |||
224 | 514 | def getSourceAncestry(self, uploaded_file): | 535 | def getSourceAncestry(self, uploaded_file): |
225 | 515 | """Return the last published source (ancestry) for a given file. | 536 | """Return the last published source (ancestry) for a given file. |
226 | 516 | 537 | ||
227 | @@ -739,8 +760,8 @@ | |||
228 | 739 | return | 760 | return |
229 | 740 | 761 | ||
230 | 741 | component_override_map = { | 762 | component_override_map = { |
233 | 742 | 'contrib' : 'multiverse', | 763 | 'contrib': 'multiverse', |
234 | 743 | 'non-free' : 'multiverse', | 764 | 'non-free': 'multiverse', |
235 | 744 | } | 765 | } |
236 | 745 | 766 | ||
237 | 746 | # Apply the component override and default to universe. | 767 | # Apply the component override and default to universe. |
238 | @@ -814,7 +835,6 @@ | |||
239 | 814 | # | 835 | # |
240 | 815 | # Actually processing accepted or rejected uploads -- and mailing people | 836 | # Actually processing accepted or rejected uploads -- and mailing people |
241 | 816 | # | 837 | # |
242 | 817 | |||
243 | 818 | def do_accept(self, notify=True): | 838 | def do_accept(self, notify=True): |
244 | 819 | """Accept the upload into the queue. | 839 | """Accept the upload into the queue. |
245 | 820 | 840 | ||
246 | @@ -921,7 +941,6 @@ | |||
247 | 921 | # | 941 | # |
248 | 922 | # Inserting stuff in the database | 942 | # Inserting stuff in the database |
249 | 923 | # | 943 | # |
250 | 924 | |||
251 | 925 | def storeObjectsInDatabase(self): | 944 | def storeObjectsInDatabase(self): |
252 | 926 | """Insert this nascent upload into the database.""" | 945 | """Insert this nascent upload into the database.""" |
253 | 927 | 946 | ||
254 | @@ -1044,8 +1063,7 @@ | |||
255 | 1044 | # See if there is an archive to override with. | 1063 | # See if there is an archive to override with. |
256 | 1045 | distribution = self.policy.distroseries.distribution | 1064 | distribution = self.policy.distroseries.distribution |
257 | 1046 | archive = distribution.getArchiveByComponent( | 1065 | archive = distribution.getArchiveByComponent( |
260 | 1047 | PARTNER_COMPONENT_NAME | 1066 | PARTNER_COMPONENT_NAME) |
259 | 1048 | ) | ||
261 | 1049 | 1067 | ||
262 | 1050 | # Check for data problems: | 1068 | # Check for data problems: |
263 | 1051 | if not archive: | 1069 | if not archive: |
264 | 1052 | 1070 | ||
265 | === modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt' | |||
266 | --- lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2010-07-24 09:12:37 +0000 | |||
267 | +++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2010-08-04 22:12:18 +0000 | |||
268 | @@ -79,7 +79,7 @@ | |||
269 | 79 | >>> sync_policy = getPolicy( | 79 | >>> sync_policy = getPolicy( |
270 | 80 | ... name='sync', distro='ubuntu', distroseries='hoary') | 80 | ... name='sync', distro='ubuntu', distroseries='hoary') |
271 | 81 | 81 | ||
273 | 82 | >>> bar_src = NascentUpload( | 82 | >>> bar_src = NascentUpload.from_changesfile_path( |
274 | 83 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 83 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
275 | 84 | ... sync_policy, mock_logger_quiet) | 84 | ... sync_policy, mock_logger_quiet) |
276 | 85 | >>> bar_src.process() | 85 | >>> bar_src.process() |
277 | @@ -132,7 +132,7 @@ | |||
278 | 132 | 132 | ||
279 | 133 | Uploading the same package again will result in a rejection email: | 133 | Uploading the same package again will result in a rejection email: |
280 | 134 | 134 | ||
282 | 135 | >>> bar_src = NascentUpload( | 135 | >>> bar_src = NascentUpload.from_changesfile_path( |
283 | 136 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 136 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
284 | 137 | ... sync_policy, mock_logger_quiet) | 137 | ... sync_policy, mock_logger_quiet) |
285 | 138 | >>> bar_src.process() | 138 | >>> bar_src.process() |
286 | @@ -270,7 +270,7 @@ | |||
287 | 270 | >>> ppa_policy.archive = name16_ppa | 270 | >>> ppa_policy.archive = name16_ppa |
288 | 271 | >>> ppa_policy.setDistroSeriesAndPocket('hoary') | 271 | >>> ppa_policy.setDistroSeriesAndPocket('hoary') |
289 | 272 | 272 | ||
291 | 273 | >>> ppa_bar_src = NascentUpload( | 273 | >>> ppa_bar_src = NascentUpload.from_changesfile_path( |
292 | 274 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 274 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
293 | 275 | ... ppa_policy, mock_logger_quiet) | 275 | ... ppa_policy, mock_logger_quiet) |
294 | 276 | >>> ppa_bar_src.process() | 276 | >>> ppa_bar_src.process() |
295 | @@ -308,7 +308,7 @@ | |||
296 | 308 | ... name='sync', distro='ubuntu', distroseries='hoary') | 308 | ... name='sync', distro='ubuntu', distroseries='hoary') |
297 | 309 | >>> modified_sync_policy.can_upload_binaries = True | 309 | >>> modified_sync_policy.can_upload_binaries = True |
298 | 310 | 310 | ||
300 | 311 | >>> bar_src = NascentUpload( | 311 | >>> bar_src = NascentUpload.from_changesfile_path( |
301 | 312 | ... datadir('suite/bar_1.0-1_binary/bar_1.0-1_i386.changes'), | 312 | ... datadir('suite/bar_1.0-1_binary/bar_1.0-1_i386.changes'), |
302 | 313 | ... modified_sync_policy, mock_logger_quiet) | 313 | ... modified_sync_policy, mock_logger_quiet) |
303 | 314 | >>> bar_src.process() | 314 | >>> bar_src.process() |
304 | @@ -336,7 +336,7 @@ | |||
305 | 336 | >>> modified_sync_policy = getPolicy( | 336 | >>> modified_sync_policy = getPolicy( |
306 | 337 | ... name='sync', distro='ubuntu', distroseries='hoary') | 337 | ... name='sync', distro='ubuntu', distroseries='hoary') |
307 | 338 | 338 | ||
309 | 339 | >>> lang_pack = NascentUpload( | 339 | >>> lang_pack = NascentUpload.from_changesfile_path( |
310 | 340 | ... datadir('language-packs/language-pack-pt_1.0-1_source.changes'), | 340 | ... datadir('language-packs/language-pack-pt_1.0-1_source.changes'), |
311 | 341 | ... modified_sync_policy, mock_logger_quiet) | 341 | ... modified_sync_policy, mock_logger_quiet) |
312 | 342 | >>> lang_pack.process() | 342 | >>> lang_pack.process() |
313 | @@ -367,7 +367,7 @@ | |||
314 | 367 | >>> modified_sync_policy = getPolicy( | 367 | >>> modified_sync_policy = getPolicy( |
315 | 368 | ... name='sync', distro='ubuntu', distroseries='hoary') | 368 | ... name='sync', distro='ubuntu', distroseries='hoary') |
316 | 369 | 369 | ||
318 | 370 | >>> lang_pack = NascentUpload( | 370 | >>> lang_pack = NascentUpload.from_changesfile_path( |
319 | 371 | ... datadir('language-packs/language-pack-pt_1.0-2_source.changes'), | 371 | ... datadir('language-packs/language-pack-pt_1.0-2_source.changes'), |
320 | 372 | ... modified_sync_policy, mock_logger_quiet) | 372 | ... modified_sync_policy, mock_logger_quiet) |
321 | 373 | >>> lang_pack.process() | 373 | >>> lang_pack.process() |
322 | @@ -398,7 +398,7 @@ | |||
323 | 398 | ... name='insecure', distro='ubuntu', distroseries=None) | 398 | ... name='insecure', distro='ubuntu', distroseries=None) |
324 | 399 | >>> insecure_policy.setDistroSeriesAndPocket('hoary-updates') | 399 | >>> insecure_policy.setDistroSeriesAndPocket('hoary-updates') |
325 | 400 | 400 | ||
327 | 401 | >>> lang_pack = NascentUpload( | 401 | >>> lang_pack = NascentUpload.from_changesfile_path( |
328 | 402 | ... datadir('language-packs/language-pack-pt_1.0-3_source.changes'), | 402 | ... datadir('language-packs/language-pack-pt_1.0-3_source.changes'), |
329 | 403 | ... insecure_policy, mock_logger_quiet) | 403 | ... insecure_policy, mock_logger_quiet) |
330 | 404 | >>> lang_pack.process() | 404 | >>> lang_pack.process() |
331 | @@ -423,7 +423,7 @@ | |||
332 | 423 | An UNAPPROVED binary upload via insecure will send one email saying that | 423 | An UNAPPROVED binary upload via insecure will send one email saying that |
333 | 424 | the upload is waiting for approval: | 424 | the upload is waiting for approval: |
334 | 425 | 425 | ||
336 | 426 | >>> bar_src = NascentUpload( | 426 | >>> bar_src = NascentUpload.from_changesfile_path( |
337 | 427 | ... datadir('suite/bar_1.0-2/bar_1.0-2_source.changes'), | 427 | ... datadir('suite/bar_1.0-2/bar_1.0-2_source.changes'), |
338 | 428 | ... insecure_policy, mock_logger_quiet) | 428 | ... insecure_policy, mock_logger_quiet) |
339 | 429 | >>> bar_src.process() | 429 | >>> bar_src.process() |
340 | @@ -451,7 +451,7 @@ | |||
341 | 451 | >>> unapproved_backports_policy = getPolicy( | 451 | >>> unapproved_backports_policy = getPolicy( |
342 | 452 | ... name='insecure', distro='ubuntu', distroseries=None) | 452 | ... name='insecure', distro='ubuntu', distroseries=None) |
343 | 453 | >>> unapproved_backports_policy.setDistroSeriesAndPocket('hoary-backports') | 453 | >>> unapproved_backports_policy.setDistroSeriesAndPocket('hoary-backports') |
345 | 454 | >>> bar_src = NascentUpload( | 454 | >>> bar_src = NascentUpload.from_changesfile_path( |
346 | 455 | ... datadir('suite/bar_1.0-3_valid/bar_1.0-3_source.changes'), | 455 | ... datadir('suite/bar_1.0-3_valid/bar_1.0-3_source.changes'), |
347 | 456 | ... unapproved_backports_policy, mock_logger_quiet) | 456 | ... unapproved_backports_policy, mock_logger_quiet) |
348 | 457 | >>> bar_src.process() | 457 | >>> bar_src.process() |
349 | @@ -479,7 +479,7 @@ | |||
350 | 479 | ... name='sync', distro='ubuntu', distroseries=None) | 479 | ... name='sync', distro='ubuntu', distroseries=None) |
351 | 480 | >>> modified_sync_policy.setDistroSeriesAndPocket('hoary-backports') | 480 | >>> modified_sync_policy.setDistroSeriesAndPocket('hoary-backports') |
352 | 481 | 481 | ||
354 | 482 | >>> bar_src = NascentUpload( | 482 | >>> bar_src = NascentUpload.from_changesfile_path( |
355 | 483 | ... datadir('suite/bar_1.0-4/bar_1.0-4_source.changes'), | 483 | ... datadir('suite/bar_1.0-4/bar_1.0-4_source.changes'), |
356 | 484 | ... modified_sync_policy, mock_logger_quiet) | 484 | ... modified_sync_policy, mock_logger_quiet) |
357 | 485 | >>> bar_src.process() | 485 | >>> bar_src.process() |
358 | @@ -536,7 +536,7 @@ | |||
359 | 536 | ... name='security', distro='ubuntu', distroseries=None) | 536 | ... name='security', distro='ubuntu', distroseries=None) |
360 | 537 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') | 537 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') |
361 | 538 | 538 | ||
363 | 539 | >>> bar_src = NascentUpload( | 539 | >>> bar_src = NascentUpload.from_changesfile_path( |
364 | 540 | ... datadir('suite/bar_1.0-2/bar_1.0-2_source.changes'), | 540 | ... datadir('suite/bar_1.0-2/bar_1.0-2_source.changes'), |
365 | 541 | ... security_policy, mock_logger_quiet) | 541 | ... security_policy, mock_logger_quiet) |
366 | 542 | >>> bar_src.process() | 542 | >>> bar_src.process() |
367 | @@ -729,7 +729,7 @@ | |||
368 | 729 | 729 | ||
369 | 730 | >>> hoary.status = SeriesStatus.DEVELOPMENT | 730 | >>> hoary.status = SeriesStatus.DEVELOPMENT |
370 | 731 | 731 | ||
372 | 732 | >>> bar_src = NascentUpload( | 732 | >>> bar_src = NascentUpload.from_changesfile_path( |
373 | 733 | ... datadir( | 733 | ... datadir( |
374 | 734 | ... 'suite/bar_1.0-5_debian_auto_sync/bar_1.0-5_source.changes'), | 734 | ... 'suite/bar_1.0-5_debian_auto_sync/bar_1.0-5_source.changes'), |
375 | 735 | ... sync_policy, mock_logger_quiet) | 735 | ... sync_policy, mock_logger_quiet) |
376 | @@ -749,7 +749,7 @@ | |||
377 | 749 | 749 | ||
378 | 750 | In contrast, manual sync uploads do generate the announcement: | 750 | In contrast, manual sync uploads do generate the announcement: |
379 | 751 | 751 | ||
381 | 752 | >>> bar_src = NascentUpload( | 752 | >>> bar_src = NascentUpload.from_changesfile_path( |
382 | 753 | ... datadir( | 753 | ... datadir( |
383 | 754 | ... 'suite/bar_1.0-6/bar_1.0-6_source.changes'), | 754 | ... 'suite/bar_1.0-6/bar_1.0-6_source.changes'), |
384 | 755 | ... sync_policy, mock_logger_quiet) | 755 | ... sync_policy, mock_logger_quiet) |
385 | @@ -789,7 +789,7 @@ | |||
386 | 789 | ... name='security', distro='ubuntu', distroseries=None) | 789 | ... name='security', distro='ubuntu', distroseries=None) |
387 | 790 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') | 790 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') |
388 | 791 | 791 | ||
390 | 792 | >>> bar_bin = NascentUpload( | 792 | >>> bar_bin = NascentUpload.from_changesfile_path( |
391 | 793 | ... datadir('suite/bar_1.0-2_binary/bar_1.0-2_i386.changes'), | 793 | ... datadir('suite/bar_1.0-2_binary/bar_1.0-2_i386.changes'), |
392 | 794 | ... security_policy, mock_logger_quiet) | 794 | ... security_policy, mock_logger_quiet) |
393 | 795 | >>> bar_bin.process() | 795 | >>> bar_bin.process() |
394 | @@ -849,7 +849,7 @@ | |||
395 | 849 | >>> modified_sync_policy.can_upload_mixed = True | 849 | >>> modified_sync_policy.can_upload_mixed = True |
396 | 850 | >>> modified_sync_policy.can_upload_binaries = True | 850 | >>> modified_sync_policy.can_upload_binaries = True |
397 | 851 | >>> modified_sync_policy.can_upload_source = True | 851 | >>> modified_sync_policy.can_upload_source = True |
399 | 852 | >>> foo_v1 = NascentUpload( | 852 | >>> foo_v1 = NascentUpload.from_changesfile_path( |
400 | 853 | ... datadir('suite/foo_1.0-1_mixed/foo_1.0-1_i386.changes'), | 853 | ... datadir('suite/foo_1.0-1_mixed/foo_1.0-1_i386.changes'), |
401 | 854 | ... modified_sync_policy, mock_logger_quiet) | 854 | ... modified_sync_policy, mock_logger_quiet) |
402 | 855 | >>> foo_v1.process() | 855 | >>> foo_v1.process() |
403 | @@ -867,7 +867,7 @@ | |||
404 | 867 | >>> security_policy = getPolicy( | 867 | >>> security_policy = getPolicy( |
405 | 868 | ... name='security', distro='ubuntu', distroseries=None) | 868 | ... name='security', distro='ubuntu', distroseries=None) |
406 | 869 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') | 869 | >>> security_policy.setDistroSeriesAndPocket('hoary-security') |
408 | 870 | >>> foo_mixed = NascentUpload( | 870 | >>> foo_mixed = NascentUpload.from_changesfile_path( |
409 | 871 | ... datadir('suite/foo_1.0-2.1/foo_1.0-2.1_source.changes'), | 871 | ... datadir('suite/foo_1.0-2.1/foo_1.0-2.1_source.changes'), |
410 | 872 | ... security_policy, mock_logger_quiet) | 872 | ... security_policy, mock_logger_quiet) |
411 | 873 | >>> foo_mixed.process() | 873 | >>> foo_mixed.process() |
412 | @@ -905,7 +905,7 @@ | |||
413 | 905 | >>> sync_policy = getPolicy( | 905 | >>> sync_policy = getPolicy( |
414 | 906 | ... name='sync', distro='ubuntu', distroseries='hoary') | 906 | ... name='sync', distro='ubuntu', distroseries='hoary') |
415 | 907 | 907 | ||
417 | 908 | >>> bar_src = NascentUpload( | 908 | >>> bar_src = NascentUpload.from_changesfile_path( |
418 | 909 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 909 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
419 | 910 | ... sync_policy, mock_logger_quiet) | 910 | ... sync_policy, mock_logger_quiet) |
420 | 911 | >>> bar_src.process() | 911 | >>> bar_src.process() |
421 | @@ -975,7 +975,7 @@ | |||
422 | 975 | >>> hoary.status = SeriesStatus.DEVELOPMENT | 975 | >>> hoary.status = SeriesStatus.DEVELOPMENT |
423 | 976 | >>> anything_policy = getPolicy( | 976 | >>> anything_policy = getPolicy( |
424 | 977 | ... name='anything', distro='ubuntu', distroseries='hoary') | 977 | ... name='anything', distro='ubuntu', distroseries='hoary') |
426 | 978 | >>> bar_upload = NascentUpload( | 978 | >>> bar_upload = NascentUpload.from_changesfile_path( |
427 | 979 | ... datadir( | 979 | ... datadir( |
428 | 980 | ... 'suite/bar_1.0-10_utf8_changesfile/bar_1.0-10_source.changes'), | 980 | ... 'suite/bar_1.0-10_utf8_changesfile/bar_1.0-10_source.changes'), |
429 | 981 | ... anything_policy, mock_logger_quiet) | 981 | ... anything_policy, mock_logger_quiet) |
430 | @@ -1106,7 +1106,8 @@ | |||
431 | 1106 | 1106 | ||
432 | 1107 | And then try to upload using the changes file with the malformed name. | 1107 | And then try to upload using the changes file with the malformed name. |
433 | 1108 | 1108 | ||
435 | 1109 | >>> bar_src = NascentUpload(copyp, sync_policy, mock_logger_quiet) | 1109 | >>> bar_src = NascentUpload.from_changesfile_path( |
436 | 1110 | ... copyp, sync_policy, mock_logger_quiet) | ||
437 | 1110 | >>> bar_src.process() | 1111 | >>> bar_src.process() |
438 | 1111 | Traceback (most recent call last): | 1112 | Traceback (most recent call last): |
439 | 1112 | ... | 1113 | ... |
440 | 1113 | 1114 | ||
441 | === modified file 'lib/lp/archiveuploader/tests/nascentupload-packageset.txt' | |||
442 | --- lib/lp/archiveuploader/tests/nascentupload-packageset.txt 2010-05-11 14:09:44 +0000 | |||
443 | +++ lib/lp/archiveuploader/tests/nascentupload-packageset.txt 2010-08-04 22:12:18 +0000 | |||
444 | @@ -31,7 +31,7 @@ | |||
445 | 31 | This time the upload will fail because the ACLs don't let | 31 | This time the upload will fail because the ACLs don't let |
446 | 32 | "name16", the key owner, upload a package. | 32 | "name16", the key owner, upload a package. |
447 | 33 | 33 | ||
449 | 34 | >>> bar_failed = NascentUpload( | 34 | >>> bar_failed = NascentUpload.from_changesfile_path( |
450 | 35 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 35 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
451 | 36 | ... insecure_policy, mock_logger_quiet) | 36 | ... insecure_policy, mock_logger_quiet) |
452 | 37 | 37 | ||
453 | @@ -111,7 +111,7 @@ | |||
454 | 111 | 111 | ||
455 | 112 | Let's retry the upload. | 112 | Let's retry the upload. |
456 | 113 | 113 | ||
458 | 114 | >>> bar_failed = NascentUpload( | 114 | >>> bar_failed = NascentUpload.from_changesfile_path( |
459 | 115 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 115 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
460 | 116 | ... insecure_policy, mock_logger_quiet) | 116 | ... insecure_policy, mock_logger_quiet) |
461 | 117 | 117 | ||
462 | @@ -166,7 +166,7 @@ | |||
463 | 166 | 166 | ||
464 | 167 | >>> commit() | 167 | >>> commit() |
465 | 168 | >>> LaunchpadZopelessLayer.switchDbUser('uploader') | 168 | >>> LaunchpadZopelessLayer.switchDbUser('uploader') |
467 | 169 | >>> bar2 = NascentUpload( | 169 | >>> bar2 = NascentUpload.from_changesfile_path( |
468 | 170 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 170 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
469 | 171 | ... insecure_policy, mock_logger_quiet) | 171 | ... insecure_policy, mock_logger_quiet) |
470 | 172 | >>> bar2.process() | 172 | >>> bar2.process() |
471 | 173 | 173 | ||
472 | === modified file 'lib/lp/archiveuploader/tests/nascentupload-security-uploads.txt' | |||
473 | --- lib/lp/archiveuploader/tests/nascentupload-security-uploads.txt 2010-07-24 09:12:37 +0000 | |||
474 | +++ lib/lp/archiveuploader/tests/nascentupload-security-uploads.txt 2010-08-04 22:12:18 +0000 | |||
475 | @@ -55,7 +55,7 @@ | |||
476 | 55 | The upload in question contains a source and its 2 builds for i386 and | 55 | The upload in question contains a source and its 2 builds for i386 and |
477 | 56 | powerpc: | 56 | powerpc: |
478 | 57 | 57 | ||
480 | 58 | >>> foo_mixed_upload = NascentUpload( | 58 | >>> foo_mixed_upload = NascentUpload.from_changesfile_path( |
481 | 59 | ... datadir('suite/foo_1.0-1_multi_binary/foo_1.0-1_multi.changes'), | 59 | ... datadir('suite/foo_1.0-1_multi_binary/foo_1.0-1_multi.changes'), |
482 | 60 | ... security_policy, mock_logger_quiet) | 60 | ... security_policy, mock_logger_quiet) |
483 | 61 | >>> foo_mixed_upload.process() | 61 | >>> foo_mixed_upload.process() |
484 | @@ -121,7 +121,7 @@ | |||
485 | 121 | security upload, for example, detecting that the source and the | 121 | security upload, for example, detecting that the source and the |
486 | 122 | binaries sent do not match. | 122 | binaries sent do not match. |
487 | 123 | 123 | ||
489 | 124 | >>> bar_mixed_upload = NascentUpload( | 124 | >>> bar_mixed_upload = NascentUpload.from_changesfile_path( |
490 | 125 | ... datadir('suite/foo_1.0-1_broken_binary/bar_1.0-1_multi.changes'), | 125 | ... datadir('suite/foo_1.0-1_broken_binary/bar_1.0-1_multi.changes'), |
491 | 126 | ... security_policy, mock_logger_quiet) | 126 | ... security_policy, mock_logger_quiet) |
492 | 127 | >>> bar_mixed_upload.process() | 127 | >>> bar_mixed_upload.process() |
493 | 128 | 128 | ||
494 | === modified file 'lib/lp/archiveuploader/tests/nascentupload.txt' | |||
495 | --- lib/lp/archiveuploader/tests/nascentupload.txt 2010-07-24 09:12:37 +0000 | |||
496 | +++ lib/lp/archiveuploader/tests/nascentupload.txt 2010-08-04 22:12:18 +0000 | |||
497 | @@ -45,14 +45,15 @@ | |||
498 | 45 | doc/nascentuploadfile.txt) object based on that. If anything goes | 45 | doc/nascentuploadfile.txt) object based on that. If anything goes |
499 | 46 | wrong during this process FatalUploadError is raised: | 46 | wrong during this process FatalUploadError is raised: |
500 | 47 | 47 | ||
502 | 48 | >>> NascentUpload(datadir("DOES-NOT-EXIST"), buildd_policy, mock_logger) | 48 | >>> NascentUpload.from_changesfile_path( |
503 | 49 | ... datadir("DOES-NOT-EXIST"), buildd_policy, mock_logger) | ||
504 | 49 | Traceback (most recent call last): | 50 | Traceback (most recent call last): |
505 | 50 | ... | 51 | ... |
506 | 51 | FatalUploadError:... | 52 | FatalUploadError:... |
507 | 52 | 53 | ||
508 | 53 | Otherwise a ChangesFile object is ready to use. | 54 | Otherwise a ChangesFile object is ready to use. |
509 | 54 | 55 | ||
511 | 55 | >>> quodlibet = NascentUpload( | 56 | >>> quodlibet = NascentUpload.from_changesfile_path( |
512 | 56 | ... datadir("quodlibet_0.13.1-1_i386.changes"), | 57 | ... datadir("quodlibet_0.13.1-1_i386.changes"), |
513 | 57 | ... anything_policy, mock_logger_quiet) | 58 | ... anything_policy, mock_logger_quiet) |
514 | 58 | 59 | ||
515 | @@ -110,7 +111,7 @@ | |||
516 | 110 | is 'native' (only a TARBALL, no diff + orig) or 'has_orig' (uses ORIG | 111 | is 'native' (only a TARBALL, no diff + orig) or 'has_orig' (uses ORIG |
517 | 111 | + DIFF source form). | 112 | + DIFF source form). |
518 | 112 | 113 | ||
520 | 113 | >>> ed_source_upload = NascentUpload( | 114 | >>> ed_source_upload = NascentUpload.from_changesfile_path( |
521 | 114 | ... datadir("ed_0.2-20_i386.changes.source-only-unsigned"), | 115 | ... datadir("ed_0.2-20_i386.changes.source-only-unsigned"), |
522 | 115 | ... sync_policy, mock_logger_quiet) | 116 | ... sync_policy, mock_logger_quiet) |
523 | 116 | 117 | ||
524 | @@ -167,7 +168,7 @@ | |||
525 | 167 | 168 | ||
526 | 168 | Let's try a simple binary upload: | 169 | Let's try a simple binary upload: |
527 | 169 | 170 | ||
529 | 170 | >>> ed_binary_upload = NascentUpload( | 171 | >>> ed_binary_upload = NascentUpload.from_changesfile_path( |
530 | 171 | ... datadir("ed_0.2-20_i386.changes.binary-only-unsigned"), | 172 | ... datadir("ed_0.2-20_i386.changes.binary-only-unsigned"), |
531 | 172 | ... buildd_policy, mock_logger_quiet) | 173 | ... buildd_policy, mock_logger_quiet) |
532 | 173 | 174 | ||
533 | @@ -220,7 +221,7 @@ | |||
534 | 220 | >>> modified_buildd_policy.can_upload_source = True | 221 | >>> modified_buildd_policy.can_upload_source = True |
535 | 221 | >>> modified_buildd_policy.can_upload_mixed = True | 222 | >>> modified_buildd_policy.can_upload_mixed = True |
536 | 222 | 223 | ||
538 | 223 | >>> ed_mismatched_upload = NascentUpload( | 224 | >>> ed_mismatched_upload = NascentUpload.from_changesfile_path( |
539 | 224 | ... datadir("ed_0.2-20_i386.changes.mismatched-arch-unsigned"), | 225 | ... datadir("ed_0.2-20_i386.changes.mismatched-arch-unsigned"), |
540 | 225 | ... modified_buildd_policy, mock_logger_quiet) | 226 | ... modified_buildd_policy, mock_logger_quiet) |
541 | 226 | 227 | ||
542 | @@ -258,7 +259,7 @@ | |||
543 | 258 | >>> modified_insecure_policy.can_upload_binaries = True | 259 | >>> modified_insecure_policy.can_upload_binaries = True |
544 | 259 | >>> modified_insecure_policy.can_upload_mixed = True | 260 | >>> modified_insecure_policy.can_upload_mixed = True |
545 | 260 | 261 | ||
547 | 261 | >>> ed_mixed_upload = NascentUpload( | 262 | >>> ed_mixed_upload = NascentUpload.from_changesfile_path( |
548 | 262 | ... datadir("ed_0.2-20_i386.changes"), | 263 | ... datadir("ed_0.2-20_i386.changes"), |
549 | 263 | ... modified_insecure_policy, mock_logger_quiet) | 264 | ... modified_insecure_policy, mock_logger_quiet) |
550 | 264 | 265 | ||
551 | @@ -317,7 +318,7 @@ | |||
552 | 317 | 318 | ||
553 | 318 | First up, construct an upload of just the ed source... | 319 | First up, construct an upload of just the ed source... |
554 | 319 | 320 | ||
556 | 320 | >>> ed_src = NascentUpload( | 321 | >>> ed_src = NascentUpload.from_changesfile_path( |
557 | 321 | ... datadir('split-upload-test/ed_0.2-20_source.changes'), | 322 | ... datadir('split-upload-test/ed_0.2-20_source.changes'), |
558 | 322 | ... sync_policy, mock_logger_quiet) | 323 | ... sync_policy, mock_logger_quiet) |
559 | 323 | >>> ed_src.process() | 324 | >>> ed_src.process() |
560 | @@ -407,7 +408,7 @@ | |||
561 | 407 | maintainer's side), however it cannot store a proper | 408 | maintainer's side), however it cannot store a proper |
562 | 408 | SourcePackageRelease.copyright content. See bug #134567. | 409 | SourcePackageRelease.copyright content. See bug #134567. |
563 | 409 | 410 | ||
565 | 410 | >>> nocopyright_src = NascentUpload( | 411 | >>> nocopyright_src = NascentUpload.from_changesfile_path( |
566 | 411 | ... datadir('suite/nocopyright_1.0-1/nocopyright_1.0-1_source.changes'), | 412 | ... datadir('suite/nocopyright_1.0-1/nocopyright_1.0-1_source.changes'), |
567 | 412 | ... sync_policy, mock_logger_quiet) | 413 | ... sync_policy, mock_logger_quiet) |
568 | 413 | >>> nocopyright_src.process() | 414 | >>> nocopyright_src.process() |
569 | @@ -451,7 +452,7 @@ | |||
570 | 451 | published in the archive, which provides the same source package name | 452 | published in the archive, which provides the same source package name |
571 | 452 | and source package version for the distroseries in question. | 453 | and source package version for the distroseries in question. |
572 | 453 | 454 | ||
574 | 454 | >>> ed_src_dup = NascentUpload( | 455 | >>> ed_src_dup = NascentUpload.from_changesfile_path( |
575 | 455 | ... datadir('split-upload-test/ed_0.2-20_source.changes'), | 456 | ... datadir('split-upload-test/ed_0.2-20_source.changes'), |
576 | 456 | ... sync_policy, mock_logger_quiet) | 457 | ... sync_policy, mock_logger_quiet) |
577 | 457 | >>> ed_src_dup.process() | 458 | >>> ed_src_dup.process() |
578 | @@ -519,7 +520,7 @@ | |||
579 | 519 | ... name='sync', distro='ubuntu', distroseries='hoary') | 520 | ... name='sync', distro='ubuntu', distroseries='hoary') |
580 | 520 | >>> modified_sync_policy.can_upload_binaries = True | 521 | >>> modified_sync_policy.can_upload_binaries = True |
581 | 521 | 522 | ||
583 | 522 | >>> ed_bin = NascentUpload( | 523 | >>> ed_bin = NascentUpload.from_changesfile_path( |
584 | 523 | ... datadir('split-upload-test/ed_0.2-20_i386.changes'), | 524 | ... datadir('split-upload-test/ed_0.2-20_i386.changes'), |
585 | 524 | ... modified_sync_policy, mock_logger_quiet) | 525 | ... modified_sync_policy, mock_logger_quiet) |
586 | 525 | 526 | ||
587 | @@ -606,7 +607,7 @@ | |||
588 | 606 | 607 | ||
589 | 607 | Upload new source 'multibar', step 1: | 608 | Upload new source 'multibar', step 1: |
590 | 608 | 609 | ||
592 | 609 | >>> multibar_src_upload = NascentUpload( | 610 | >>> multibar_src_upload = NascentUpload.from_changesfile_path( |
593 | 610 | ... datadir('suite/multibar_1.0-1/multibar_1.0-1_source.changes'), | 611 | ... datadir('suite/multibar_1.0-1/multibar_1.0-1_source.changes'), |
594 | 611 | ... sync_policy, mock_logger_quiet) | 612 | ... sync_policy, mock_logger_quiet) |
595 | 612 | >>> multibar_src_upload.process() | 613 | >>> multibar_src_upload.process() |
596 | @@ -658,7 +659,7 @@ | |||
597 | 658 | ... name='buildd', distro='ubuntu', distroseries='hoary', | 659 | ... name='buildd', distro='ubuntu', distroseries='hoary', |
598 | 659 | ... buildid=multibar_build.id) | 660 | ... buildid=multibar_build.id) |
599 | 660 | 661 | ||
601 | 661 | >>> multibar_bin_upload = NascentUpload( | 662 | >>> multibar_bin_upload = NascentUpload.from_changesfile_path( |
602 | 662 | ... datadir('suite/multibar_1.0-1/multibar_1.0-1_i386.changes'), | 663 | ... datadir('suite/multibar_1.0-1/multibar_1.0-1_i386.changes'), |
603 | 663 | ... buildd_policy, mock_logger_quiet) | 664 | ... buildd_policy, mock_logger_quiet) |
604 | 664 | >>> multibar_bin_upload.process() | 665 | >>> multibar_bin_upload.process() |
605 | @@ -727,7 +728,7 @@ | |||
606 | 727 | >>> norelease_sync_policy = getPolicy( | 728 | >>> norelease_sync_policy = getPolicy( |
607 | 728 | ... name='sync', distro='ubuntu') | 729 | ... name='sync', distro='ubuntu') |
608 | 729 | 730 | ||
610 | 730 | >>> ed_src = NascentUpload( | 731 | >>> ed_src = NascentUpload.from_changesfile_path( |
611 | 731 | ... datadir('updates-upload-test/ed_0.2-20_source.changes'), | 732 | ... datadir('updates-upload-test/ed_0.2-20_source.changes'), |
612 | 732 | ... norelease_sync_policy, mock_logger_quiet) | 733 | ... norelease_sync_policy, mock_logger_quiet) |
613 | 733 | >>> ed_src.process() | 734 | >>> ed_src.process() |
614 | @@ -756,7 +757,7 @@ | |||
615 | 756 | Check the uploader behaviour against a missing orig.tar.gz file, | 757 | Check the uploader behaviour against a missing orig.tar.gz file, |
616 | 757 | bug # 30741. | 758 | bug # 30741. |
617 | 758 | 759 | ||
619 | 759 | >>> ed21_src = NascentUpload( | 760 | >>> ed21_src = NascentUpload.from_changesfile_path( |
620 | 760 | ... datadir('ed-0.2-21/ed_0.2-21_source.changes'), | 761 | ... datadir('ed-0.2-21/ed_0.2-21_source.changes'), |
621 | 761 | ... sync_policy, mock_logger_quiet) | 762 | ... sync_policy, mock_logger_quiet) |
622 | 762 | >>> ed21_src.process() | 763 | >>> ed21_src.process() |
623 | @@ -774,7 +775,7 @@ | |||
624 | 774 | 'Standards-Version' field in DSC. See bug #75874 for further | 775 | 'Standards-Version' field in DSC. See bug #75874 for further |
625 | 775 | information. | 776 | information. |
626 | 776 | 777 | ||
628 | 777 | >>> inst_src = NascentUpload( | 778 | >>> inst_src = NascentUpload.from_changesfile_path( |
629 | 778 | ... datadir('test75874_0.1_source.changes'), | 779 | ... datadir('test75874_0.1_source.changes'), |
630 | 779 | ... sync_policy, mock_logger_quiet) | 780 | ... sync_policy, mock_logger_quiet) |
631 | 780 | >>> inst_src.process() | 781 | >>> inst_src.process() |
632 | @@ -822,7 +823,7 @@ | |||
633 | 822 | When using 'insecure' policy, NascentUpload instace stores the DSC | 823 | When using 'insecure' policy, NascentUpload instace stores the DSC |
634 | 823 | sigining key reference as an IGPGKey: | 824 | sigining key reference as an IGPGKey: |
635 | 824 | 825 | ||
637 | 825 | >>> bar_ok = NascentUpload( | 826 | >>> bar_ok = NascentUpload.from_changesfile_path( |
638 | 826 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 827 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
639 | 827 | ... insecure_policy, mock_logger_quiet) | 828 | ... insecure_policy, mock_logger_quiet) |
640 | 828 | >>> bar_ok.process() | 829 | >>> bar_ok.process() |
641 | @@ -871,7 +872,7 @@ | |||
642 | 871 | This time the upload will fail because the ACLs don't let | 872 | This time the upload will fail because the ACLs don't let |
643 | 872 | "name16", the key owner, upload a package. | 873 | "name16", the key owner, upload a package. |
644 | 873 | 874 | ||
646 | 874 | >>> bar_failed = NascentUpload( | 875 | >>> bar_failed = NascentUpload.from_changesfile_path( |
647 | 875 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 876 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
648 | 876 | ... insecure_policy, mock_logger_quiet) | 877 | ... insecure_policy, mock_logger_quiet) |
649 | 877 | 878 | ||
650 | @@ -917,7 +918,7 @@ | |||
651 | 917 | 918 | ||
652 | 918 | Now try the "bar" upload: | 919 | Now try the "bar" upload: |
653 | 919 | 920 | ||
655 | 920 | >>> bar2 = NascentUpload( | 921 | >>> bar2 = NascentUpload.from_changesfile_path( |
656 | 921 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 922 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
657 | 922 | ... insecure_policy, mock_logger_quiet) | 923 | ... insecure_policy, mock_logger_quiet) |
658 | 923 | >>> bar2.process() | 924 | >>> bar2.process() |
659 | @@ -943,7 +944,7 @@ | |||
660 | 943 | Make this upload policy pertain to the copy archive. | 944 | Make this upload policy pertain to the copy archive. |
661 | 944 | 945 | ||
662 | 945 | >>> copy_archive_policy.archive = copy_archive | 946 | >>> copy_archive_policy.archive = copy_archive |
664 | 946 | >>> quodlibet = NascentUpload( | 947 | >>> quodlibet = NascentUpload.from_changesfile_path( |
665 | 947 | ... datadir("quodlibet_0.13.1-1_i386.changes"), | 948 | ... datadir("quodlibet_0.13.1-1_i386.changes"), |
666 | 948 | ... copy_archive_policy, mock_logger_quiet) | 949 | ... copy_archive_policy, mock_logger_quiet) |
667 | 949 | 950 | ||
668 | 950 | 951 | ||
669 | === added file 'lib/lp/archiveuploader/tests/test_nascentupload.py' | |||
670 | --- lib/lp/archiveuploader/tests/test_nascentupload.py 1970-01-01 00:00:00 +0000 | |||
671 | +++ lib/lp/archiveuploader/tests/test_nascentupload.py 2010-08-04 22:12:18 +0000 | |||
672 | @@ -0,0 +1,85 @@ | |||
673 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
674 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
675 | 3 | |||
676 | 4 | """Test NascentUpload functionality.""" | ||
677 | 5 | |||
678 | 6 | __metaclass__ = type | ||
679 | 7 | |||
680 | 8 | from testtools import TestCase | ||
681 | 9 | |||
682 | 10 | from canonical.testing import LaunchpadZopelessLayer | ||
683 | 11 | from lp.archiveuploader.changesfile import determine_file_class_and_name | ||
684 | 12 | from lp.archiveuploader.nascentupload import NascentUpload | ||
685 | 13 | from lp.archiveuploader.tests import mock_logger | ||
686 | 14 | |||
687 | 15 | |||
688 | 16 | class FakeChangesFile: | ||
689 | 17 | |||
690 | 18 | def __init__(self): | ||
691 | 19 | self.files = [] | ||
692 | 20 | |||
693 | 21 | |||
694 | 22 | class TestMatchDDEBs(TestCase): | ||
695 | 23 | """Tests that NascentUpload correctly links DEBs to their DDEBs. | ||
696 | 24 | |||
697 | 25 | Also verifies detection of DDEB-related error cases. | ||
698 | 26 | """ | ||
699 | 27 | |||
700 | 28 | layer = LaunchpadZopelessLayer | ||
701 | 29 | |||
702 | 30 | def setUp(self): | ||
703 | 31 | super(TestMatchDDEBs, self).setUp() | ||
704 | 32 | self.changes = FakeChangesFile() | ||
705 | 33 | self.upload = NascentUpload(self.changes, None, mock_logger) | ||
706 | 34 | |||
707 | 35 | def addFile(self, filename): | ||
708 | 36 | """Add a file of the right type to the upload.""" | ||
709 | 37 | package, cls = determine_file_class_and_name(filename) | ||
710 | 38 | file = cls( | ||
711 | 39 | filename, None, 100, 'devel', 'extra', package, '666', | ||
712 | 40 | self.changes, None, self.upload.logger) | ||
713 | 41 | self.changes.files.append(file) | ||
714 | 42 | |||
715 | 43 | def assertMatchDDEBErrors(self, error_list): | ||
716 | 44 | self.assertEquals( | ||
717 | 45 | error_list, [str(e) for e in self.upload._matchDDEBs()]) | ||
718 | 46 | |||
719 | 47 | def testNoLinksWithNoBinaries(self): | ||
720 | 48 | # No links will be made if there are no binaries whatsoever. | ||
721 | 49 | self.addFile('something_1.0.diff.gz') | ||
722 | 50 | self.assertMatchDDEBErrors([]) | ||
723 | 51 | |||
724 | 52 | def testNoLinksWithJustDEBs(self): | ||
725 | 53 | # No links will be made if there are no DDEBs. | ||
726 | 54 | self.addFile('blah_1.0_all.deb') | ||
727 | 55 | self.addFile('libblah_1.0_i386.deb') | ||
728 | 56 | self.assertMatchDDEBErrors([]) | ||
729 | 57 | for file in self.changes.files: | ||
730 | 58 | self.assertIs(None, file.ddeb_file) | ||
731 | 59 | |||
732 | 60 | def testLinksMatchingDDEBs(self): | ||
733 | 61 | # DDEBs will be linked to their matching DEBs. | ||
734 | 62 | self.addFile('blah_1.0_all.deb') | ||
735 | 63 | self.addFile('libblah_1.0_i386.deb') | ||
736 | 64 | self.addFile('libblah-dbgsym_1.0_i386.ddeb') | ||
737 | 65 | self.assertMatchDDEBErrors([]) | ||
738 | 66 | self.assertIs(None, self.changes.files[0].ddeb_file) | ||
739 | 67 | self.assertIs(self.changes.files[2], self.changes.files[1].ddeb_file) | ||
740 | 68 | self.assertIs(self.changes.files[1], self.changes.files[2].deb_file) | ||
741 | 69 | self.assertIs(None, self.changes.files[2].ddeb_file) | ||
742 | 70 | |||
743 | 71 | def testDuplicateDDEBsCauseErrors(self): | ||
744 | 72 | # An error will be raised if a DEB has more than one matching | ||
745 | 73 | # DDEB. | ||
746 | 74 | self.addFile('libblah_1.0_i386.deb') | ||
747 | 75 | self.addFile('libblah-dbgsym_1.0_i386.ddeb') | ||
748 | 76 | self.addFile('libblah-dbgsym_1.0_i386.ddeb') | ||
749 | 77 | self.assertMatchDDEBErrors( | ||
750 | 78 | ['Duplicated debug packages: libblah-dbgsym 666 (i386)']) | ||
751 | 79 | |||
752 | 80 | def testMismatchedDDEBsCauseErrors(self): | ||
753 | 81 | # An error will be raised if a DDEB has no matching DEB. | ||
754 | 82 | self.addFile('libblah_1.0_i386.deb') | ||
755 | 83 | self.addFile('libblah-dbgsym_1.0_amd64.ddeb') | ||
756 | 84 | self.assertMatchDDEBErrors( | ||
757 | 85 | ['Orphaned debug packages: libblah-dbgsym 666 (amd64)']) | ||
758 | 0 | 86 | ||
759 | === modified file 'lib/lp/archiveuploader/tests/test_nascentupload_documentation.py' | |||
760 | --- lib/lp/archiveuploader/tests/test_nascentupload_documentation.py 2009-06-24 23:33:29 +0000 | |||
761 | +++ lib/lp/archiveuploader/tests/test_nascentupload_documentation.py 2010-08-04 22:12:18 +0000 | |||
762 | @@ -26,20 +26,25 @@ | |||
763 | 26 | def getUploadForSource(upload_path): | 26 | def getUploadForSource(upload_path): |
764 | 27 | """Return a NascentUpload object for a source.""" | 27 | """Return a NascentUpload object for a source.""" |
765 | 28 | policy = getPolicy(name='sync', distro='ubuntu', distroseries='hoary') | 28 | policy = getPolicy(name='sync', distro='ubuntu', distroseries='hoary') |
767 | 29 | return NascentUpload(datadir(upload_path), policy, mock_logger_quiet) | 29 | return NascentUpload.from_changesfile_path( |
768 | 30 | datadir(upload_path), policy, mock_logger_quiet) | ||
769 | 31 | |||
770 | 30 | 32 | ||
771 | 31 | def getPPAUploadForSource(upload_path, ppa): | 33 | def getPPAUploadForSource(upload_path, ppa): |
772 | 32 | """Return a NascentUpload object for a PPA source.""" | 34 | """Return a NascentUpload object for a PPA source.""" |
773 | 33 | policy = getPolicy(name='insecure', distro='ubuntu', distroseries='hoary') | 35 | policy = getPolicy(name='insecure', distro='ubuntu', distroseries='hoary') |
774 | 34 | policy.archive = ppa | 36 | policy.archive = ppa |
776 | 35 | return NascentUpload(datadir(upload_path), policy, mock_logger_quiet) | 37 | return NascentUpload.from_changesfile_path( |
777 | 38 | datadir(upload_path), policy, mock_logger_quiet) | ||
778 | 39 | |||
779 | 36 | 40 | ||
780 | 37 | def getUploadForBinary(upload_path): | 41 | def getUploadForBinary(upload_path): |
781 | 38 | """Return a NascentUpload object for binaries.""" | 42 | """Return a NascentUpload object for binaries.""" |
782 | 39 | policy = getPolicy(name='sync', distro='ubuntu', distroseries='hoary') | 43 | policy = getPolicy(name='sync', distro='ubuntu', distroseries='hoary') |
783 | 40 | policy.can_upload_binaries = True | 44 | policy.can_upload_binaries = True |
784 | 41 | policy.can_upload_mixed = True | 45 | policy.can_upload_mixed = True |
786 | 42 | return NascentUpload(datadir(upload_path), policy, mock_logger_quiet) | 46 | return NascentUpload.from_changesfile_path( |
787 | 47 | datadir(upload_path), policy, mock_logger_quiet) | ||
788 | 43 | 48 | ||
789 | 44 | 49 | ||
790 | 45 | def testGlobalsSetup(test): | 50 | def testGlobalsSetup(test): |
791 | 46 | 51 | ||
792 | === modified file 'lib/lp/archiveuploader/uploadprocessor.py' | |||
793 | --- lib/lp/archiveuploader/uploadprocessor.py 2010-08-02 09:40:22 +0000 | |||
794 | +++ lib/lp/archiveuploader/uploadprocessor.py 2010-08-04 22:12:18 +0000 | |||
795 | @@ -335,7 +335,8 @@ | |||
796 | 335 | # The path we want for NascentUpload is the path to the folder | 335 | # The path we want for NascentUpload is the path to the folder |
797 | 336 | # containing the changes file (and the other files referenced by it). | 336 | # containing the changes file (and the other files referenced by it). |
798 | 337 | changesfile_path = os.path.join(upload_path, changes_file) | 337 | changesfile_path = os.path.join(upload_path, changes_file) |
800 | 338 | upload = NascentUpload(changesfile_path, policy, self.log) | 338 | upload = NascentUpload.from_changesfile_path( |
801 | 339 | changesfile_path, policy, self.log) | ||
802 | 339 | 340 | ||
803 | 340 | # Reject source upload to buildd upload paths. | 341 | # Reject source upload to buildd upload paths. |
804 | 341 | first_path = relative_path.split(os.path.sep)[0] | 342 | first_path = relative_path.split(os.path.sep)[0] |
805 | 342 | 343 | ||
806 | === modified file 'lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt' | |||
807 | --- lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2009-06-12 16:36:02 +0000 | |||
808 | +++ lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2010-08-04 22:12:18 +0000 | |||
809 | @@ -260,7 +260,7 @@ | |||
810 | 260 | ... distroseries='hoary') | 260 | ... distroseries='hoary') |
811 | 261 | >>> sync_policy.can_upload_binaries = True | 261 | >>> sync_policy.can_upload_binaries = True |
812 | 262 | >>> sync_policy.can_upload_mixed = True | 262 | >>> sync_policy.can_upload_mixed = True |
814 | 263 | >>> foo_upload = NascentUpload( | 263 | >>> foo_upload = NascentUpload.from_changesfile_path( |
815 | 264 | ... datadir('suite/foo_1.0-2_multi_binary/foo_1.0-2_i386.changes'), | 264 | ... datadir('suite/foo_1.0-2_multi_binary/foo_1.0-2_i386.changes'), |
816 | 265 | ... sync_policy, mock_logger_quiet) | 265 | ... sync_policy, mock_logger_quiet) |
817 | 266 | >>> foo_upload.process() | 266 | >>> foo_upload.process() |
818 | 267 | 267 | ||
819 | === modified file 'lib/lp/soyuz/doc/build-failedtoupload-workflow.txt' | |||
820 | --- lib/lp/soyuz/doc/build-failedtoupload-workflow.txt 2010-05-12 08:17:20 +0000 | |||
821 | +++ lib/lp/soyuz/doc/build-failedtoupload-workflow.txt 2010-08-04 22:12:18 +0000 | |||
822 | @@ -165,7 +165,7 @@ | |||
823 | 165 | ... distroseries=failedtoupload_candidate.distro_series.name, | 165 | ... distroseries=failedtoupload_candidate.distro_series.name, |
824 | 166 | ... buildid=failedtoupload_candidate.id) | 166 | ... buildid=failedtoupload_candidate.id) |
825 | 167 | 167 | ||
827 | 168 | >>> cdrkit_bin_upload = NascentUpload( | 168 | >>> cdrkit_bin_upload = NascentUpload.from_changesfile_path( |
828 | 169 | ... datadir('suite/cdrkit_1.0/cdrkit_1.0_i386.changes'), | 169 | ... datadir('suite/cdrkit_1.0/cdrkit_1.0_i386.changes'), |
829 | 170 | ... buildd_policy, mock_logger_quiet) | 170 | ... buildd_policy, mock_logger_quiet) |
830 | 171 | >>> cdrkit_bin_upload.process() | 171 | >>> cdrkit_bin_upload.process() |
831 | 172 | 172 | ||
832 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt' | |||
833 | --- lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt 2009-05-13 14:05:27 +0000 | |||
834 | +++ lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt 2010-08-04 22:12:18 +0000 | |||
835 | @@ -47,7 +47,7 @@ | |||
836 | 47 | >>> sync_policy = getPolicy( | 47 | >>> sync_policy = getPolicy( |
837 | 48 | ... name='sync', distro='ubuntutest', distroseries=None) | 48 | ... name='sync', distro='ubuntutest', distroseries=None) |
838 | 49 | 49 | ||
840 | 50 | >>> upload = NascentUpload( | 50 | >>> upload = NascentUpload.from_changesfile_path( |
841 | 51 | ... datadir('ddtp-tarball/translations-main_20060728.changes'), | 51 | ... datadir('ddtp-tarball/translations-main_20060728.changes'), |
842 | 52 | ... sync_policy, mock_logger_quiet) | 52 | ... sync_policy, mock_logger_quiet) |
843 | 53 | >>> upload.process() | 53 | >>> upload.process() |
844 | @@ -60,7 +60,7 @@ | |||
845 | 60 | >>> insecure_policy = getPolicy( | 60 | >>> insecure_policy = getPolicy( |
846 | 61 | ... name='insecure', distro='ubuntutest', distroseries=None) | 61 | ... name='insecure', distro='ubuntutest', distroseries=None) |
847 | 62 | 62 | ||
849 | 63 | >>> upload = NascentUpload( | 63 | >>> upload = NascentUpload.from_changesfile_path( |
850 | 64 | ... datadir('ddtp-tarball/translations-main_20060728_all.changes'), | 64 | ... datadir('ddtp-tarball/translations-main_20060728_all.changes'), |
851 | 65 | ... insecure_policy, mock_logger) | 65 | ... insecure_policy, mock_logger) |
852 | 66 | DEBUG: Verifying signature on translations-main_20060728_all.changes | 66 | DEBUG: Verifying signature on translations-main_20060728_all.changes |
853 | @@ -228,7 +228,7 @@ | |||
854 | 228 | >>> insecure_policy = getPolicy( | 228 | >>> insecure_policy = getPolicy( |
855 | 229 | ... name='insecure', distro='ubuntutest', distroseries=None) | 229 | ... name='insecure', distro='ubuntutest', distroseries=None) |
856 | 230 | 230 | ||
858 | 231 | >>> upload = NascentUpload( | 231 | >>> upload = NascentUpload.from_changesfile_path( |
859 | 232 | ... datadir('ddtp-tarball/translations-main_20060817_all.changes'), | 232 | ... datadir('ddtp-tarball/translations-main_20060817_all.changes'), |
860 | 233 | ... insecure_policy, mock_logger_quiet) | 233 | ... insecure_policy, mock_logger_quiet) |
861 | 234 | >>> upload.process() | 234 | >>> upload.process() |
862 | 235 | 235 | ||
863 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue-debian-installer.txt' | |||
864 | --- lib/lp/soyuz/doc/distroseriesqueue-debian-installer.txt 2009-05-13 14:05:27 +0000 | |||
865 | +++ lib/lp/soyuz/doc/distroseriesqueue-debian-installer.txt 2010-08-04 22:12:18 +0000 | |||
866 | @@ -57,7 +57,7 @@ | |||
867 | 57 | 57 | ||
868 | 58 | >>> anything_policy.distroseries.changeslist = 'announce@example.com' | 58 | >>> anything_policy.distroseries.changeslist = 'announce@example.com' |
869 | 59 | 59 | ||
871 | 60 | >>> upload = NascentUpload( | 60 | >>> upload = NascentUpload.from_changesfile_path( |
872 | 61 | ... datadir( | 61 | ... datadir( |
873 | 62 | ... 'debian-installer/debian-installer_20070214ubuntu1_i386.changes'), | 62 | ... 'debian-installer/debian-installer_20070214ubuntu1_i386.changes'), |
874 | 63 | ... anything_policy, mock_logger_quiet) | 63 | ... anything_policy, mock_logger_quiet) |
875 | 64 | 64 | ||
876 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt' | |||
877 | --- lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt 2010-08-03 22:03:56 +0000 | |||
878 | +++ lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt 2010-08-04 22:12:18 +0000 | |||
879 | @@ -23,7 +23,7 @@ | |||
880 | 23 | >>> sync_policy = getPolicy( | 23 | >>> sync_policy = getPolicy( |
881 | 24 | ... name='sync', distro='ubuntutest', distroseries=None) | 24 | ... name='sync', distro='ubuntutest', distroseries=None) |
882 | 25 | 25 | ||
884 | 26 | >>> upload = NascentUpload( | 26 | >>> upload = NascentUpload.from_changesfile_path( |
885 | 27 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120.changes'), | 27 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120.changes'), |
886 | 28 | ... sync_policy, mock_logger) | 28 | ... sync_policy, mock_logger) |
887 | 29 | DEBUG: Changes file can be unsigned. | 29 | DEBUG: Changes file can be unsigned. |
888 | @@ -37,7 +37,7 @@ | |||
889 | 37 | >>> insecure_policy = getPolicy( | 37 | >>> insecure_policy = getPolicy( |
890 | 38 | ... name='insecure', distro='ubuntutest', distroseries=None) | 38 | ... name='insecure', distro='ubuntutest', distroseries=None) |
891 | 39 | 39 | ||
893 | 40 | >>> upload = NascentUpload( | 40 | >>> upload = NascentUpload.from_changesfile_path( |
894 | 41 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120_all.changes'), | 41 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120_all.changes'), |
895 | 42 | ... insecure_policy, mock_logger) | 42 | ... insecure_policy, mock_logger) |
896 | 43 | DEBUG: Verifying signature on dist-upgrader_20060302.0120_all.changes | 43 | DEBUG: Verifying signature on dist-upgrader_20060302.0120_all.changes |
897 | @@ -214,7 +214,7 @@ | |||
898 | 214 | >>> insecure_policy = getPolicy( | 214 | >>> insecure_policy = getPolicy( |
899 | 215 | ... name='insecure', distro='ubuntutest', distroseries=None) | 215 | ... name='insecure', distro='ubuntutest', distroseries=None) |
900 | 216 | 216 | ||
902 | 217 | >>> upload = NascentUpload( | 217 | >>> upload = NascentUpload.from_changesfile_path( |
903 | 218 | ... datadir('dist-upgrader/dist-upgrader_20070219.1234_all.changes'), | 218 | ... datadir('dist-upgrader/dist-upgrader_20070219.1234_all.changes'), |
904 | 219 | ... insecure_policy, mock_logger) | 219 | ... insecure_policy, mock_logger) |
905 | 220 | DEBUG: Verifying signature on dist-upgrader_20070219.1234_all.changes | 220 | DEBUG: Verifying signature on dist-upgrader_20070219.1234_all.changes |
906 | @@ -287,7 +287,7 @@ | |||
907 | 287 | 287 | ||
908 | 288 | >>> insecure_policy.archive = foobar_archive | 288 | >>> insecure_policy.archive = foobar_archive |
909 | 289 | 289 | ||
911 | 290 | >>> ppa_upload = NascentUpload( | 290 | >>> ppa_upload = NascentUpload.from_changesfile_path( |
912 | 291 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120_all.changes'), | 291 | ... datadir('dist-upgrader/dist-upgrader_20060302.0120_all.changes'), |
913 | 292 | ... insecure_policy, mock_logger) | 292 | ... insecure_policy, mock_logger) |
914 | 293 | DEBUG: Verifying signature on dist-upgrader_20060302.0120_all.changes | 293 | DEBUG: Verifying signature on dist-upgrader_20060302.0120_all.changes |
915 | 294 | 294 | ||
916 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue-translations.txt' | |||
917 | --- lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2010-05-14 04:47:38 +0000 | |||
918 | +++ lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2010-08-04 22:12:18 +0000 | |||
919 | @@ -77,7 +77,7 @@ | |||
920 | 77 | ... name='buildd', distro='ubuntu', distroseries='dapper', | 77 | ... name='buildd', distro='ubuntu', distroseries='dapper', |
921 | 78 | ... buildid=build.id) | 78 | ... buildid=build.id) |
922 | 79 | 79 | ||
924 | 80 | >>> pmount_upload = NascentUpload( | 80 | >>> pmount_upload = NascentUpload.from_changesfile_path( |
925 | 81 | ... datadir('pmount_0.9.7-2ubuntu2_amd64.changes'), | 81 | ... datadir('pmount_0.9.7-2ubuntu2_amd64.changes'), |
926 | 82 | ... buildd_policy, mock_logger) | 82 | ... buildd_policy, mock_logger) |
927 | 83 | DEBUG: Changes file can be unsigned. | 83 | DEBUG: Changes file can be unsigned. |
928 | 84 | 84 | ||
929 | === modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt' | |||
930 | --- lib/lp/soyuz/doc/distroseriesqueue.txt 2010-05-14 04:51:42 +0000 | |||
931 | +++ lib/lp/soyuz/doc/distroseriesqueue.txt 2010-08-04 22:12:18 +0000 | |||
932 | @@ -69,7 +69,7 @@ | |||
933 | 69 | >>> anything_policy.can_upload_binaries = True | 69 | >>> anything_policy.can_upload_binaries = True |
934 | 70 | >>> anything_policy.can_upload_mixed = True | 70 | >>> anything_policy.can_upload_mixed = True |
935 | 71 | 71 | ||
937 | 72 | >>> ed_upload = NascentUpload( | 72 | >>> ed_upload = NascentUpload.from_changesfile_path( |
938 | 73 | ... datadir('ed_0.2-20_i386.changes'), | 73 | ... datadir('ed_0.2-20_i386.changes'), |
939 | 74 | ... anything_policy, mock_logger_quiet) | 74 | ... anything_policy, mock_logger_quiet) |
940 | 75 | 75 | ||
941 | @@ -263,7 +263,7 @@ | |||
942 | 263 | >>> insecure_policy = getPolicy( | 263 | >>> insecure_policy = getPolicy( |
943 | 264 | ... name='insecure', distro='ubuntu', distroseries='hoary') | 264 | ... name='insecure', distro='ubuntu', distroseries='hoary') |
944 | 265 | 265 | ||
946 | 266 | >>> bar_ok = NascentUpload( | 266 | >>> bar_ok = NascentUpload.from_changesfile_path( |
947 | 267 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), | 267 | ... datadir('suite/bar_1.0-1/bar_1.0-1_source.changes'), |
948 | 268 | ... insecure_policy, mock_logger_quiet) | 268 | ... insecure_policy, mock_logger_quiet) |
949 | 269 | >>> bar_ok.process() | 269 | >>> bar_ok.process() |
950 | 270 | 270 | ||
951 | === modified file 'lib/lp/soyuz/scripts/tests/test_queue.py' | |||
952 | --- lib/lp/soyuz/scripts/tests/test_queue.py 2010-02-09 00:17:40 +0000 | |||
953 | +++ lib/lp/soyuz/scripts/tests/test_queue.py 2010-08-04 22:12:18 +0000 | |||
954 | @@ -123,7 +123,7 @@ | |||
955 | 123 | LaunchpadZopelessLayer.switchDbUser("uploader") | 123 | LaunchpadZopelessLayer.switchDbUser("uploader") |
956 | 124 | sync_policy = getPolicy( | 124 | sync_policy = getPolicy( |
957 | 125 | name='sync', distro='ubuntu', distroseries='breezy-autotest') | 125 | name='sync', distro='ubuntu', distroseries='breezy-autotest') |
959 | 126 | bar_src = NascentUpload( | 126 | bar_src = NascentUpload.from_changesfile_path( |
960 | 127 | datadir(changesfile), | 127 | datadir(changesfile), |
961 | 128 | sync_policy, mock_logger_quiet) | 128 | sync_policy, mock_logger_quiet) |
962 | 129 | bar_src.process() | 129 | bar_src.process() |
Hi William,
This is a meaty change, lots of new code. Very nice. I especially like the refactoring of NascentUpload and _matchDDEBs(): both excellent changes.
Here is the list of notes I took while reviewing the code:
• Do ChangesFile objects have a .path attribute that you can use instead of string-sniffing in the constructor? If so, then perhaps you can push the fiddly conditional construction down into ChangesFile itself and at the same time eliminate the .changesfile_path attribute from the NascentUpload object. A NascentUpload. from_path( ) factory method would be even better, eliminating the conditional construction entirely.
• Switching from .reject() to 'yield UploadError()' is a pretty big API change, however I do not see any code in the diff (besides the tests) that is impacted by it. Why not?
• It would be good to have a docstring for _matchDDEBs() that tells you that it is a generator method.
• I think the test names could be improved a bit: the comment should be used as test method name, because the comments tell you what the desired behaviour is. They tell you what the test is actually testing.
• You might be able to rewrite all those "self.assertEqu als([], list(self. upload. _matchDDEBs( )))" statements using the nifty testtools. TestCase. assertThat( ) method: self.assertThat (self.upload, matchesDDEBs([]))
With the above points taken into consideration, r=mars