← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/overrides-arch-indep into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/overrides-arch-indep into lp:launchpad with lp:~wgrant/launchpad/overrides-dicts as a prerequisite.

Commit message:
FromExistingOverridePolicy.calculateBinaryOverrides now returns None as the archtag for arch-indep requests, not the nominatedarchindep archtag.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/overrides-arch-indep/+merge/227499

FromExistingOverridePolicy.calculateBinaryOverrides now returns None as the archtag for arch-indep requests, not the nominatedarchindep archtag.
-- 
https://code.launchpad.net/~wgrant/launchpad/overrides-arch-indep/+merge/227499
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/overrides-arch-indep into lp:launchpad.
=== modified file 'lib/lp/soyuz/adapters/overrides.py'
--- lib/lp/soyuz/adapters/overrides.py	2014-07-21 06:41:57 +0000
+++ lib/lp/soyuz/adapters/overrides.py	2014-07-21 06:41:57 +0000
@@ -278,13 +278,20 @@
                 (BinaryPackageName, DistroArchSeries, Component, Section,
                 None)),
             pre_iter_hook=eager_load)
-        # XXX: This should return None for arch-indep, not the
-        # nominatedarchindep archtag.
-        return dict(
-            ((name, das.architecturetag), BinaryOverride(
-                component=component, section=section, priority=priority,
-                phased_update_percentage=self.phased_update_percentage))
-            for name, das, component, section, priority in already_published)
+        overrides = {}
+        for name, das, component, section, priority in already_published:
+            # These details can always fulfill their own archtag, and may
+            # satisfy a None archtag if the DAS is nominatedarchindep.
+            matching_keys = [(name, das.architecturetag)]
+            if das == das.distroseries.nominatedarchindep:
+                matching_keys.append((name, None))
+            for key in matching_keys:
+                if key not in binaries:
+                    continue
+                overrides[key] = BinaryOverride(
+                    component=component, section=section, priority=priority,
+                    phased_update_percentage=self.phased_update_percentage)
+        return overrides
 
 
 class UnknownOverridePolicy(BaseOverridePolicy):

=== modified file 'lib/lp/soyuz/adapters/tests/test_overrides.py'
--- lib/lp/soyuz/adapters/tests/test_overrides.py	2014-07-21 06:41:57 +0000
+++ lib/lp/soyuz/adapters/tests/test_overrides.py	2014-07-21 06:41:57 +0000
@@ -3,8 +3,6 @@
 
 """Test generic override policy classes."""
 
-from operator import attrgetter
-
 from testtools.matchers import Equals
 from zope.component import getUtility
 
@@ -118,7 +116,8 @@
 
     def test_binary_overrides(self):
         # When a binary is published in the given distroarchseries, the
-        # overrides are returned.
+        # overrides are returned. None means nominatedarchindep,
+        # whatever that is in the target series.
         distroseries = self.factory.makeDistroSeries()
         bpph1 = self.factory.makeBinaryPackagePublishingHistory(
             archive=distroseries.main_archive,
@@ -134,6 +133,8 @@
               bpph1.distroarchseries.architecturetag): BinaryOverride(),
              (bpph2.binarypackagerelease.binarypackagename,
               bpph2.distroarchseries.architecturetag): BinaryOverride(),
+             (bpph2.binarypackagerelease.binarypackagename, None):
+                BinaryOverride(),
              })
         expected = {
             (bpph1.binarypackagerelease.binarypackagename,
@@ -146,6 +147,10 @@
                 BinaryOverride(
                     component=bpph2.component, section=bpph2.section,
                     priority=bpph2.priority),
+            (bpph2.binarypackagerelease.binarypackagename, None):
+                BinaryOverride(
+                    component=bpph2.component, section=bpph2.section,
+                    priority=bpph2.priority),
             }
         self.assertEqual(expected, overrides)
 


Follow ups