launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29188
[Merge] ~cjwatson/launchpad:charm-recipe-multiple-series into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:charm-recipe-multiple-series into launchpad:master.
Commit message:
Support parallel dispatch of a charm recipe for multiple series
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1986968 in Launchpad itself: "Support builds for multiple series from a single charm recipe"
https://bugs.launchpad.net/launchpad/+bug/1986968
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429829
`charmcraft` supports declaring that a single recipe should build for multiple bases, which may include the case where bases differ only by "channel" (i.e. distroseries), so don't reject build requests as already-pending if an existing pending build of a recipe is for the same architecture but a different series.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-recipe-multiple-series into launchpad:master.
diff --git a/lib/lp/charms/model/charmrecipe.py b/lib/lp/charms/model/charmrecipe.py
index 1b4f0bb..b2d9be5 100644
--- a/lib/lp/charms/model/charmrecipe.py
+++ b/lib/lp/charms/model/charmrecipe.py
@@ -551,7 +551,7 @@ class CharmRecipe(StormBase, WebhookTargetMixin):
pending = IStore(self).find(
CharmRecipeBuild,
CharmRecipeBuild.recipe == self,
- CharmRecipeBuild.processor == distro_arch_series.processor,
+ CharmRecipeBuild.distro_arch_series == distro_arch_series,
channels_clause,
CharmRecipeBuild.status == BuildStatus.NEEDSBUILD,
)
diff --git a/lib/lp/charms/tests/test_charmrecipe.py b/lib/lp/charms/tests/test_charmrecipe.py
index f7818e8..0855d7e 100644
--- a/lib/lp/charms/tests/test_charmrecipe.py
+++ b/lib/lp/charms/tests/test_charmrecipe.py
@@ -357,11 +357,18 @@ class TestCharmRecipe(TestCaseWithFactory):
def test_requestBuild_rejects_repeats(self):
# requestBuild refuses if there is already a pending build.
recipe = self.factory.makeCharmRecipe()
- distro_series = self.factory.makeDistroSeries()
+ distro_serieses = [self.factory.makeDistroSeries() for _ in range(2)]
arches = [
- self.makeBuildableDistroArchSeries(distroseries=distro_series)
+ self.makeBuildableDistroArchSeries(distroseries=distro_serieses[0])
for _ in range(2)
]
+ arches.append(
+ self.makeBuildableDistroArchSeries(
+ distroseries=distro_serieses[1],
+ architecturetag=arches[0].architecturetag,
+ processor=arches[0].processor,
+ )
+ )
build_request = self.factory.makeCharmRecipeBuildRequest(recipe=recipe)
old_build = recipe.requestBuild(build_request, arches[0])
self.assertRaises(
@@ -372,6 +379,9 @@ class TestCharmRecipe(TestCaseWithFactory):
)
# We can build for a different distroarchseries.
recipe.requestBuild(build_request, arches[1])
+ # We can build for a distroarchseries in a different distroseries
+ # for the same processor.
+ recipe.requestBuild(build_request, arches[2])
# channels=None and channels={} are treated as equivalent, but
# anything else allows a new build.
self.assertRaises(