← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ines-almeida/launchpad:fix-supported-arches-error-message into launchpad:master

 

Ines Almeida has proposed merging ~ines-almeida/launchpad:fix-supported-arches-error-message into launchpad:master.

Commit message:
Print correct base name in error when arch not supported
    
Currently when using `build-base` instead of `base` as defined in https://snapcraft.io/docs/release-notes-snapcraft-3-7 we print out the wrong base name ('unknown') because we print the value of `base`. This prints the actual base used to get the supported architectures


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/474468

There are quite a few tests or the parsing but none check the error message per se
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:fix-supported-arches-error-message into launchpad:master.
diff --git a/lib/lp/snappy/adapters/buildarch.py b/lib/lp/snappy/adapters/buildarch.py
index 0588e02..20aa9ea 100644
--- a/lib/lp/snappy/adapters/buildarch.py
+++ b/lib/lp/snappy/adapters/buildarch.py
@@ -192,7 +192,9 @@ def determine_architectures_to_build(
     if architectures_list:
         architectures = parse_architectures_list(architectures_list)
     elif "platforms" in snapcraft_data:
-        architectures = parse_platforms(snapcraft_data, supported_arches)
+        architectures = parse_platforms(
+            snapcraft_data, supported_arches, snap_base.name
+        )
     else:
         # If no architectures are specified, build one for each supported
         # architecture.
@@ -231,7 +233,9 @@ def parse_architectures_list(
 
 
 def parse_platforms(
-    snapcraft_data: Dict[str, Any], supported_arches: List[str]
+    snapcraft_data: Dict[str, Any],
+    supported_arches: List[str],
+    base_name: str,
 ) -> List[SnapArchitecture]:
     architectures = []
     supported_arch_names = supported_arches
@@ -259,9 +263,8 @@ def parse_platforms(
                 SnapArchitecture(build_on=[platform], build_for=[platform])
             )
         else:
-            base = snapcraft_data.get("base", "unknown")
             raise BadPropertyError(
-                f"'{platform}' is not a supported platform " f"for '{base}'."
+                f"'{platform}' is not a supported platform for '{base_name}'."
             )
 
     return architectures

Follow ups