← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~andrey-fedoseev/launchpad:build-to-run-on-synonym into launchpad:master

 

Andrey Fedoseev has proposed merging ~andrey-fedoseev/launchpad:build-to-run-on-synonym into launchpad:master.

Commit message:
Parse build-to as a synonym for run-on in snapcraft.yaml

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andrey-fedoseev/launchpad/+git/launchpad/+merge/423432

Parse build-to as a synonym for run-on in snapcraft.yaml

Nothing more to add :-)
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~andrey-fedoseev/launchpad:build-to-run-on-synonym into launchpad:master.
diff --git a/lib/lp/snappy/adapters/buildarch.py b/lib/lp/snappy/adapters/buildarch.py
index fe8680b..127c734 100644
--- a/lib/lp/snappy/adapters/buildarch.py
+++ b/lib/lp/snappy/adapters/buildarch.py
@@ -61,8 +61,8 @@ class SnapArchitecture:
 
         :param build_on: string or list; build-on property from
             snapcraft.yaml.
-        :param run_on: string or list; run-on property from snapcraft.yaml
-            (defaults to build_on).
+        :param run_on: string or list; run-on (or build-to) property from
+            snapcraft.yaml (defaults to build_on).
         :param build_error: string; build-error property from
             snapcraft.yaml.
         """
@@ -84,8 +84,10 @@ class SnapArchitecture:
             raise MissingPropertyError("build-on")
 
         return cls(
-            build_on=build_on, run_on=properties.get("run-on"),
-            build_error=properties.get("build-error"))
+            build_on=build_on,
+            run_on=properties.get("run-on", properties.get("build-to")),
+            build_error=properties.get("build-error"),
+        )
 
 
 class SnapBuildInstance:
diff --git a/lib/lp/snappy/adapters/tests/test_buildarch.py b/lib/lp/snappy/adapters/tests/test_buildarch.py
index ba482d5..0b3b931 100644
--- a/lib/lp/snappy/adapters/tests/test_buildarch.py
+++ b/lib/lp/snappy/adapters/tests/test_buildarch.py
@@ -46,6 +46,18 @@ class TestSnapArchitecture(WithScenarios, TestCase):
             "expected_run_on": ["amd64"],
             "expected_build_error": "ignore",
             }),
+        ("run-on", {
+            "architectures": {"build-on": ["amd64"], "run-on": "all"},
+            "expected_build_on": ["amd64"],
+            "expected_run_on": ["all"],
+            "expected_build_error": None,
+            }),
+        ("build-to", {
+            "architectures": {"build-on": ["amd64"], "build-to": "all"},
+            "expected_build_on": ["amd64"],
+            "expected_run_on": ["all"],
+            "expected_build_error": None,
+            }),
         ]
 
     def test_architecture(self):

Follow ups