← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/non-ubuntu-ppas-model into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/non-ubuntu-ppas-model into lp:launchpad.

Commit message:
Basic model support for the new Distribution and DistroSeriesParent flags for derived distributions.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/non-ubuntu-ppas-model/+merge/229044

Basic model support for the new Distribution and DistroSeriesParent flags for derived distributions.

DistroSeriesParent.inherit_overrides is false everywhere on production now, while the three new Distribution flags are true for Ubuntu to match the previously hardcoded behaviour.
-- 
https://code.launchpad.net/~wgrant/launchpad/non-ubuntu-ppas-model/+merge/229044
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/non-ubuntu-ppas-model into lp:launchpad.
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2014-07-08 22:31:49 +0000
+++ lib/lp/registry/configure.zcml	2014-07-31 14:00:23 +0000
@@ -268,9 +268,15 @@
 
         <require
             permission="launchpad.Edit"
-            set_attributes="displayname title summary description driver
-                            backports_not_automatic
-                            include_long_descriptions"/>
+            set_attributes="
+                displayname
+                title
+                summary
+                description
+                driver
+                backports_not_automatic
+                include_long_descriptions
+                inherit_overrides_from_parents"/>
 
         <!-- NB: check with SABDFL before modifying these, there is potential to
                                  make a huge mess if these get changed and Soyuz has to republish
@@ -1731,6 +1737,12 @@
                 summary
                 title"/>
         <require
+            permission="launchpad.Admin"
+            set_attributes="
+                official_packages
+                supports_mirrors
+                supports_ppas"/>
+        <require
             permission="launchpad.BugSupervisor"
             set_attributes="
                 official_bug_tags"/>

=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py	2014-07-07 03:59:38 +0000
+++ lib/lp/registry/interfaces/distribution.py	2014-07-31 14:00:23 +0000
@@ -309,12 +309,17 @@
                 "in the context of the currentseries.")),
         exported_as="current_series")
 
