launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17293
[Merge] lp:~wgrant/launchpad/overrides-from-parent into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/overrides-from-parent into lp:launchpad.
Commit message:
Derived series inherit their parents' overrides if DSP.inherit_overrides is set.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/overrides-from-parent/+merge/229447
If there is a DistroSeriesParent with inherit_overrides set, the derived series' primary archive should fall back to the parent series' overrides before using its own defaults.
This will let ubuntu-rtm's packages end up in the right component rather than all universe.
--
https://code.launchpad.net/~wgrant/launchpad/overrides-from-parent/+merge/229447
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/overrides-from-parent into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2014-08-01 09:48:48 +0000
+++ lib/lp/soyuz/model/archive.py 2014-08-04 12:57:25 +0000
@@ -63,6 +63,7 @@
)
from lp.registry.errors import NoSuchDistroSeries
from lp.registry.interfaces.distroseries import IDistroSeriesSet
+from lp.registry.interfaces.distroseriesparent import IDistroSeriesParentSet
from lp.registry.interfaces.person import (
IPersonSet,
validate_person,
@@ -2075,6 +2076,28 @@
# understandiung EnumItems.
return list(PackagePublishingPocket.items)
+ def _getExistingOverrideSequence(self, archive, distroseries, pocket,
+ phased_update_percentage):
+ from lp.soyuz.adapters.overrides import (
+ FromExistingOverridePolicy,
+ )
+ return [
+ FromExistingOverridePolicy(
+ archive, distroseries, None,
+ phased_update_percentage=phased_update_percentage),
+ FromExistingOverridePolicy(
+ archive, distroseries, None,
+ phased_update_percentage=phased_update_percentage,
+ any_arch=True),
+ FromExistingOverridePolicy(
+ archive, distroseries, None,
+ phased_update_percentage=phased_update_percentage,
+ include_deleted=True),
+ FromExistingOverridePolicy(
+ archive, distroseries, None,
+ phased_update_percentage=phased_update_percentage,
+ include_deleted=True, any_arch=True)]
+
def getOverridePolicy(self, distroseries, pocket,
phased_update_percentage=None):
"""See `IArchive`."""
@@ -2082,7 +2105,6 @@
from lp.soyuz.adapters.overrides import (
ConstantOverridePolicy,
FallbackOverridePolicy,
- FromExistingOverridePolicy,
FromSourceOverridePolicy,
UnknownOverridePolicy,
)
@@ -2090,23 +2112,23 @@
# If there's no matching live publication, fall back to
# other archs, then to matching but deleted, then to deleted
# on other archs, then to archive-specific defaults.
- policies = [
- FromExistingOverridePolicy(
- self, distroseries, None,
- phased_update_percentage=phased_update_percentage),
- FromExistingOverridePolicy(
- self, distroseries, None,
- phased_update_percentage=phased_update_percentage,
- any_arch=True),
- FromExistingOverridePolicy(
- self, distroseries, None,
- phased_update_percentage=phased_update_percentage,
- include_deleted=True),
- FromExistingOverridePolicy(
- self, distroseries, None,
- phased_update_percentage=phased_update_percentage,
- include_deleted=True, any_arch=True)]
+ policies = self._getExistingOverrideSequence(
+ self, distroseries, None,
+ phased_update_percentage=phased_update_percentage)
if self.is_primary:
+ # If there are any parent relationships with
+ # inherit_overrides set, run through those before using
+ # defaults.
+ parents = [
+ dsp.parent_series for dsp in
+ getUtility(IDistroSeriesParentSet).getByDerivedSeries(
+ distroseries)
+ if dsp.inherit_overrides]
+ for parent in parents:
+ policies.extend(self._getExistingOverrideSequence(
+ parent.main_archive, parent, None,
+ phased_update_percentage=phased_update_percentage))
+
policies.extend([
FromSourceOverridePolicy(
phased_update_percentage=phased_update_percentage),
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2014-08-01 09:48:48 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2014-08-04 12:57:25 +0000
@@ -3497,6 +3497,27 @@
policy.calculateBinaryOverrides(
{(bpn, 'armhf'): BinaryOverride()}))
+ def test_primary_inherit_from_parent(self):
+ dsp = self.factory.makeDistroSeriesParent(inherit_overrides=False)
+ child = dsp.derived_series
+ parent = dsp.parent_series
+ spph = self.factory.makeSourcePackagePublishingHistory(
+ archive=parent.main_archive, distroseries=parent)
+
+ overrides = child.main_archive.getOverridePolicy(
+ child, None).calculateSourceOverrides(
+ {spph.sourcepackagename: SourceOverride()})
+ self.assertNotEqual(
+ spph.component, overrides[spph.sourcepackagename].component)
+
+ with admin_logged_in():
+ child.inherit_overrides_from_parents = True
+ overrides = child.main_archive.getOverridePolicy(
+ child, None).calculateSourceOverrides(
+ {spph.sourcepackagename: SourceOverride()})
+ self.assertEqual(
+ spph.component, overrides[spph.sourcepackagename].component)
+
def test_ppa_sources(self):
ppa = self.factory.makeArchive(
distribution=self.series.distribution,
Follow ups