Merge lp:~jelmer/launchpad/635591-sync-source-unicode into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11565
Proposed branch: lp:~jelmer/launchpad/635591-sync-source-unicode
Merge into: lp:launchpad
Diff against target: 62 lines (+27/-1)
2 files modified
lib/lp/soyuz/scripts/ftpmaster.py (+1/-1)
lib/lp/soyuz/scripts/tests/test_sync_source.py (+26/-0)
To merge this branch: bzr merge lp:~jelmer/launchpad/635591-sync-source-unicode
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Launchpad code reviewers code Pending
Review via email: mp+35715@code.launchpad.net

Commit message

Fix handling of empty lines in sync source (regression from fix for bug 635591).

Description of the change

I found an issue with my fix for bug 635591 when I QA'ed it.

If the changelog entry contains white lines then no new fields will be parsed. Since the Files section was added after the Changes section this meant that the Files section would be ignored in some cases.

This branch adds a test for changelog entries with empty lines and moves the Files section up in the file to cope with this bug.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

FWIW, I'm also filing a bug against python-debian about this issue.

Revision history for this message
Robert Collins (lifeless) wrote :

Something is funny with the bug/branch info here; the older MP isn't linked, the bug isn't qa-bad or qa-needstesting marked. Could you please put a bug together for why the older MP wasn't linked from the branch anymore?

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Thu, 2010-09-16 at 19:08 +0000, Robert Collins wrote:
> Something is funny with the bug/branch info here; the older MP isn't
> linked, the bug isn't qa-bad or qa-needstesting marked. Could you
> please put a bug together for why the older MP wasn't linked from the
> branch anymore?
I think the qa-needstesting wasn't there because I QA'ed it on dogfood
very quickly after it landed on devel, the QA bot probably just hadn't
run yet in that time period.

Bug 640810 has been filed about the missing link to the older MP on the
branch page.

Cheers,

Jelmer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/scripts/ftpmaster.py'
2--- lib/lp/soyuz/scripts/ftpmaster.py 2010-09-16 11:14:42 +0000
3+++ lib/lp/soyuz/scripts/ftpmaster.py 2010-09-16 19:02:52 +0000
4@@ -1464,7 +1464,6 @@
5 changes["Closes"] = " ".join(closes)
6 if lp_closes:
7 changes["Launchpad-bugs-fixed"] = " ".join(lp_closes)
8- changes["Changes"] = "\n%s" % changelog
9 files = []
10 for filename in dsc_files:
11 if filename in files_from_librarian:
12@@ -1477,4 +1476,5 @@
13 })
14
15 changes["Files"] = files
16+ changes["Changes"] = "\n%s" % changelog
17 return changes
18
19=== modified file 'lib/lp/soyuz/scripts/tests/test_sync_source.py'
20--- lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-09-16 11:35:26 +0000
21+++ lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-09-16 19:02:52 +0000
22@@ -5,7 +5,9 @@
23
24 __metaclass__ = type
25
26+from cStringIO import StringIO
27 from debian.deb822 import (
28+ Changes,
29 Deb822Dict,
30 Dsc,
31 )
32@@ -507,6 +509,30 @@
33 self.assertIn(
34 "Updated French translation by J\xc3\xa9lmer.", contents)
35
36+ def test_changelog_whitelines(self):
37+ # The changelog entry can contain empty lines, and this should not
38+ # mess up the parsing of the changes file.
39+ changelog = "* Foo\n\n\n* Bar\n.\nEntries"
40+ changes = self.generateChanges(changelog=changelog)
41+ contents = changes.dump(encoding="utf-8").encode("utf-8")
42+ # Read contents back
43+ read_changes = Changes(contents)
44+ self.assertEquals("\n%s" % changelog, changes['Changes'])
45+ self.assertContentEqual([
46+ 'Architecture',
47+ 'Binary',
48+ 'Changed-By',
49+ 'Changes',
50+ 'Date',
51+ 'Distribution',
52+ 'Files',
53+ 'Format',
54+ 'Maintainer',
55+ 'Origin',
56+ 'Source',
57+ 'Urgency',
58+ 'Version',
59+ ], read_changes.keys())
60
61 def test_suite():
62 return TestLoader().loadTestsFromName(__name__)