-    supports_mirrors = Attribute(
-        "Whether we enable mirror management functionality for this "
-        "distribution")
-
-    official_packages = Attribute(
-        "Whether Launchpad manages this distribution's packages itself.")
+    official_packages = exported(Bool(
+        title=_("Packages are tracked in Launchpad"),
+        readonly=False, required=True))
+
+    supports_ppas = exported(Bool(
+        title=_("Enable PPA creation and publication"),
+        readonly=False, required=True))
+
+    supports_mirrors = exported(Bool(
+        title=_("Enable mirror listings and probes"),
+        readonly=False, required=True))
 
     translation_focus = Choice(
         title=_("Translation focus"),

=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py	2013-09-10 06:28:26 +0000
+++ lib/lp/registry/interfaces/distroseries.py	2014-07-31 14:00:23 +0000
@@ -376,6 +376,10 @@
                 on clients, which requires downloading Packages files for
                 multiple architectures.""")))
 
+    inherit_overrides_from_parents = Bool(
+        title=_("Inherit overrides from parents"),
+        readonly=False, required=True)
+
     main_archive = exported(
         Reference(
             Interface,  # Really IArchive, see below for circular import fix.

=== modified file 'lib/lp/registry/interfaces/distroseriesparent.py'
--- lib/lp/registry/interfaces/distroseriesparent.py	2013-01-07 02:40:55 +0000
+++ lib/lp/registry/interfaces/distroseriesparent.py	2014-07-31 14:00:23 +0000
@@ -46,6 +46,12 @@
         title=_("Is this relationship an overlay?"), required=True,
         default=False)
 
+    inherit_overrides = Bool(
+        title=_("Inherit overrides"), required=True, default=False,
+        description=_(
+            "Should package overrides fall back to the parent series if "
+            "they're unset in the derived series?"))
+
     pocket = Choice(
         title=_("The pocket for this overlay"), required=False,
         vocabulary=PackagePublishingPocket)
@@ -66,7 +72,7 @@
     """`DistroSeriesParentSet` interface."""
 
     def new(derived_series, parent_series, initialized, is_overlay=False,
-            pocket=None, component=None, ordering=1):
+            pocket=None, component=None, ordering=1, inherit_overrides=False):
         """Create a new `DistroSeriesParent`."""
 
     def getByDerivedSeries(derived_series):

=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py	2014-07-07 03:59:38 +0000
+++ lib/lp/registry/model/distribution.py	2014-07-31 14:00:23 +0000
@@ -33,10 +33,7 @@
 from storm.info import ClassAlias
 from storm.store import Store
 from zope.component import getUtility
-from zope.interface import (
-    alsoProvides,
-    implements,
-    )
+from zope.interface import implements
 
 from lp.answers.enums import QUESTION_STATUS_DEFAULT_SEARCH
 from lp.answers.interfaces.faqtarget import IFAQTarget
@@ -242,6 +239,9 @@
         dbName='translationpermission', notNull=True,
         schema=TranslationPermission, default=TranslationPermission.OPEN)
     active = True
+    official_packages = BoolCol(notNull=True, default=False)
+    supports_ppas = BoolCol(notNull=True, default=False)
+    supports_mirrors = BoolCol(notNull=True, default=False)
     package_derivatives_email = StringCol(notNull=False, default=None)
     redirect_release_uploads = BoolCol(notNull=True, default=False)
     development_series_alias = StringCol(notNull=False, default=None)
@@ -527,19 +527,6 @@
             official_candidate=True)
 
     @property
-    def full_functionality(self):
-        """See `IDistribution`."""
-        return self.name == u'ubuntu'
-
-    @property
-    def supports_mirrors(self):
-        return self.full_functionality
-
-    @property
-    def official_packages(self):
-        return self.full_functionality
-
-    @property
     def drivers(self):
         """See `IDistribution`."""
         if self.driver is not None:

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py	2014-07-10 12:40:43 +0000
+++ lib/lp/registry/model/distroseries.py	2014-07-31 14:00:23 +0000
@@ -380,6 +380,24 @@
             DistroArchSeries.processor_id == processor.id).one()
 
     @property
+    def inherit_overrides_from_parents(self):
+        from lp.registry.interfaces.distroseriesparent import (
+            IDistroSeriesParentSet,
+            )
+        return any(
+            dsp.inherit_overrides for dsp in
+            getUtility(IDistroSeriesParentSet).getByDerivedSeries(self))
+
+    @inherit_overrides_from_parents.setter
+    def inherit_overrides_from_parents(self, value):
+        from lp.registry.interfaces.distroseriesparent import (
+            IDistroSeriesParentSet,
+            )
+        dsps = getUtility(IDistroSeriesParentSet).getByDerivedSeries(self)
+        for dsp in dsps:
+            dsp.inherit_overrides = value
+
+    @property
     def enabled_architectures(self):
         return Store.of(self).find(
             DistroArchSeries,

=== modified file 'lib/lp/registry/model/distroseriesparent.py'
--- lib/lp/registry/model/distroseriesparent.py	2013-06-20 05:50:00 +0000
+++ lib/lp/registry/model/distroseriesparent.py	2014-07-31 14:00:23 +0000
@@ -47,6 +47,7 @@
     initialized = Bool(allow_none=False)
 
     is_overlay = Bool(allow_none=False, default=False)
+    inherit_overrides = Bool(allow_none=False, default=False)
 
     pocket = EnumCol(
         dbName='pocket', notNull=False,
@@ -64,7 +65,8 @@
     title = "Cross reference of parent and derived distroseries."
 
     def new(self, derived_series, parent_series, initialized,
-            is_overlay=False, pocket=None, component=None, ordering=1):
+            is_overlay=False, inherit_overrides=False, pocket=None,
+            component=None, ordering=1):
         """Make and return a new `DistroSeriesParent`."""
         store = IMasterStore(DistroSeriesParent)
         dsp = DistroSeriesParent()
@@ -72,6 +74,7 @@
         dsp.parent_series = parent_series
         dsp.initialized = initialized
         dsp.is_overlay = is_overlay
+        dsp.inherit_overrides = inherit_overrides
         dsp.pocket = pocket
         dsp.component = component
         dsp.ordering = ordering

=== modified file 'lib/lp/registry/stories/webservice/xx-distribution.txt'
--- lib/lp/registry/stories/webservice/xx-distribution.txt	2013-08-01 14:16:15 +0000
+++ lib/lp/registry/stories/webservice/xx-distribution.txt	2014-07-31 14:00:23 +0000
@@ -45,6 +45,7 @@
     mugshot_link: u'http://.../ubuntu/mugshot'
     name: u'ubuntu'
     official_bug_tags: []
+    official_packages: True
     owner_link: u'http://.../~ubuntu-team'
     redirect_release_uploads: False
     registrant_link: u'http://.../~registry'
@@ -52,6 +53,8 @@
     self_link: u'http://.../ubuntu'
     series_collection_link: u'http://.../ubuntu/series'
     summary: u'Ubuntu is a new approach to Linux Distribution...'
+    supports_mirrors: True
+    supports_ppas: True
     title: u'Ubuntu Linux'
     web_link: u'http://launchpad.../ubuntu'
 

=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py	2014-07-09 01:18:27 +0000
+++ lib/lp/registry/tests/test_distroseries.py	2014-07-31 14:00:23 +0000
@@ -247,6 +247,27 @@
         self.factory.makeDistroSeriesParent(derived_series=distroseries)
         self.assertTrue(distroseries.isDerivedSeries())
 
+    def test_inherit_overrides_from_parents(self):
+        # inherit_overrides_from_parents is an accessor which maps to
+        # all of the series' DistroSeriesParent.inherit_overrides, for
+        # UI simplicity for now.
+        distroseries = self.factory.makeDistroSeries()
+        dsp1 = self.factory.makeDistroSeriesParent(
+            derived_series=distroseries, inherit_overrides=True)
+        dsp2 = self.factory.makeDistroSeriesParent(
+            derived_series=distroseries, inherit_overrides=False)
+        self.assertEqual(True, distroseries.inherit_overrides_from_parents)
+        with person_logged_in(distroseries.distribution.owner):
+            distroseries.inherit_overrides_from_parents = False
+        self.assertEqual(False, dsp1.inherit_overrides)
+        self.assertEqual(False, dsp2.inherit_overrides)
+        self.assertEqual(False, distroseries.inherit_overrides_from_parents)
+        with person_logged_in(distroseries.distribution.owner):
+            distroseries.inherit_overrides_from_parents = True
+        self.assertEqual(True, dsp1.inherit_overrides)
+        self.assertEqual(True, dsp2.inherit_overrides)
+        self.assertEqual(True, distroseries.inherit_overrides_from_parents)
+
     def test_isInitializing(self):
         # The series method isInitializing() returns True only if there is an
         # initialization job with a pending status attached to this series.

=== modified file 'lib/lp/registry/tests/test_distroseriesparent.py'
--- lib/lp/registry/tests/test_distroseriesparent.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/tests/test_distroseriesparent.py	2014-07-31 14:00:23 +0000
@@ -45,7 +45,8 @@
         dsp = self.factory.makeDistroSeriesParent(
             derived_series=derived_series,
             parent_series=parent_series,
-            initialized=True)
+            initialized=True,
+            inherit_overrides=True)
 
         self.assertThat(
             dsp,
@@ -54,6 +55,7 @@
                 parent_series=parent_series,
                 initialized=True,
                 is_overlay=False,
+                inherit_overrides=True,
                 component=None,
                 pocket=None,
                 ))
@@ -79,6 +81,7 @@
                 parent_series=parent_series,
                 initialized=True,
                 is_overlay=True,
+                inherit_overrides=False,
                 component=universe_component,
                 pocket=PackagePublishingPocket.SECURITY,
                 ))

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2014-07-18 07:43:06 +0000
+++ lib/lp/testing/factory.py	2014-07-31 14:00:23 +0000
@@ -2617,14 +2617,15 @@
 
     def makeDistroSeriesParent(self, derived_series=None, parent_series=None,
                                initialized=False, is_overlay=False,
-                               pocket=None, component=None):
+                               inherit_overrides=False, pocket=None,
+                               component=None):
         if parent_series is None:
             parent_series = self.makeDistroSeries()
         if derived_series is None:
             derived_series = self.makeDistroSeries()
         return getUtility(IDistroSeriesParentSet).new(
-            derived_series, parent_series, initialized, is_overlay, pocket,
-            component)
+            derived_series, parent_series, initialized, is_overlay,
+            inherit_overrides, pocket, component)
 
     def makeDistroArchSeries(self, distroseries=None,
                              architecturetag=None, processor=None,


Follow ups