summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWadim Egorov <w.egorov@phytec.de>2019-03-18 11:10:54 +0100
committerStefan Müller-Klieser <s.mueller-klieser@phytec.de>2019-04-09 11:08:58 +0200
commited10b341fb5d121c21e7ffc4dc32ab91b3acf604 (patch)
tree680e4c4ce41d48cc5b7f6adb56729f13c1abe137
parenta9ef1c4b13055039920f0f030cd4e3e5db1963f2 (diff)
downloadmeta-phytec-ed10b341fb5d121c21e7ffc4dc32ab91b3acf604.tar.bz2
meta-phytec-ed10b341fb5d121c21e7ffc4dc32ab91b3acf604.zip
scripts: switch_machine: Fallback to UNASSIGNED for emtpy build list
Yocto builds that do not support any builds by "SUPPORTEDIMAGE" will throw the following error: Traceback (most recent call last): File "./sources/meta-phytec/scripts/switch_machine.py", line 103, in <module> main() File "./sources/meta-phytec/scripts/switch_machine.py", line 98, in main if not bsp.switch_machine(args.machine, args.distro): File "./sources/meta-phytec/scripts/switch_machine.py", line 27, in switch_machine min_len_machines = min(len(build[0]) for build in builds) ValueError: min() arg is an empty sequence Instead of crashing it is better to do nothing and keep the machine as "UNASSIGNED". Maybe this can be handled properly by the phylib.py with a dummy supported_build that gets selected if we have no builds at all. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
-rwxr-xr-xscripts/switch_machine.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/switch_machine.py b/scripts/switch_machine.py
index 9421b3f..e89c03a 100755
--- a/scripts/switch_machine.py
+++ b/scripts/switch_machine.py
@@ -22,6 +22,9 @@ class BSP_Switcher(BoardSupportPackage):
return self.write_machine_to_localconf()
builds = self.supported_builds
+ if builds == []:
+ print("No build/machine supported.")
+ return self.write_machine_to_localconf()
min_len_machines = min(len(build[0]) for build in builds)