← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/queue-bug-830983 into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/queue-bug-830983 into lp:launchpad with lp:~rvb/launchpad/ids-fix as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #830983 in Launchpad itself: "Queue.getBuildsForSources should also filter the builds by distroseries."
  https://bugs.launchpad.net/launchpad/+bug/830983

For more details, see:
https://code.launchpad.net/~rvb/launchpad/queue-bug-830983/+merge/72406

This branch fixes how we check for builds in lib/lp/soyuz/model/queue.py getBuildsForSources to only check inside the given distroseries.

= Tests =

./bin/test -vvc test_initialize_distroseries  test_check_success_with_build_in_other_series

= QA =

I'll land this with no-qa because the QA for this will be part of the QA in progress for 820452.
-- 
https://code.launchpad.net/~rvb/launchpad/queue-bug-830983/+merge/72406
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/queue-bug-830983 into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2011-08-16 16:11:16 +0000
+++ lib/lp/soyuz/model/queue.py	2011-08-22 11:05:25 +0000
@@ -1446,13 +1446,12 @@
                             names=None):
         """See `IPackageUploadSet`."""
         # Avoiding circular imports.
-        from lp.registry.model.distroseries import DistroSeries
         from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
         from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
 
         archives = distroseries.distribution.getArchiveIDList()
         clauses = [
-            DistroSeries.id == PackageUpload.distroseriesID,
+            PackageUpload.distroseries == distroseries,
             PackageUpload.archiveID.is_in(archives),
             PackageUploadBuild.packageuploadID == PackageUpload.id,
             ]

=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2011-08-22 11:05:25 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2011-08-22 11:05:25 +0000
@@ -265,6 +265,22 @@
              "see help text for more information."),
             ids.check)
 
+    def test_check_success_with_build_in_other_series(self):
+        # Builds in the child's archive but in another series do not
+        # prevent the initialization of child.
+        parent, unused = self.setupParent()
+        other_series, unused = self.setupParent(
+            distribution=parent.distribution)
+        upload = other_series.createQueueEntry(
+            PackagePublishingPocket.RELEASE,
+            other_series.main_archive, 'foo.changes', 'bar')
+        # Create a binary package upload for this upload.
+        upload.addBuild(self.factory.makeBinaryPackageBuild())
+        child = self.factory.makeDistroSeries()
+        ids = InitializeDistroSeries(child, [parent.id])
+
+        self.assertTrue(ids.check())
+
     def test_check_success_with_pending_builds_in_other_arches(self):
         # We only check for pending builds of the same architectures we're
         # copying over from the parents. If *no* build is present in the