Merge lp:~rockstar/launchpad/recipe-polish into lp:launchpad

Proposed by Paul Hummer on 2010-05-07
Status: Merged
Approved by: Māris Fogels on 2010-05-07
Approved revision: no longer in the source branch.
Merged at revision: 10843
Proposed branch: lp:~rockstar/launchpad/recipe-polish
Merge into: lp:launchpad
Diff against target: 67 lines (+12/-9)
2 files modified
lib/lp/code/browser/sourcepackagerecipe.py (+4/-1)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+8/-8)
To merge this branch: bzr merge lp:~rockstar/launchpad/recipe-polish
Reviewer Review Type Date Requested Status
Māris Fogels (community) 2010-05-07 Approve on 2010-05-07
Review via email: mp+24928@code.launchpad.net

Description of the Change

This branch just fixes an issue with showing distroserieses in the recipe
add/edit forms that aren't part of a supported distro. Basically, we can't
build against a distroseries for a distro that doesn't have an archive
available for it. It's a simple branch (simpler than I was originally
working...)

To post a comment you must log in.
Māris Fogels (mars) wrote :

Looks good to me. r=mars.

<mars> rockstar, why did you nuke all of that test output around line 49 of the diff? I don't see anything in your code that would suggest its removal.
<rockstar> mars, they were distroseries that have distributions that have no archives.
<rockstar> mars, basically, this branch prevents someone trying to request a recipe build for lenny (Debian)
<rockstar> ...because we don't support any distro but Ubuntu.
<mars> oh! So your fix works, because it proved that the tests themselves had invalid distros in there
<rockstar> mars, yup.
<mars> rockstar, ok. Do you need a test for the explicit exclusion of a distro?
<mars> rockstar, a unit test or something?
<rockstar> mars, no, I don't think so.
<rockstar> The test coverage is being accomplished properly with what we have now.
<mars> ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/sourcepackagerecipe.py'
2--- lib/lp/code/browser/sourcepackagerecipe.py 2010-05-05 20:01:56 +0000
3+++ lib/lp/code/browser/sourcepackagerecipe.py 2010-05-07 20:16:29 +0000
4@@ -166,9 +166,12 @@
5
6 def buildable_distroseries_vocabulary(context):
7 """Return a vocabulary of buildable distroseries."""
8+ ppas = getUtility(IArchiveSet).getPPAsForUser(getUtility(ILaunchBag).user)
9+ supported_distros = [ppa.distribution for ppa in ppas]
10 dsset = getUtility(IDistroSeriesSet).search()
11 terms = [SimpleTerm(distro, distro.id, distro.displayname)
12- for distro in dsset if distro.active]
13+ for distro in dsset if (
14+ distro.active and distro.distribution in supported_distros)]
15 return SimpleVocabulary(terms)
16
17 def target_ppas_vocabulary(context):
18
19=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
20--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-06 21:12:19 +0000
21+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-07 20:16:29 +0000
22@@ -38,7 +38,8 @@
23 self.ppa = self.factory.makeArchive(
24 displayname='Secret PPA', owner=self.chef, name='ppa')
25 self.squirrel = self.factory.makeDistroSeries(
26- displayname='Secret Squirrel', name='secret')
27+ displayname='Secret Squirrel', name='secret',
28+ distribution=self.ppa.distribution)
29
30 def makeRecipe(self):
31 """Create and return a specific recipe."""
32@@ -129,7 +130,8 @@
33
34 def test_edit_recipe(self):
35 self.factory.makeDistroSeries(
36- displayname='Mumbly Midget', name='mumbly')
37+ displayname='Mumbly Midget', name='mumbly',
38+ distribution=self.ppa.distribution)
39 product = self.factory.makeProduct(
40 name='ratatouille', displayname='Ratatouille')
41 veggie_branch = self.factory.makeBranch(
42@@ -295,14 +297,9 @@
43 Archive:
44 Secret PPA (chef/ppa)
45 Distribution series:
46+ Secret Squirrel
47 Warty
48 Hoary
49- Six
50- 7.0
51- Woody
52- Sarge
53- Guada2005
54- Secret Squirrel
55 or
56 Cancel""")
57 main_text = self.getMainText(recipe, '+request-builds')
58@@ -310,6 +307,9 @@
59
60 def test_request_builds_action(self):
61 """Requesting a build creates pending builds."""
62+ woody = self.factory.makeDistroSeries(
63+ name='woody', displayname='Woody',
64+ distribution=self.ppa.distribution)
65 recipe = self.makeRecipe()
66 browser = self.getViewBrowser(recipe, '+request-builds')
67 browser.getControl('Woody').click()