Merge lp:~abentley/launchpad/config-disable-build-requests into lp:launchpad

Proposed by Aaron Bentley on 2010-06-09
Status: Merged
Approved by: Francis J. Lacoste on 2010-06-09
Approved revision: no longer in the source branch.
Merged at revision: 10985
Proposed branch: lp:~abentley/launchpad/config-disable-build-requests
Merge into: lp:launchpad
Diff against target: 40 lines (+12/-0)
2 files modified
lib/lp/code/model/sourcepackagerecipe.py (+3/-0)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+9/-0)
To merge this branch: bzr merge lp:~abentley/launchpad/config-disable-build-requests
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical 2010-06-09 Approve on 2010-06-09
Paul Hummer (community) Approve on 2010-06-09
Edwin Grubbs code 2010-06-09 Pending
Review via email: mp+27172@code.launchpad.net

Description of the Change

= Summary =
With build_from_branch.enabled=False, users cannot navigate to the recipe build
UI, but they can reach it via URL hacking, and the API is unaffected.

== Proposed fix ==
Disable requesting a source package recipe build when
build_from_branch.enabled=False

== Pre-implementation notes ==
Discussed with flacoste and bigjools

== Implementation details ==
This simply raises a ValueError. This may cause an oops in the UI, but I think
this is acceptable because they got there by URL hacking. I want this branch
to be minimal, so that it is acceptable as a cherrypick.

== Tests ==
bin/test -vt requestBuildHonoursConfig test_sourcepackagerecipe

== Demo and Q/A ==
Attempt to request a build on edge or staging. It should fail.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/code/model/tests/test_sourcepackagerecipe.py
  lib/lp/code/model/sourcepackagerecipe.py

To post a comment you must log in.
Paul Hummer (rockstar) :
review: Approve
review: Approve (release-critical)
Julian Edwards (julian-edwards) wrote :

Since we had another recipe job take down the build farm this morning, I've landed this branch on devel and production-devel this morning and Tom cherry picked the changes to edge and lpnet.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/model/sourcepackagerecipe.py'
2--- lib/lp/code/model/sourcepackagerecipe.py 2010-05-28 20:54:57 +0000
3+++ lib/lp/code/model/sourcepackagerecipe.py 2010-06-09 15:19:28 +0000
4@@ -19,6 +19,7 @@
5 from zope.component import getUtility
6 from zope.interface import classProvides, implements
7
8+from canonical.config import config
9 from canonical.database.datetimecol import UtcDateTimeCol
10 from canonical.launchpad.interfaces.lpstorm import IMasterStore, IStore
11
12@@ -157,6 +158,8 @@
13
14 def requestBuild(self, archive, requester, distroseries, pocket):
15 """See `ISourcePackageRecipe`."""
16+ if not config.build_from_branch.enabled:
17+ raise ValueError('Source package recipe builds disabled.')
18 if archive.purpose != ArchivePurpose.PPA:
19 raise NonPPABuildRequest
20 component = getUtility(IComponentSet)["multiverse"]
21
22=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
23--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2010-05-28 20:54:57 +0000
24+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2010-06-09 15:19:28 +0000
25@@ -251,6 +251,15 @@
26 self.assertRaises(ArchiveDisabled, recipe.requestBuild, ppa,
27 ppa.owner, distroseries, PackagePublishingPocket.RELEASE)
28
29+ def test_requestBuildHonoursConfig(self):
30+ recipe = self.factory.makeSourcePackageRecipe()
31+ (distroseries,) = list(recipe.distroseries)
32+ ppa = self.factory.makeArchive()
33+ self.pushConfig('build_from_branch', enabled=False)
34+ self.assertRaises(
35+ ValueError, recipe.requestBuild, ppa, ppa.owner, distroseries,
36+ PackagePublishingPocket.RELEASE)
37+
38 def test_sourcepackagerecipe_description(self):
39 """Ensure that the SourcePackageRecipe has a proper description."""
40 description = u'The whoozits and whatzits.'