← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/launchpad/disable-arch-bug-633139 into lp:launchpad

 

Julian Edwards has proposed merging lp:~julian-edwards/launchpad/disable-arch-bug-633139 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


= Summary =
Add an "enabled" flag on the distroarchseries admin page.

== Proposed fix ==
It's a simple form change.

== Pre-implementation notes ==
The Ubuntu team wanted to delete ia64 and sparc in maverick.  We did this for lpia in hardy but with the new data model that includes recipes, the SQL to do this now is quite a lot harder - and *riskier*.

So, I discussed with LaMont about disabling the DAS instead, so that new builds are not created and more importantly nothing gets published in those disabled arches.

== Implementation details ==
This branch is the first part of the change and includes the UI change only.

== Tests ==
bin/test -cvv test_distroarchseries_view

== Demo and Q/A ==
make run
visit https://launchpad.dev/ubuntu/hoary/i386/+admin


= Launchpad lint =
Bogus lint deleted.  Sigh.
-- 
https://code.launchpad.net/~julian-edwards/launchpad/disable-arch-bug-633139/+merge/35072
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/disable-arch-bug-633139 into lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/distroarchseries.py'
--- lib/lp/soyuz/browser/distroarchseries.py	2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/distroarchseries.py	2010-09-10 10:42:55 +0000
@@ -124,7 +124,8 @@
     schema = IDistroArchSeries
 
     field_names = [
-        'architecturetag', 'official', 'supports_virtualized'
+        'architecturetag', 'official', 'supports_virtualized',
+        'enabled',
         ]
 
     @action(_('Change'), name='update')

=== added file 'lib/lp/soyuz/browser/tests/test_distroarchseries_view.py'
--- lib/lp/soyuz/browser/tests/test_distroarchseries_view.py	1970-01-01 00:00:00 +0000
+++ lib/lp/soyuz/browser/tests/test_distroarchseries_view.py	2010-09-10 10:42:55 +0000
@@ -0,0 +1,51 @@
+# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from canonical.launchpad.ftests import login
+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
+from canonical.testing import LaunchpadFunctionalLayer
+from lp.soyuz.browser.distroarchseries import DistroArchSeriesAdminView
+from lp.testing import TestCaseWithFactory
+from lp.testing.sampledata import LAUNCHPAD_ADMIN
+
+
+class TestDistroArchSeriesView(TestCaseWithFactory):
+
+    layer = LaunchpadFunctionalLayer
+
+    def setUp(self):
+        """Create a distroarchseries for the tests and login as an admin."""
+        super(TestDistroArchSeriesView, self).setUp()
+        self.das = self.factory.makeDistroArchSeries()
+        # Login as an admin to ensure access to the view's context
+        # object.
+        login(LAUNCHPAD_ADMIN)
+
+    def initialize_admin_view(self, enabled=True):
+        # Initialize the admin view with the supplied params.
+        method = 'POST'
+        form = {
+            'field.actions.update': 'update',
+            }
+
+        if enabled:
+            form['field.enabled'] = 'on'
+        else:
+            form['field.enabled'] = 'off'
+
+        view = DistroArchSeriesAdminView(
+            self.das, LaunchpadTestRequest(method=method, form=form))
+        view.initialize()
+        return view
+
+    def test_enabling_enabled_flag(self):
+        view = self.initialize_admin_view(enabled=False)
+        self.assertEqual(0, len(view.errors))
+        self.assertFalse(view.context.enabled)
+
+    def test_disabling_enabled_flag(self):
+        view = self.initialize_admin_view(enabled=True)
+        self.assertEqual(0, len(view.errors))
+        self.assertTrue(view.context.enabled)

=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
--- lib/lp/soyuz/doc/distroarchseries.txt	2010-07-20 09:36:17 +0000
+++ lib/lp/soyuz/doc/distroarchseries.txt	2010-09-10 10:42:55 +0000
@@ -25,6 +25,16 @@
 #      This needs many more tests to be effective.
 
 
+Properties
+==========
+
+Enabled is a boolean flag that says whether the arch will receive new builds
+and publish them.
+
+    >>> print hoary_i386.enabled
+    True
+
+
 DistroArchSeries can tell you about their published releases
 ============================================================
 

=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
--- lib/lp/soyuz/interfaces/distroarchseries.py	2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/interfaces/distroarchseries.py	2010-09-10 10:42:55 +0000
@@ -83,6 +83,12 @@
             description=_("Indicate whether or not this port has support "
                           "for building PPA packages."),
             required=False))
+    enabled = Bool(
+        title=_("Enabled"),
+        description=_(
+            "Whether or not this DistroArchSeries is enabled for build "
+            "creation and publication."),
+        required=False, readonly=False)
 
     # Joins.
     packages = Attribute('List of binary packages in this port.')

=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py	2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/model/distroarchseries.py	2010-09-10 10:42:55 +0000
@@ -82,6 +82,7 @@
         storm_validator=validate_public_person, notNull=True)
     package_count = IntCol(notNull=True, default=DEFAULT)
     supports_virtualized = BoolCol(notNull=False, default=False)
+    enabled = BoolCol(notNull=False, default=True)
 
     packages = SQLRelatedJoin('BinaryPackageRelease',
         joinColumn='distroarchseries',


Follow ups