← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/control-tar-xz into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/control-tar-xz into lp:launchpad.

Commit message:
Accept .debs containing control.tar.xz.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1640280 in Launchpad itself: "Support Ubuntu uploads of .debs using control.tar.xz"
  https://bugs.launchpad.net/launchpad/+bug/1640280

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/control-tar-xz/+merge/310364
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/control-tar-xz into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/nascentuploadfile.py'
--- lib/lp/archiveuploader/nascentuploadfile.py	2016-05-31 12:45:18 +0000
+++ lib/lp/archiveuploader/nascentuploadfile.py	2016-11-08 20:32:48 +0000
@@ -722,10 +722,10 @@
             yield UploadError(
                 "%s: first chunk is %s, expected debian-binary." % (
                 self.filename, debian_binary))
-        if control_tar != "control.tar.gz":
+        if control_tar not in ("control.tar.gz", "control.tar.xz"):
             yield UploadError(
-                "%s: second chunk is %s, expected control.tar.gz." % (
-                self.filename, control_tar))
+                "%s: second chunk is %s, expected control.tar.gz or "
+                "control.tar.xz." % (self.filename, control_tar))
         if data_tar not in ("data.tar.gz", "data.tar.bz2", "data.tar.lzma",
                             "data.tar.xz"):
             yield UploadError(

=== modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py'
--- lib/lp/archiveuploader/tests/test_nascentuploadfile.py	2016-05-09 18:05:06 +0000
+++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py	2016-11-08 20:32:48 +0000
@@ -360,13 +360,13 @@
                 "protocols",
             }
 
-    def createDeb(self, filename, data_format, members=None):
+    def createDeb(self, filename, control_format, data_format, members=None):
         """Return the contents of a dummy .deb file."""
         tempdir = self.makeTemporaryDirectory()
         if members is None:
             members = [
                 "debian-binary",
-                "control.tar.gz",
+                "control.tar.%s" % control_format,
                 "data.tar.%s" % data_format,
                 ]
         for member in members:
@@ -379,10 +379,13 @@
 
     def createDebBinaryUploadFile(self, filename, component_and_section,
                                   priority_name, package, version, changes,
-                                  data_format=None, members=None):
+                                  control_format=None, data_format=None,
+                                  members=None):
         """Create a DebBinaryUploadFile."""
-        if data_format is not None or members is not None:
-            data = self.createDeb(filename, data_format, members=members)
+        if (control_format is not None or data_format is not None or
+                members is not None):
+            data = self.createDeb(
+                filename, control_format, data_format, members=members)
         else:
             data = "DUMMY DATA"
         (path, md5, sha1, size) = self.writeUploadFile(filename, data)
@@ -408,11 +411,20 @@
         self.assertEquals("0.42", uploadfile.source_version)
         self.assertEquals("0.42", uploadfile.control_version)
 
-    def test_verifyFormat_xz(self):
-        # verifyFormat accepts xz-compressed .debs.
-        uploadfile = self.createDebBinaryUploadFile(
-            "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
-            None, data_format="xz")
+    def test_verifyFormat_control_xz(self):
+        # verifyFormat accepts .debs with an xz-compressed control member.
+        uploadfile = self.createDebBinaryUploadFile(
+            "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
+            None, control_format="xz", data_format="gz")
+        control = self.getBaseControl()
+        uploadfile.parseControl(control)
+        self.assertEqual([], list(uploadfile.verifyFormat()))
+
+    def test_verifyFormat_data_xz(self):
+        # verifyFormat accepts .debs with an xz-compressed data member.
+        uploadfile = self.createDebBinaryUploadFile(
+            "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
+            None, control_format="gz", data_format="xz")
         control = self.getBaseControl()
         uploadfile.parseControl(control)
         self.assertEqual([], list(uploadfile.verifyFormat()))


Follow ups