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
=== modified file 'lib/lp/soyuz/scripts/ftpmaster.py'
--- lib/lp/soyuz/scripts/ftpmaster.py 2010-09-16 11:14:42 +0000
+++ lib/lp/soyuz/scripts/ftpmaster.py 2010-09-16 19:02:52 +0000
@@ -1464,7 +1464,6 @@
1464 changes["Closes"] = " ".join(closes)1464 changes["Closes"] = " ".join(closes)
1465 if lp_closes:1465 if lp_closes:
1466 changes["Launchpad-bugs-fixed"] = " ".join(lp_closes)1466 changes["Launchpad-bugs-fixed"] = " ".join(lp_closes)
1467 changes["Changes"] = "\n%s" % changelog
1468 files = []1467 files = []
1469 for filename in dsc_files:1468 for filename in dsc_files:
1470 if filename in files_from_librarian:1469 if filename in files_from_librarian:
@@ -1477,4 +1476,5 @@
1477 })1476 })
14781477
1479 changes["Files"] = files1478 changes["Files"] = files
1479 changes["Changes"] = "\n%s" % changelog
1480 return changes1480 return changes
14811481
=== modified file 'lib/lp/soyuz/scripts/tests/test_sync_source.py'
--- lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-09-16 11:35:26 +0000
+++ lib/lp/soyuz/scripts/tests/test_sync_source.py 2010-09-16 19:02:52 +0000
@@ -5,7 +5,9 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from cStringIO import StringIO
8from debian.deb822 import (9from debian.deb822 import (
10 Changes,
9 Deb822Dict,11 Deb822Dict,
10 Dsc,12 Dsc,
11 )13 )
@@ -507,6 +509,30 @@
507 self.assertIn(509 self.assertIn(
508 "Updated French translation by J\xc3\xa9lmer.", contents)510 "Updated French translation by J\xc3\xa9lmer.", contents)
509511
512 def test_changelog_whitelines(self):
513 # The changelog entry can contain empty lines, and this should not
514 # mess up the parsing of the changes file.
515 changelog = "* Foo\n\n\n* Bar\n.\nEntries"
516 changes = self.generateChanges(changelog=changelog)
517 contents = changes.dump(encoding="utf-8").encode("utf-8")
518 # Read contents back
519 read_changes = Changes(contents)
520 self.assertEquals("\n%s" % changelog, changes['Changes'])
521 self.assertContentEqual([
522 'Architecture',
523 'Binary',
524 'Changed-By',
525 'Changes',
526 'Date',
527 'Distribution',
528 'Files',
529 'Format',
530 'Maintainer',
531 'Origin',
532 'Source',
533 'Urgency',
534 'Version',
535 ], read_changes.keys())
510536
511def test_suite():537def test_suite():
512 return TestLoader().loadTestsFromName(__name__)538 return TestLoader().loadTestsFromName(__name__)