summaryrefslogtreecommitdiff
path: root/tools/buildman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-20 02:48:20 +0300
committerSimon Glass <sjg@chromium.org>2023-07-24 18:34:10 +0300
commitf99f34b14b7c48360452a0bcca395e0fc7a01b2b (patch)
tree3aab2fcb49ea690689b37fd2dfce4918e9428623 /tools/buildman
parentbc12d03493d7aa1bdda6d9dc40e2457fb8e33684 (diff)
downloadu-boot-f99f34b14b7c48360452a0bcca395e0fc7a01b2b.tar.xz
buildman: Refactor target handling in Boards.scan()
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>
Diffstat (limited to 'tools/buildman')
-rw-r--r--tools/buildman/boards.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py
index 122fe7090b..2d39326300 100644
--- a/tools/buildman/boards.py
+++ b/tools/buildman/boards.py
@@ -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':