← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/pu-getFileByName-binary into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/pu-getFileByName-binary into lp:launchpad.

Commit message:
Implement proxying of PackageUpload binary files via the webapp, since DistroSeries:+queue now assumes that that works.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1697680 in Launchpad itself: "Can't access binaries in NEW queue (source packages assets are fine though)"
  https://bugs.launchpad.net/launchpad/+bug/1697680

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/pu-getFileByName-binary/+merge/325564
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/pu-getFileByName-binary into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2016-05-26 14:53:06 +0000
+++ lib/lp/soyuz/model/queue.py	2017-06-13 12:46:46 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -305,6 +305,12 @@
             except NotFoundError:
                 pass
 
+        for build in self.builds:
+            try:
+                return build.build.getFileByName(filename)
+            except NotFoundError:
+                pass
+
         custom = Store.of(self).find(
             PackageUploadCustom,
             PackageUploadCustom.packageupload == self.id,

=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py	2017-01-14 00:19:57 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py	2017-06-13 12:46:46 +0000
@@ -374,6 +374,18 @@
             'Rejected:\nRejected by %s: Because.' % person.displayname,
             str(msg))
 
+    def test_getFileByName_source(self):
+        self.test_publisher.prepareBreezyAutotest()
+        upload, _ = self.makeSourcePackageUpload()
+        spr = upload.sourcepackagerelease
+        upload.getFileByName("%s_%s.dsc" % (spr.name, spr.version))
+
+    def test_getFileByName_binary(self):
+        self.test_publisher.prepareBreezyAutotest()
+        upload, _ = self.makeBuildPackageUpload()
+        bpr = upload.builds[0].build.binarypackages[0]
+        upload.getFileByName("%s_%s_i386.deb" % (bpr.name, bpr.version))
+
 
 class TestPackageUploadSecurity(TestCaseWithFactory):
     """Test PackageUpload security."""


Follow ups