← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad:wip-lp-2538 into launchpad:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad:wip-lp-2538 into launchpad:master.

Commit message:
WIP LP-2538

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/486827
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:wip-lp-2538 into launchpad:master.
diff --git a/lib/lp/charms/interfaces/charmrecipe.py b/lib/lp/charms/interfaces/charmrecipe.py
index e947fd7..a2ae5a0 100644
--- a/lib/lp/charms/interfaces/charmrecipe.py
+++ b/lib/lp/charms/interfaces/charmrecipe.py
@@ -75,6 +75,7 @@ from lp.app.interfaces.informationtype import IInformationType
 from lp.app.validators.name import name_validator
 from lp.app.validators.path import path_does_not_escape
 from lp.buildmaster.builderproxy import FetchServicePolicy
+from lp.buildmaster.interfaces.processor import IProcessor
 from lp.code.interfaces.gitref import IGitRef
 from lp.code.interfaces.gitrepository import IGitRepository
 from lp.registry.interfaces.person import IPerson
@@ -404,7 +405,12 @@ class ICharmRecipeView(Interface):
             ),
             required=False,
             extra_snap_names=["charmcraft"],
-        )
+        ),
+        architectures=List(
+            title=_("The list of architectures to build for this recipe."),
+            value_type=Reference(schema=IProcessor),
+            required=False,
+        ),
     )
     @export_factory_operation(ICharmRecipeBuildRequest, [])
     @operation_for_version("devel")
diff --git a/lib/lp/charms/model/charmrecipejob.py b/lib/lp/charms/model/charmrecipejob.py
index 56efa07..6c45d6d 100644
--- a/lib/lp/charms/model/charmrecipejob.py
+++ b/lib/lp/charms/model/charmrecipejob.py
@@ -173,6 +173,14 @@ class CharmRecipeRequestBuildsJob(CharmRecipeJobDerived):
     @classmethod
     def create(cls, recipe, requester, channels=None, architectures=None):
         """See `ICharmRecipeRequestBuildsJobSource`."""
+        # architectures can be an iterable of strings or Processors
+        # in the latter case, we need to convert them to strings
+        if architectures and all(
+            not (isinstance(arch, str)) for arch in architectures
+        ):
+            architectures = [
+                architecture.name for architecture in architectures
+            ]
         metadata = {
             "requester": requester.id,
             "channels": channels,