Merge lp:~jelmer/launchpad/613468-xb-ppa-qa into lp:launchpad/db-devel
- 613468-xb-ppa-qa
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9741 |
Proposed branch: | lp:~jelmer/launchpad/613468-xb-ppa-qa |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
780 lines (+138/-112) 16 files modified
lib/lp/archiveuploader/changesfile.py (+20/-20) lib/lp/archiveuploader/dscfile.py (+37/-36) lib/lp/archiveuploader/nascentuploadfile.py (+4/-3) lib/lp/archiveuploader/tagfiles.py (+14/-7) lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt (+1/-1) lib/lp/archiveuploader/tests/nascentuploadfile.txt (+2/-2) lib/lp/archiveuploader/tests/test_nascentuploadfile.py (+15/-1) lib/lp/archiveuploader/tests/test_tagfiles.py (+4/-4) lib/lp/archiveuploader/tests/test_uploadprocessor.py (+2/-2) lib/lp/soyuz/doc/soyuz-upload.txt (+4/-4) lib/lp/soyuz/model/queue.py (+14/-14) lib/lp/soyuz/scripts/gina/handlers.py (+3/-0) lib/lp/soyuz/scripts/processaccepted.py (+1/-1) lib/lp/soyuz/scripts/tests/test_queue.py (+2/-2) lib/lp/soyuz/scripts/tests/test_sync_source.py (+14/-14) scripts/ftpmaster-tools/sync-source.py (+1/-1) |
To merge this branch: | bzr merge lp:~jelmer/launchpad/613468-xb-ppa-qa |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+33804@code.launchpad.net |
Commit message
Preserve the case of user defined fields in control files.
Description of the change
This branch fixes some qa-badness in the fix for bug 613468.
Debian control fields have case-insensitive names:
http://
Previously we would lowercase the field names when parsing them so we could always do lookups on lowercased names. When printing out these fields we would always use predefined formatting, as we only supported a limited set of fields (Build-Depends, Depends, Maintainer, etc.).
Now that custom fields are supported we need to preserve the original field name. To still support case-insensitive lookups we now use the custom Deb822Dict() class from python-debian, which provides support for case-preserving field names on which we can do case-insensitive lookups.
Jelmer Vernooij (jelmer) wrote : | # |
Abel Deuring (adeuring) : | # |
Preview Diff
1 | === modified file 'lib/lp/archiveuploader/changesfile.py' |
2 | --- lib/lp/archiveuploader/changesfile.py 2010-08-24 11:31:13 +0000 |
3 | +++ lib/lp/archiveuploader/changesfile.py 2010-09-02 16:32:16 +0000 |
4 | @@ -58,12 +58,12 @@ |
5 | """Changesfile model.""" |
6 | |
7 | mandatory_fields = set([ |
8 | - "source", "binary", "architecture", "version", "distribution", |
9 | - "maintainer", "files", "changes", "date", |
10 | + "Source", "Binary", "Architecture", "Version", "Distribution", |
11 | + "Maintainer", "Files", "Changes", "Date", |
12 | # Changed-By is not technically mandatory according to |
13 | # Debian policy but Soyuz relies on it being set in |
14 | # various places. |
15 | - "changed-by"]) |
16 | + "Changed-By"]) |
17 | |
18 | # Map urgencies to their dbschema values. |
19 | # Debian policy only permits low, medium, high, emergency. |
20 | @@ -117,7 +117,7 @@ |
21 | "file." % field) |
22 | |
23 | try: |
24 | - format = float(self._dict["format"]) |
25 | + format = float(self._dict["Format"]) |
26 | except KeyError: |
27 | # If format is missing, pretend it's 1.5 |
28 | format = 1.5 |
29 | @@ -158,12 +158,12 @@ |
30 | # signed upload. This is desireable because it avoids us |
31 | # doing ensurePerson() for buildds and sync owners. |
32 | try: |
33 | - self.maintainer = self.parseAddress(self._dict['maintainer']) |
34 | + self.maintainer = self.parseAddress(self._dict['Maintainer']) |
35 | except UploadError, error: |
36 | yield error |
37 | |
38 | try: |
39 | - self.changed_by = self.parseAddress(self._dict['changed-by']) |
40 | + self.changed_by = self.parseAddress(self._dict['Changed-By']) |
41 | except UploadError, error: |
42 | yield error |
43 | |
44 | @@ -188,7 +188,7 @@ |
45 | files. |
46 | """ |
47 | files = [] |
48 | - for fileline in self._dict['files'].strip().split("\n"): |
49 | + for fileline in self._dict['Files'].strip().split("\n"): |
50 | # files lines from a changes file are always of the form: |
51 | # CHECKSUM SIZE [COMPONENT/]SECTION PRIORITY FILENAME |
52 | digest, size, component_and_section, priority_name, filename = ( |
53 | @@ -237,16 +237,16 @@ |
54 | if len(self.files) == 0: |
55 | yield UploadError("No files found in the changes") |
56 | |
57 | - if 'urgency' not in self._dict: |
58 | + if 'Urgency' not in self._dict: |
59 | # Urgency is recommended but not mandatory. Default to 'low' |
60 | - self._dict['urgency'] = "low" |
61 | + self._dict['Urgency'] = "low" |
62 | |
63 | - raw_urgency = self._dict['urgency'].lower() |
64 | + raw_urgency = self._dict['Urgency'].lower() |
65 | if raw_urgency not in self.urgency_map: |
66 | yield UploadWarning( |
67 | "Unable to grok urgency %s, overriding with 'low'" |
68 | % (raw_urgency)) |
69 | - self._dict['urgency'] = "low" |
70 | + self._dict['Urgency'] = "low" |
71 | |
72 | if not self.policy.unsigned_changes_ok: |
73 | assert self.signer is not None, ( |
74 | @@ -295,7 +295,7 @@ |
75 | |
76 | For example, 'hoary' or 'hoary-security'. |
77 | """ |
78 | - return self._dict['distribution'] |
79 | + return self._dict['Distribution'] |
80 | |
81 | @property |
82 | def architectures(self): |
83 | @@ -304,22 +304,22 @@ |
84 | For instance ['source', 'all'] or ['source', 'i386', 'amd64'] |
85 | or ['source']. |
86 | """ |
87 | - return set(self._dict['architecture'].split()) |
88 | + return set(self._dict['Architecture'].split()) |
89 | |
90 | @property |
91 | def binaries(self): |
92 | """Return set of binary package names listed.""" |
93 | - return set(self._dict['binary'].strip().split()) |
94 | + return set(self._dict['Binary'].strip().split()) |
95 | |
96 | @property |
97 | def converted_urgency(self): |
98 | """Return the appropriate SourcePackageUrgency item.""" |
99 | - return self.urgency_map[self._dict['urgency'].lower()] |
100 | + return self.urgency_map[self._dict['Urgency'].lower()] |
101 | |
102 | @property |
103 | def version(self): |
104 | """Return changesfile claimed version.""" |
105 | - return self._dict['version'] |
106 | + return self._dict['Version'] |
107 | |
108 | @classmethod |
109 | def formatChangesComment(cls, comment): |
110 | @@ -336,24 +336,24 @@ |
111 | @property |
112 | def changes_comment(self): |
113 | """Return changesfile 'change' comment.""" |
114 | - comment = self._dict['changes'] |
115 | + comment = self._dict['Changes'] |
116 | |
117 | return self.formatChangesComment(comment) |
118 | |
119 | @property |
120 | def date(self): |
121 | """Return changesfile date.""" |
122 | - return self._dict['date'] |
123 | + return self._dict['Date'] |
124 | |
125 | @property |
126 | def source(self): |
127 | """Return changesfile claimed source name.""" |
128 | - return self._dict['source'] |
129 | + return self._dict['Source'] |
130 | |
131 | @property |
132 | def architecture_line(self): |
133 | """Return changesfile archicteture line.""" |
134 | - return self._dict['architecture'] |
135 | + return self._dict['Architecture'] |
136 | |
137 | @property |
138 | def filecontents(self): |
139 | |
140 | === modified file 'lib/lp/archiveuploader/dscfile.py' |
141 | --- lib/lp/archiveuploader/dscfile.py 2010-08-30 19:06:34 +0000 |
142 | +++ lib/lp/archiveuploader/dscfile.py 2010-09-02 16:32:16 +0000 |
143 | @@ -17,7 +17,9 @@ |
144 | 'find_copyright', |
145 | ] |
146 | |
147 | +import apt_pkg |
148 | from cStringIO import StringIO |
149 | +from debian.deb822 import Deb822Dict |
150 | import errno |
151 | import glob |
152 | import os |
153 | @@ -25,7 +27,6 @@ |
154 | import subprocess |
155 | import tempfile |
156 | |
157 | -import apt_pkg |
158 | from zope.component import getUtility |
159 | |
160 | from canonical.encoding import guess as guess_encoding |
161 | @@ -206,8 +207,8 @@ |
162 | |
163 | person = getUtility(IPersonSet).getByEmail(email) |
164 | if person is None and self.policy.create_people: |
165 | - package = self._dict['source'] |
166 | - version = self._dict['version'] |
167 | + package = self._dict['Source'] |
168 | + version = self._dict['Version'] |
169 | if self.policy.distroseries and self.policy.pocket: |
170 | policy_suite = ('%s/%s' % (self.policy.distroseries.name, |
171 | self.policy.pocket.name)) |
172 | @@ -235,20 +236,20 @@ |
173 | """Models a given DSC file and its content.""" |
174 | |
175 | mandatory_fields = set([ |
176 | - "source", |
177 | - "version", |
178 | - "binary", |
179 | - "maintainer", |
180 | - "architecture", |
181 | - "files"]) |
182 | + "Source", |
183 | + "Version", |
184 | + "Binary", |
185 | + "Maintainer", |
186 | + "Architecture", |
187 | + "Files"]) |
188 | |
189 | known_fields = mandatory_fields.union(set([ |
190 | - "build-depends", |
191 | - "build-depends-indep", |
192 | - "build-conflicts", |
193 | - "build-conflicts-indep", |
194 | - "format", |
195 | - "standards-version", |
196 | + "Build-Depends", |
197 | + "Build-Depends-Indep", |
198 | + "Build-Conflicts", |
199 | + "Build-Conflicts-Indep", |
200 | + "Format", |
201 | + "Standards-Version", |
202 | "filecontents", |
203 | "homepage", |
204 | ])) |
205 | @@ -289,17 +290,17 @@ |
206 | "Unable to find mandatory field %s in %s" % ( |
207 | mandatory_field, self.filename)) |
208 | |
209 | - self.maintainer = self.parseAddress(self._dict['maintainer']) |
210 | + self.maintainer = self.parseAddress(self._dict['Maintainer']) |
211 | |
212 | # If format is not present, assume 1.0. At least one tool in |
213 | # the wild generates dsc files with format missing, and we need |
214 | # to accept them. |
215 | - if 'format' not in self._dict: |
216 | - self._dict['format'] = "1.0" |
217 | + if 'Format' not in self._dict: |
218 | + self._dict['Format'] = "1.0" |
219 | |
220 | if self.format is None: |
221 | raise EarlyReturnUploadError( |
222 | - "Unsupported source format: %s" % self._dict['format']) |
223 | + "Unsupported source format: %s" % self._dict['Format']) |
224 | |
225 | if self.policy.unsigned_dsc_ok: |
226 | self.logger.debug("DSC file can be unsigned.") |
227 | @@ -312,31 +313,31 @@ |
228 | @property |
229 | def source(self): |
230 | """Return the DSC source name.""" |
231 | - return self._dict['source'] |
232 | + return self._dict['Source'] |
233 | |
234 | @property |
235 | def dsc_version(self): |
236 | """Return the DSC source version.""" |
237 | - return self._dict['version'] |
238 | + return self._dict['Version'] |
239 | |
240 | @property |
241 | def format(self): |
242 | """Return the DSC format.""" |
243 | try: |
244 | return SourcePackageFormat.getTermByToken( |
245 | - self._dict['format']).value |
246 | + self._dict['Format']).value |
247 | except LookupError: |
248 | return None |
249 | |
250 | @property |
251 | def architecture(self): |
252 | """Return the DSC source architecture.""" |
253 | - return self._dict['architecture'] |
254 | + return self._dict['Architecture'] |
255 | |
256 | @property |
257 | def binary(self): |
258 | """Return the DSC claimed binary line.""" |
259 | - return self._dict['binary'] |
260 | + return self._dict['Binary'] |
261 | |
262 | |
263 | # |
264 | @@ -359,7 +360,7 @@ |
265 | yield error |
266 | |
267 | files = [] |
268 | - for fileline in self._dict['files'].strip().split("\n"): |
269 | + for fileline in self._dict['Files'].strip().split("\n"): |
270 | # DSC lines are always of the form: CHECKSUM SIZE FILENAME |
271 | digest, size, filename = fileline.strip().split() |
272 | if not re_issource.match(filename): |
273 | @@ -393,7 +394,7 @@ |
274 | (self.filename, self.format, self.policy.distroseries.name)) |
275 | |
276 | # Validate the build dependencies |
277 | - for field_name in ['build-depends', 'build-depends-indep']: |
278 | + for field_name in ['Build-Depends', 'Build-Depends-Indep']: |
279 | field = self._dict.get(field_name, None) |
280 | if field is not None: |
281 | if field.startswith("ARRAY"): |
282 | @@ -672,7 +673,7 @@ |
283 | |
284 | # We have no way of knowing what encoding the original copyright |
285 | # file is in, unfortunately, and there is no standard, so guess. |
286 | - encoded = {} |
287 | + encoded = Deb822Dict() |
288 | for key, value in pending.items(): |
289 | if value is not None: |
290 | encoded[key] = guess_encoding(value) |
291 | @@ -701,20 +702,20 @@ |
292 | sourcepackagename=source_name, |
293 | version=self.dsc_version, |
294 | maintainer=self.maintainer['person'], |
295 | - builddepends=encoded.get('build-depends', ''), |
296 | - builddependsindep=encoded.get('build-depends-indep', ''), |
297 | - build_conflicts=encoded.get('build-conflicts', ''), |
298 | - build_conflicts_indep=encoded.get('build-conflicts-indep', ''), |
299 | - architecturehintlist=encoded.get('architecture', ''), |
300 | + builddepends=encoded.get('Build-Depends', ''), |
301 | + builddependsindep=encoded.get('Build-Depends-Indep', ''), |
302 | + build_conflicts=encoded.get('Build-Conflicts', ''), |
303 | + build_conflicts_indep=encoded.get('Build-Conflicts-Indep', ''), |
304 | + architecturehintlist=encoded.get('Architecture', ''), |
305 | creator=self.changes.changed_by['person'], |
306 | urgency=self.changes.converted_urgency, |
307 | homepage=encoded.get('homepage'), |
308 | dsc=encoded['filecontents'], |
309 | dscsigningkey=self.signingkey, |
310 | - dsc_maintainer_rfc822=encoded['maintainer'], |
311 | - dsc_format=encoded['format'], |
312 | - dsc_binaries=encoded['binary'], |
313 | - dsc_standards_version=encoded.get('standards-version'), |
314 | + dsc_maintainer_rfc822=encoded['Maintainer'], |
315 | + dsc_format=encoded['Format'], |
316 | + dsc_binaries=encoded['Binary'], |
317 | + dsc_standards_version=encoded.get('Standards-Version'), |
318 | component=self.component, |
319 | changelog=changelog_lfa, |
320 | changelog_entry=encoded.get('simulated_changelog'), |
321 | |
322 | === modified file 'lib/lp/archiveuploader/nascentuploadfile.py' |
323 | --- lib/lp/archiveuploader/nascentuploadfile.py 2010-08-30 19:06:34 +0000 |
324 | +++ lib/lp/archiveuploader/nascentuploadfile.py 2010-09-02 16:32:16 +0000 |
325 | @@ -19,14 +19,15 @@ |
326 | 'splitComponentAndSection', |
327 | ] |
328 | |
329 | +import apt_inst |
330 | +import apt_pkg |
331 | +from debian.deb822 import Deb822Dict |
332 | import hashlib |
333 | import os |
334 | import subprocess |
335 | import sys |
336 | import time |
337 | |
338 | -import apt_inst |
339 | -import apt_pkg |
340 | from zope.component import getUtility |
341 | |
342 | from canonical.encoding import guess as guess_encoding |
343 | @@ -883,7 +884,7 @@ |
344 | """Insert this binary release and build into the database.""" |
345 | # Reencode everything we are supplying, because old packages |
346 | # contain latin-1 text and that sucks. |
347 | - encoded = {} |
348 | + encoded = Deb822Dict() |
349 | for key, value in self.control.items(): |
350 | encoded[key] = guess_encoding(value) |
351 | |
352 | |
353 | === modified file 'lib/lp/archiveuploader/tagfiles.py' |
354 | --- lib/lp/archiveuploader/tagfiles.py 2010-08-20 20:31:18 +0000 |
355 | +++ lib/lp/archiveuploader/tagfiles.py 2010-09-02 16:32:16 +0000 |
356 | @@ -1,14 +1,20 @@ |
357 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
358 | # GNU Affero General Public License version 3 (see the file LICENSE). |
359 | |
360 | +"""Utility classes for parsing Debian tag files.""" |
361 | + |
362 | +__all__ = [ |
363 | + 'TagFile', |
364 | + 'TagStanza', |
365 | + 'TagFileParseError', |
366 | + 'parse_tagfile', |
367 | + 'parse_tagfile_lines' |
368 | + ] |
369 | + |
370 | + |
371 | +import apt_pkg |
372 | import re |
373 | |
374 | -import apt_pkg |
375 | - |
376 | - |
377 | -__all__ = [ |
378 | - 'TagFile', 'TagStanza', 'TagFileParseError', |
379 | - 'parse_tagfile', 'parse_tagfile_lines'] |
380 | |
381 | class TagFile(object): |
382 | """Provide an iterable interface to the apt_pkg.TagFile object""" |
383 | @@ -92,6 +98,7 @@ |
384 | '-----BEGIN PGP SIGNATURE-----'. |
385 | """ |
386 | error = "" |
387 | + |
388 | changes = {} |
389 | |
390 | # Reindex by line number so we can easily verify the format of |
391 | @@ -152,7 +159,7 @@ |
392 | continue |
393 | slf = re_single_line_field.match(line) |
394 | if slf: |
395 | - field = slf.groups()[0].lower() |
396 | + field = slf.groups()[0] |
397 | changes[field] = slf.groups()[1] |
398 | |
399 | # If there is no value on this line, we assume this is |
400 | |
401 | === modified file 'lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt' |
402 | --- lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt 2008-09-15 08:13:00 +0000 |
403 | +++ lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt 2010-09-02 16:32:16 +0000 |
404 | @@ -79,7 +79,7 @@ |
405 | >>> bar2_src.changes.changed_by['person'].name |
406 | u'kinnison' |
407 | |
408 | - >>> bar2_src.changes._dict['launchpad-bugs-fixed'] |
409 | + >>> bar2_src.changes._dict['Launchpad-bugs-fixed'] |
410 | '6' |
411 | |
412 | >>> print bar2_src.changes.changes_comment |
413 | |
414 | === modified file 'lib/lp/archiveuploader/tests/nascentuploadfile.txt' |
415 | --- lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-08-24 20:23:48 +0000 |
416 | +++ lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-09-02 16:32:16 +0000 |
417 | @@ -233,8 +233,8 @@ |
418 | present in ChangesFile and DSCFile: |
419 | |
420 | >>> sig_file._dict = {} |
421 | - >>> sig_file._dict['source'] = 'some-source' |
422 | - >>> sig_file._dict['version'] = '6.6.6' |
423 | + >>> sig_file._dict['Source'] = 'some-source' |
424 | + >>> sig_file._dict['Version'] = '6.6.6' |
425 | |
426 | After initiliasing sig_file we can parse addresses and look them up in |
427 | Launchpad: |
428 | |
429 | === modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py' |
430 | --- lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-09-02 11:02:24 +0000 |
431 | +++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-09-02 16:32:16 +0000 |
432 | @@ -175,6 +175,20 @@ |
433 | self.assertEquals("0.42", release.version) |
434 | self.assertEquals("dpkg, bzr", release.builddepends) |
435 | |
436 | + def test_storeInDatabase_case_sensitivity(self): |
437 | + # storeInDatabase supports field names with different cases, |
438 | + # confirming to Debian policy. |
439 | + dsc = self.getBaseDsc() |
440 | + dsc["buIld-depends"] = "dpkg, bzr" |
441 | + changes = self.getBaseChanges() |
442 | + uploadfile = self.createDSCFile( |
443 | + "foo.dsc", dsc, "main/net", "extra", "dulwich", "0.42", |
444 | + self.createChangesFile("foo.changes", changes)) |
445 | + uploadfile.files = [] |
446 | + uploadfile.changelog = "DUMMY" |
447 | + release = uploadfile.storeInDatabase(None) |
448 | + self.assertEquals("dpkg, bzr", release.builddepends) |
449 | + |
450 | def test_user_defined_fields(self): |
451 | # storeInDatabase updates user_defined_fields. |
452 | dsc = self.getBaseDsc() |
453 | @@ -188,7 +202,7 @@ |
454 | release = uploadfile.storeInDatabase(None) |
455 | # DSCFile lowercases the field names |
456 | self.assertEquals( |
457 | - [["python-version", u"2.5"]], release.user_defined_fields) |
458 | + [["Python-Version", u"2.5"]], release.user_defined_fields) |
459 | |
460 | def test_homepage(self): |
461 | # storeInDatabase updates homepage. |
462 | |
463 | === modified file 'lib/lp/archiveuploader/tests/test_tagfiles.py' |
464 | --- lib/lp/archiveuploader/tests/test_tagfiles.py 2010-08-20 20:31:18 +0000 |
465 | +++ lib/lp/archiveuploader/tests/test_tagfiles.py 2010-09-02 16:32:16 +0000 |
466 | @@ -76,7 +76,7 @@ |
467 | parse_tagfile, datadir("bad-multiline-changes"), 1) |
468 | |
469 | def testCheckParseUnterminatedSigRaises(self): |
470 | - """lp.archiveuploader.tagfiles.parse_chantges should raise |
471 | + """lp.archiveuploader.tagfiles.parse_changes should raise |
472 | TagFileParseError on unterminated signatures |
473 | """ |
474 | self.assertRaises(TagFileParseError, |
475 | @@ -128,7 +128,7 @@ |
476 | |
477 | self.assertEqual( |
478 | expected_text, |
479 | - self.parse_tagfile_version['binary']) |
480 | + self.parse_tagfile_version['Binary']) |
481 | |
482 | def test_parse_tagfile_with_newline_delimited_field(self): |
483 | """parse_tagfile should not leave leading or tailing '\n' when |
484 | @@ -157,7 +157,7 @@ |
485 | |
486 | self.assertEqual( |
487 | expected_text, |
488 | - self.parse_tagfile_version['files']) |
489 | + self.parse_tagfile_version['Files']) |
490 | |
491 | def test_parse_description_field(self): |
492 | """Apt-pkg preserves the blank-line indicator and does not strip |
493 | @@ -186,4 +186,4 @@ |
494 | # replaced by ParseTagFiles). |
495 | self.assertEqual( |
496 | expected_text, |
497 | - self.parse_tagfile_version['description']) |
498 | + self.parse_tagfile_version['Description']) |
499 | |
500 | === modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py' |
501 | --- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-08-27 11:19:54 +0000 |
502 | +++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-09-02 16:32:16 +0000 |
503 | @@ -1202,7 +1202,7 @@ |
504 | error_report.write(fp) |
505 | error_text = fp.getvalue() |
506 | self.assertTrue( |
507 | - "Unable to find mandatory field 'files' in the changes file" in error_text) |
508 | + "Unable to find mandatory field 'Files' in the changes file" in error_text) |
509 | |
510 | # Housekeeping so the next test won't fail. |
511 | shutil.rmtree(upload_dir) |
512 | @@ -1369,7 +1369,7 @@ |
513 | % error_text) |
514 | |
515 | expected_explanation = ( |
516 | - "Unable to find mandatory field 'files' in the changes file.") |
517 | + "Unable to find mandatory field 'Files' in the changes file.") |
518 | self.failUnless( |
519 | error_text.find(expected_explanation) >= 0, |
520 | 'Expected Exception text not found in OOPS report:\n%s' |
521 | |
522 | === modified file 'lib/lp/soyuz/doc/soyuz-upload.txt' |
523 | --- lib/lp/soyuz/doc/soyuz-upload.txt 2010-08-24 12:25:48 +0000 |
524 | +++ lib/lp/soyuz/doc/soyuz-upload.txt 2010-09-02 16:32:16 +0000 |
525 | @@ -94,14 +94,14 @@ |
526 | ... |
527 | ... tf = parse_tagfile(changes_filepath) |
528 | ... |
529 | - ... if tf.has_key("source"): |
530 | - ... package_names.append(tf["source"]) |
531 | + ... if tf.has_key("Source"): |
532 | + ... package_names.append(tf["Source"]) |
533 | ... |
534 | ... send_filepaths = [changes_filepath] |
535 | - ... if tf.has_key("files"): |
536 | + ... if tf.has_key("Files"): |
537 | ... send_filepaths.extend( |
538 | ... [os.path.join(test_files_dir, line.split()[-1]) |
539 | - ... for line in tf["files"].splitlines() if line]) |
540 | + ... for line in tf["Files"].splitlines() if line]) |
541 | ... |
542 | ... sent_filenames.extend( |
543 | ... os.path.basename(filepath) for filepath in send_filepaths) |
544 | |
545 | === modified file 'lib/lp/soyuz/model/queue.py' |
546 | --- lib/lp/soyuz/model/queue.py 2010-08-24 12:25:48 +0000 |
547 | +++ lib/lp/soyuz/model/queue.py 2010-09-02 16:32:16 +0000 |
548 | @@ -801,16 +801,16 @@ |
549 | :changes: A dictionary with the changes file content. |
550 | """ |
551 | # Add the date field. |
552 | - message.DATE = 'Date: %s' % changes['date'] |
553 | + message.DATE = 'Date: %s' % changes['Date'] |
554 | |
555 | # Add the debian 'Changed-By:' field. |
556 | - changed_by = changes.get('changed-by') |
557 | + changed_by = changes.get('Changed-By') |
558 | if changed_by is not None: |
559 | changed_by = sanitize_string(changed_by) |
560 | message.CHANGEDBY = '\nChanged-By: %s' % changed_by |
561 | |
562 | # Add maintainer if present and different from changed-by. |
563 | - maintainer = changes.get('maintainer') |
564 | + maintainer = changes.get('Maintainer') |
565 | if maintainer is not None: |
566 | maintainer = sanitize_string(maintainer) |
567 | if maintainer != changed_by: |
568 | @@ -831,8 +831,8 @@ |
569 | message.SIGNER = '\nSigned-By: %s' % signer_signature |
570 | |
571 | # Add the debian 'Origin:' field if present. |
572 | - if changes.get('origin') is not None: |
573 | - message.ORIGIN = '\nOrigin: %s' % changes['origin'] |
574 | + if changes.get('Origin') is not None: |
575 | + message.ORIGIN = '\nOrigin: %s' % changes['Origin'] |
576 | |
577 | if self.sources or self.builds: |
578 | message.SPR_URL = canonical_url(self.my_source_package_release) |
579 | @@ -855,7 +855,7 @@ |
580 | template = get_email_template('upload-rejection.txt') |
581 | SUMMARY = sanitize_string(summary_text) |
582 | CHANGESFILE = sanitize_string( |
583 | - ChangesFile.formatChangesComment(changes['changes'])) |
584 | + ChangesFile.formatChangesComment(changes['Changes'])) |
585 | CHANGEDBY = '' |
586 | ORIGIN = '' |
587 | SIGNER = '' |
588 | @@ -933,7 +933,7 @@ |
589 | STATUS = "New" |
590 | SUMMARY = summarystring |
591 | CHANGESFILE = sanitize_string( |
592 | - ChangesFile.formatChangesComment(changes['changes'])) |
593 | + ChangesFile.formatChangesComment(changes['Changes'])) |
594 | DISTRO = self.distroseries.distribution.title |
595 | if announce_list: |
596 | ANNOUNCE = 'Announcing to %s' % announce_list |
597 | @@ -948,7 +948,7 @@ |
598 | SUMMARY = summarystring + ( |
599 | "\nThis upload awaits approval by a distro manager\n") |
600 | CHANGESFILE = sanitize_string( |
601 | - ChangesFile.formatChangesComment(changes['changes'])) |
602 | + ChangesFile.formatChangesComment(changes['Changes'])) |
603 | DISTRO = self.distroseries.distribution.title |
604 | if announce_list: |
605 | ANNOUNCE = 'Announcing to %s' % announce_list |
606 | @@ -967,7 +967,7 @@ |
607 | STATUS = "Accepted" |
608 | SUMMARY = summarystring |
609 | CHANGESFILE = sanitize_string( |
610 | - ChangesFile.formatChangesComment(changes['changes'])) |
611 | + ChangesFile.formatChangesComment(changes['Changes'])) |
612 | DISTRO = self.distroseries.distribution.title |
613 | if announce_list: |
614 | ANNOUNCE = 'Announcing to %s' % announce_list |
615 | @@ -994,7 +994,7 @@ |
616 | STATUS = "Accepted" |
617 | SUMMARY = summarystring |
618 | CHANGESFILE = sanitize_string( |
619 | - ChangesFile.formatChangesComment(changes['changes'])) |
620 | + ChangesFile.formatChangesComment(changes['Changes'])) |
621 | CHANGEDBY = '' |
622 | ORIGIN = '' |
623 | SIGNER = '' |
624 | @@ -1045,14 +1045,14 @@ |
625 | do_sendmail(AcceptedMessage) |
626 | |
627 | # Don't send announcements for Debian auto sync uploads. |
628 | - if self.isAutoSyncUpload(changed_by_email=changes['changed-by']): |
629 | + if self.isAutoSyncUpload(changed_by_email=changes['Changed-By']): |
630 | return |
631 | |
632 | if announce_list: |
633 | if not self.signing_key: |
634 | from_addr = None |
635 | else: |
636 | - from_addr = guess_encoding(changes['changed-by']) |
637 | + from_addr = guess_encoding(changes['Changed-By']) |
638 | |
639 | do_sendmail( |
640 | AnnouncementMessage, |
641 | @@ -1135,7 +1135,7 @@ |
642 | """Return a list of recipients for notification emails.""" |
643 | candidate_recipients = [] |
644 | debug(self.logger, "Building recipients list.") |
645 | - changer = self._emailToPerson(changes['changed-by']) |
646 | + changer = self._emailToPerson(changes['Changed-By']) |
647 | |
648 | if self.signing_key: |
649 | # This is a signed upload. |
650 | @@ -1157,7 +1157,7 @@ |
651 | |
652 | # If this is not a PPA, we also consider maintainer and changed-by. |
653 | if self.signing_key and not self.isPPA(): |
654 | - maintainer = self._emailToPerson(changes['maintainer']) |
655 | + maintainer = self._emailToPerson(changes['Maintainer']) |
656 | if (maintainer and maintainer != signer and |
657 | maintainer.isUploader(self.distroseries.distribution)): |
658 | debug(self.logger, "Adding maintainer to recipients") |
659 | |
660 | === modified file 'lib/lp/soyuz/scripts/gina/handlers.py' |
661 | --- lib/lp/soyuz/scripts/gina/handlers.py 2010-08-27 11:19:54 +0000 |
662 | +++ lib/lp/soyuz/scripts/gina/handlers.py 2010-09-02 16:32:16 +0000 |
663 | @@ -520,6 +520,9 @@ |
664 | log.debug("Found a source package for %s (%s) in %s" % (sp_name, |
665 | sp_version, sp_component)) |
666 | dsc_contents = parse_tagfile(dsc_path, allow_unsigned=True) |
667 | + dsc_contents = dict([ |
668 | + (name.lower(), value) for |
669 | + (name, value) in dsc_contents.iteritems()]) |
670 | |
671 | # Since the dsc doesn't know, we add in the directory, package |
672 | # component and section |
673 | |
674 | === modified file 'lib/lp/soyuz/scripts/processaccepted.py' |
675 | --- lib/lp/soyuz/scripts/processaccepted.py 2010-08-24 12:25:48 +0000 |
676 | +++ lib/lp/soyuz/scripts/processaccepted.py 2010-09-02 16:32:16 +0000 |
677 | @@ -48,7 +48,7 @@ |
678 | contents = changes_file.read() |
679 | changes_lines = contents.splitlines(True) |
680 | tags = parse_tagfile_lines(changes_lines, allow_unsigned=True) |
681 | - bugs_fixed_line = tags.get('launchpad-bugs-fixed', '') |
682 | + bugs_fixed_line = tags.get('Launchpad-bugs-fixed', '') |
683 | bugs = [] |
684 | for bug_id in bugs_fixed_line.split(): |
685 | if not bug_id.isdigit(): |
686 | |
687 | === modified file 'lib/lp/soyuz/scripts/tests/test_queue.py' |
688 | --- lib/lp/soyuz/scripts/tests/test_queue.py 2010-08-24 15:29:01 +0000 |
689 | +++ lib/lp/soyuz/scripts/tests/test_queue.py 2010-09-02 16:32:16 +0000 |
690 | @@ -382,10 +382,10 @@ |
691 | queue_action = self.execute_command('accept bar', no_mail=False) |
692 | |
693 | # The upload wants to close bug 6: |
694 | - bugs_fixed_header = bar2_src.changes._dict['launchpad-bugs-fixed'] |
695 | + bugs_fixed_header = bar2_src.changes._dict['Launchpad-bugs-fixed'] |
696 | self.assertEqual( |
697 | bugs_fixed_header, str(the_bug_id), |
698 | - 'Expected bug %s in launchpad-bugs-fixed, got %s' |
699 | + 'Expected bug %s in Launchpad-bugs-fixed, got %s' |
700 | % (the_bug_id, bugs_fixed_header)) |
701 | |
702 | # The upload should be in the DONE state: |
703 | |
704 | === modified file 'lib/lp/soyuz/scripts/tests/test_sync_source.py' |
705 | --- lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-08-20 20:31:18 +0000 |
706 | +++ lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-09-02 16:32:16 +0000 |
707 | @@ -322,25 +322,25 @@ |
708 | expected_changesfile, allow_unsigned=True) |
709 | |
710 | # It refers to the right source/version. |
711 | - self.assertEqual(parsed_changes['source'], 'bar') |
712 | - self.assertEqual(parsed_changes['version'], '1.0-1') |
713 | + self.assertEqual(parsed_changes['Source'], 'bar') |
714 | + self.assertEqual(parsed_changes['Version'], '1.0-1') |
715 | |
716 | # It includes the correct 'origin' and 'target' information. |
717 | - self.assertEqual(parsed_changes['origin'], 'Debian/incoming') |
718 | - self.assertEqual(parsed_changes['distribution'], 'hoary') |
719 | + self.assertEqual(parsed_changes['Origin'], 'Debian/incoming') |
720 | + self.assertEqual(parsed_changes['Distribution'], 'hoary') |
721 | |
722 | # 'closes' and 'launchpad-bug-fixed' are filled according to |
723 | # what is listed in the debian/changelog. |
724 | - self.assertEqual(parsed_changes['closes'], '1 2 1234 4321') |
725 | - self.assertEqual(parsed_changes['launchpad-bugs-fixed'], '1234 4321') |
726 | + self.assertEqual(parsed_changes['Closes'], '1 2 1234 4321') |
727 | + self.assertEqual(parsed_changes['Launchpad-bugs-fixed'], '1234 4321') |
728 | |
729 | # And finally, 'maintainer' role was preserved and 'changed-by' |
730 | # role was assigned as specified in the sync-source command-line. |
731 | self.assertEqual( |
732 | - parsed_changes['maintainer'], |
733 | + parsed_changes['Maintainer'], |
734 | 'Launchpad team <launchpad@lists.canonical.com>') |
735 | self.assertEqual( |
736 | - parsed_changes['changed-by'], |
737 | + parsed_changes['Changed-By'], |
738 | 'Celso Providelo <celso.providelo@canonical.com>') |
739 | |
740 | os.unlink(expected_changesfile) |
741 | @@ -397,20 +397,20 @@ |
742 | expected_changesfile, allow_unsigned=True) |
743 | |
744 | # It refers to the right source/version. |
745 | - self.assertEqual(parsed_changes['source'], 'sample1') |
746 | - self.assertEqual(parsed_changes['version'], '1.0-1') |
747 | + self.assertEqual(parsed_changes['Source'], 'sample1') |
748 | + self.assertEqual(parsed_changes['Version'], '1.0-1') |
749 | |
750 | # It includes the correct 'origin' and 'target' information. |
751 | - self.assertEqual(parsed_changes['origin'], 'Debian/incoming') |
752 | - self.assertEqual(parsed_changes['distribution'], 'hoary') |
753 | + self.assertEqual(parsed_changes['Origin'], 'Debian/incoming') |
754 | + self.assertEqual(parsed_changes['Distribution'], 'hoary') |
755 | |
756 | # And finally, 'maintainer' role was preserved and 'changed-by' |
757 | # role was assigned as specified in the sync-source command-line. |
758 | self.assertEqual( |
759 | - parsed_changes['maintainer'], |
760 | + parsed_changes['Maintainer'], |
761 | 'Raphael Hertzog <hertzog@debian.org>') |
762 | self.assertEqual( |
763 | - parsed_changes['changed-by'], |
764 | + parsed_changes['Changed-By'], |
765 | 'Celso Providelo <celso.providelo@canonical.com>') |
766 | |
767 | os.unlink(expected_changesfile) |
768 | |
769 | === modified file 'scripts/ftpmaster-tools/sync-source.py' |
770 | --- scripts/ftpmaster-tools/sync-source.py 2010-08-26 08:02:08 +0000 |
771 | +++ scripts/ftpmaster-tools/sync-source.py 2010-09-02 16:32:16 +0000 |
772 | @@ -170,7 +170,7 @@ |
773 | if closes: |
774 | changes += "Closes: %s\n" % (" ".join(closes)) |
775 | if lp_closes: |
776 | - changes += "Launchpad-Bugs-Fixed: %s\n" % (" ".join(lp_closes)) |
777 | + changes += "Launchpad-bugs-fixed: %s\n" % (" ".join(lp_closes)) |
778 | changes += "Changes: \n" |
779 | changes += changelog |
780 | changes += "Files: \n" |
I've also updated the existing field names that were used to use the standard casing as is used in the Debian policy documentation.