]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Refactor target handling in Boards.scan()
authorSimon Glass <sjg@chromium.org>
Wed, 19 Jul 2023 23:48:20 +0000 (17:48 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 24 Jul 2023 15:34:10 +0000 (09:34 -0600)
Move the assert to the top of the function and provide an explicit
variables for the target name and base name.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/boards.py

index 122fe7090bf84d23fc2b8a85071ee1f5515f368a..2d393263003b7ff281c737ef2c12796126ea2dd6 100644 (file)
@@ -231,6 +231,10 @@ class KconfigScanner:
                 'config': <config_header_name>,
             }
         """
+        leaf = os.path.basename(defconfig)
+        expect_target, match, rear = leaf.partition('_defconfig')
+        assert match and not rear, f'{leaf} : invalid defconfig'
+
         self._conf.load_config(defconfig)
         self._tmpfile = None
 
@@ -245,9 +249,7 @@ class KconfigScanner:
             else:
                 params[key] = '-'
 
-        defconfig = os.path.basename(defconfig)
-        params['target'], match, rear = defconfig.partition('_defconfig')
-        assert match and not rear, f'{defconfig} : invalid defconfig'
+        params['target'] = expect_target
 
         # fix-up for aarch64
         if params['arch'] == 'arm' and params['cpu'] == 'armv8':