launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04233
[Merge] lp:~rvb/launchpad/deriv-voc-bug-807464 into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/deriv-voc-bug-807464 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #807464 in Launchpad itself: "The derivation vocabulary should not be restricted to series with architectures in LP when it's a derivation of the "second type" (i.e. from previous series)."
https://bugs.launchpad.net/launchpad/+bug/807464
For more details, see:
https://code.launchpad.net/~rvb/launchpad/deriv-voc-bug-807464/+merge/67509
The derivation vocabulary (of potential parents) should not be restricted to series with architectures in LP when it's a derivation of the "second type" (i.e. other derived distroseries are present in the distribution).
= Tests =
./bin/test -vvc test_distroseries_vocabularies test_distribution_with_non_derived_series_no_arch
= QA =
On DF: create a new series in Ubuntu and make sure that Sid can be added as a parent on the +initseries page.
--
https://code.launchpad.net/~rvb/launchpad/deriv-voc-bug-807464/+merge/67509
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/deriv-voc-bug-807464 into lp:launchpad.
=== modified file 'lib/lp/registry/tests/test_distroseries_vocabularies.py'
--- lib/lp/registry/tests/test_distroseries_vocabularies.py 2011-06-29 15:02:28 +0000
+++ lib/lp/registry/tests/test_distroseries_vocabularies.py 2011-07-11 09:57:39 +0000
@@ -66,6 +66,17 @@
observed_distroseries = set(term.value for term in vocabulary)
self.assertEqual(expected_distroseries, observed_distroseries)
+ def test_distribution_with_non_derived_series_no_arch(self):
+ # Only the parents with DistroArchSeries configured in LP are
+ # returned in the DistroSeriesDerivationVocabulary if no other
+ # derived distroseries are present in the distribution.
+ distroseries = self.factory.makeDistroSeries()
+ vocabulary = DistroSeriesDerivationVocabulary(distroseries)
+ another_parent_no_arch = self.factory.makeDistroSeries()
+ observed_distroseries = set(term.value for term in vocabulary)
+
+ self.assertNotIn(another_parent_no_arch, observed_distroseries)
+
def makeDistroSeriesWithDistroArch(self, *args, **kwargs):
# Helper method to create a distroseries with a
# DistroArchSeries.
@@ -89,8 +100,8 @@
self.assertContentEqual(expected_distroseries, observed_distroseries)
def test_distribution_with_derived_series_no_arch(self):
- # Only the parents with DistroArcheSeries configured in LP are
- # returned.
+ # Distroseries with no DistroArchSeries can be parents if this
+ # is not the first derivation in the distribution.
parent_distroseries = self.makeDistroSeriesWithDistroArch()
another_parent_no_arch = self.factory.makeDistroSeries(
distribution=parent_distroseries.distribution)
@@ -98,11 +109,9 @@
self.factory.makeDistroSeriesParent(
derived_series=distroseries, parent_series=parent_distroseries)
vocabulary = DistroSeriesDerivationVocabulary(distroseries)
- expected_distroseries = set(parent_distroseries.distribution.series)
- expected_distroseries.remove(another_parent_no_arch)
observed_distroseries = set(term.value for term in vocabulary)
- self.assertContentEqual(expected_distroseries, observed_distroseries)
+ self.assertIn(another_parent_no_arch, observed_distroseries)
def test_distribution_with_derived_series_from_multiple_parents(self):
# Given a distribution with series, one or more of which are derived
=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py 2011-07-08 15:01:37 +0000
+++ lib/lp/registry/vocabularies.py 2011-07-11 09:57:39 +0000
@@ -1837,8 +1837,7 @@
"""See `IHugeVocabulary`."""
parent = ClassAlias(DistroSeries, "parent")
child = ClassAlias(DistroSeries, "child")
- # Select only the series with architectures setup in LP.
- where = [DistroSeries.id == DistroArchSeries.distroseriesID]
+ where = []
if query is not None:
term = '%' + query.lower() + '%'
search = Or(
@@ -1857,6 +1856,9 @@
DistroSeries.distributionID.is_in(parent_distributions))
return self.find_terms(where)
else:
+ # Select only the series with architectures setup in LP.
+ where.append(
+ DistroSeries.id == DistroArchSeries.distroseriesID)
where.append(
DistroSeries.distribution != self.distribution)
return self.find_terms(where)