Merge lp:~julian-edwards/launchpad/disable-arch-bug-633139 into lp:launchpad/db-devel

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 9769
Proposed branch: lp:~julian-edwards/launchpad/disable-arch-bug-633139
Merge into: lp:launchpad/db-devel
Diff against target: 119 lines (+70/-1)
5 files modified
lib/lp/soyuz/browser/distroarchseries.py (+2/-1)
lib/lp/soyuz/browser/tests/test_distroarchseries_view.py (+51/-0)
lib/lp/soyuz/doc/distroarchseries.txt (+10/-0)
lib/lp/soyuz/interfaces/distroarchseries.py (+6/-0)
lib/lp/soyuz/model/distroarchseries.py (+1/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/disable-arch-bug-633139
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+35072@code.launchpad.net

Commit message

Allow the "enabled" flag on distroarchseries to be editing on the DAS admin form.

Description of the change

= 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.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

test comment

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/browser/distroarchseries.py'
2--- lib/lp/soyuz/browser/distroarchseries.py 2010-08-20 20:31:18 +0000
3+++ lib/lp/soyuz/browser/distroarchseries.py 2010-09-10 10:42:55 +0000
4@@ -124,7 +124,8 @@
5 schema = IDistroArchSeries
6
7 field_names = [
8- 'architecturetag', 'official', 'supports_virtualized'
9+ 'architecturetag', 'official', 'supports_virtualized',
10+ 'enabled',
11 ]
12
13 @action(_('Change'), name='update')
14
15=== added file 'lib/lp/soyuz/browser/tests/test_distroarchseries_view.py'
16--- lib/lp/soyuz/browser/tests/test_distroarchseries_view.py 1970-01-01 00:00:00 +0000
17+++ lib/lp/soyuz/browser/tests/test_distroarchseries_view.py 2010-09-10 10:42:55 +0000
18@@ -0,0 +1,51 @@
19+# Copyright 2009 Canonical Ltd. This software is licensed under the
20+# GNU Affero General Public License version 3 (see the file LICENSE).
21+
22+__metaclass__ = type
23+
24+from canonical.launchpad.ftests import login
25+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
26+from canonical.testing import LaunchpadFunctionalLayer
27+from lp.soyuz.browser.distroarchseries import DistroArchSeriesAdminView
28+from lp.testing import TestCaseWithFactory
29+from lp.testing.sampledata import LAUNCHPAD_ADMIN
30+
31+
32+class TestDistroArchSeriesView(TestCaseWithFactory):
33+
34+ layer = LaunchpadFunctionalLayer
35+
36+ def setUp(self):
37+ """Create a distroarchseries for the tests and login as an admin."""
38+ super(TestDistroArchSeriesView, self).setUp()
39+ self.das = self.factory.makeDistroArchSeries()
40+ # Login as an admin to ensure access to the view's context
41+ # object.
42+ login(LAUNCHPAD_ADMIN)
43+
44+ def initialize_admin_view(self, enabled=True):
45+ # Initialize the admin view with the supplied params.
46+ method = 'POST'
47+ form = {
48+ 'field.actions.update': 'update',
49+ }
50+
51+ if enabled:
52+ form['field.enabled'] = 'on'
53+ else:
54+ form['field.enabled'] = 'off'
55+
56+ view = DistroArchSeriesAdminView(
57+ self.das, LaunchpadTestRequest(method=method, form=form))
58+ view.initialize()
59+ return view
60+
61+ def test_enabling_enabled_flag(self):
62+ view = self.initialize_admin_view(enabled=False)
63+ self.assertEqual(0, len(view.errors))
64+ self.assertFalse(view.context.enabled)
65+
66+ def test_disabling_enabled_flag(self):
67+ view = self.initialize_admin_view(enabled=True)
68+ self.assertEqual(0, len(view.errors))
69+ self.assertTrue(view.context.enabled)
70
71=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
72--- lib/lp/soyuz/doc/distroarchseries.txt 2010-07-20 09:36:17 +0000
73+++ lib/lp/soyuz/doc/distroarchseries.txt 2010-09-10 10:42:55 +0000
74@@ -25,6 +25,16 @@
75 # This needs many more tests to be effective.
76
77
78+Properties
79+==========
80+
81+Enabled is a boolean flag that says whether the arch will receive new builds
82+and publish them.
83+
84+ >>> print hoary_i386.enabled
85+ True
86+
87+
88 DistroArchSeries can tell you about their published releases
89 ============================================================
90
91
92=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
93--- lib/lp/soyuz/interfaces/distroarchseries.py 2010-08-20 20:31:18 +0000
94+++ lib/lp/soyuz/interfaces/distroarchseries.py 2010-09-10 10:42:55 +0000
95@@ -83,6 +83,12 @@
96 description=_("Indicate whether or not this port has support "
97 "for building PPA packages."),
98 required=False))
99+ enabled = Bool(
100+ title=_("Enabled"),
101+ description=_(
102+ "Whether or not this DistroArchSeries is enabled for build "
103+ "creation and publication."),
104+ required=False, readonly=False)
105
106 # Joins.
107 packages = Attribute('List of binary packages in this port.')
108
109=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
110--- lib/lp/soyuz/model/distroarchseries.py 2010-08-24 15:29:01 +0000
111+++ lib/lp/soyuz/model/distroarchseries.py 2010-09-10 10:42:55 +0000
112@@ -82,6 +82,7 @@
113 storm_validator=validate_public_person, notNull=True)
114 package_count = IntCol(notNull=True, default=DEFAULT)
115 supports_virtualized = BoolCol(notNull=False, default=False)
116+ enabled = BoolCol(notNull=False, default=True)
117
118 packages = SQLRelatedJoin('BinaryPackageRelease',
119 joinColumn='distroarchseries',

Subscribers

People subscribed via source and target branches

to status/vote changes: