← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/archive-copypackages-pocket into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/archive-copypackages-pocket into lp:launchpad.

Commit message:
Fix Archive.copyPackages to respect the to_pocket parameter.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1068616 in Launchpad itself: "Archive.copyPackages hardcodes RELEASE pocket"
  https://bugs.launchpad.net/launchpad/+bug/1068616

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/archive-copypackages-pocket/+merge/130544

== Summary ==

Bug 1068616: Archive.copyPackages accepts a to_pocket parameter, faithfully checks it for permissions, and then completely ignores it and hardcodes the RELEASE pocket instead.

== Proposed fix ==

Remove pointless hardcoding and actually use the supplied parameter.

== LOC Rationale ==

+16.  I have ~5700 lines of credit and more to come soon, so I'd like to trade a little of that off against a fix that's going to be rather important for Ubuntu auto-syncs very soon (as we'd like to start auto-syncing into -proposed, once we have the infrastructure ready for that; this should make a big difference to the ongoing usability of our development release).

== Tests ==

bin/test -vvct test_archive.TestCopyPackage

== Demo and Q/A ==

Run Archive.copyPackages of some package or other from Debian unstable into quantal-proposed on qastaging, and verify that the PCJ actually puts the package there.

== Lint ==

Just one false positive:

./lib/lp/soyuz/model/archive.py
     346: redefinition of function 'private' from line 342
-- 
https://code.launchpad.net/~cjwatson/launchpad/archive-copypackages-pocket/+merge/130544
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/archive-copypackages-pocket into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2012-10-02 16:41:14 +0000
+++ lib/lp/soyuz/model/archive.py	2012-10-19 13:20:31 +0000
@@ -1709,7 +1709,7 @@
                 from_archive,
                 self,
                 series if series is not None else source.distroseries,
-                PackagePublishingPocket.RELEASE
+                pocket,
                 )
             copy_tasks.append(task)
 

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2012-10-02 16:04:43 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2012-10-19 13:20:31 +0000
@@ -2603,6 +2603,22 @@
                 [source_name], target_archive, to_pocket.name,
                 target_archive.owner)
 
+    def test_copyPackages_to_pocket(self):
+        # copyPackages respects the to_pocket parameter.
+        (source, source_archive, source_name, target_archive, to_pocket,
+         to_series, version) = self._setup_copy_data(
+            target_purpose=ArchivePurpose.PRIMARY)
+        to_pocket = PackagePublishingPocket.PROPOSED
+        person = self.factory.makePerson()
+        with person_logged_in(target_archive.distribution.owner):
+            target_archive.newComponentUploader(person, "universe")
+        target_archive.copyPackages(
+            [source_name], source_archive, to_pocket.name,
+            to_series=to_series.name, include_binaries=False, person=person)
+        job_source = getUtility(IPlainPackageCopyJobSource)
+        copy_job = job_source.getActiveJobs(target_archive).one()
+        self.assertEqual(to_pocket, copy_job.target_pocket)
+
 
 class TestgetAllPublishedBinaries(TestCaseWithFactory):
 


Follow ups