← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/635591-sync-source-unicode into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code
Related bugs:
  #635591 Regression: syncing packages with UTF-8 changelogs fails
  https://bugs.launchpad.net/bugs/635591


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.
-- 
https://code.launchpad.net/~jelmer/launchpad/635591-sync-source-unicode/+merge/35715
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/635591-sync-source-unicode into lp:launchpad/devel.
=== 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 18:49:51 +0000
@@ -1464,7 +1464,6 @@
         changes["Closes"] = " ".join(closes)
     if lp_closes:
         changes["Launchpad-bugs-fixed"] = " ".join(lp_closes)
-    changes["Changes"] = "\n%s" % changelog
     files = []
     for filename in dsc_files:
         if filename in files_from_librarian:
@@ -1477,4 +1476,5 @@
                      })
 
     changes["Files"] = files
+    changes["Changes"] = "\n%s" % changelog
     return changes

=== 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 18:49:51 +0000
@@ -5,7 +5,9 @@
 
 __metaclass__ = type
 
+from cStringIO import StringIO
 from debian.deb822 import (
+    Changes,
     Deb822Dict,
     Dsc,
     )
@@ -507,6 +509,31 @@
         self.assertIn(
             "Updated French translation by J\xc3\xa9lmer.", contents)
 
+    def test_changelog_whitelines(self):
+        # The changelog entry can contain empty lines, and this should not
+        # mess up the parsing of the changes file.
+        changelog = "* Foo\n\n\n* Bar\n.\nEntries"
+        changes = self.generateChanges(changelog=changelog)
+        contents = changes.dump(encoding="utf-8").encode("utf-8")
+        # Read contents back
+        read_changes = Changes(StringIO(
+            changes.dump(encoding="utf-8").encode("utf-8")))
+        self.assertEquals("\n%s" % changelog, changes['Changes'])
+        self.assertContentEqual([
+            'Architecture',
+            'Binary',
+            'Changed-By',
+            'Changes',
+            'Date',
+            'Distribution',
+            'Files',
+            'Format',
+            'Maintainer',
+            'Origin',
+            'Source',
+            'Urgency',
+            'Version',
+            ], read_changes.keys())
 
 def test_suite():
     return TestLoader().loadTestsFromName(__name__)


Follow ups