Skip to contentSkip to conversation

cookerdata: Show a readable error for invalid multiconfig name

PATCH New Richard Purdie 1 participant 1 message Sep 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cookerdata: Show a readable error for invalid multiconfig name

If a multiconfig starts with a digit, users would see pages of errors as we use the multiconfig as a python function name prefix and python functions cannot start with a digit. We could avoid doing that but it is easier just to ask users to name multiconfigs not starting with digits.

This tweak ensures the user sees an easier to understand error.

---
 lib/bb/cookerdata.py | 2 ++
 1 file changed, 2 insertions(+)
lib/bb/cookerdata.py +2 -0
index d6206b7319..ba657c03b6 100644
@@ -291,6 +291,8 @@ class CookerDataBuilder(object):
 
             multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split()
             for config in multiconfig:
+                if config[0].isdigit():
+                    bb.fatal("Multiconfig name '%s' is invalid as multiconfigs cannot start with a digit" % config)
                 mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config)
                 bb.event.fire(bb.event.ConfigParsed(), mcdata)
                 self.mcdata[config] = mcdata
Signature · 1 line
2.32.0