[PATCH v4 10/83] buildman: Tidy up common code in parse_file()

Simon Glass sjg at chromium.org
Thu Jul 20 01:48:18 CEST 2023


Use a function to add to the maintainers database, to avoid duplicating
the same code twice.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v3)

Changes in v3:
- Add new patch to tidy up common code in parse_file()

 tools/buildman/boards.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py
index 541c82ff9960..df57f278daad 100644
--- a/tools/buildman/boards.py
+++ b/tools/buildman/boards.py
@@ -345,6 +345,12 @@ class MaintainersDatabase:
             srcdir (str): Directory containing source code (Kconfig files)
             fname (str): MAINTAINERS file to be parsed
         """
+        def add_targets():
+            """Add any new targets"""
+            if targets:
+                for target in targets:
+                    self.database[target] = (status, maintainers)
+
         targets = []
         maintainers = []
         status = '-'
@@ -382,14 +388,11 @@ class MaintainersDatabase:
                                 if match and not rear:
                                     targets.append(front)
                 elif line == '\n':
-                    for target in targets:
-                        self.database[target] = (status, maintainers)
+                    add_targets()
                     targets = []
                     maintainers = []
                     status = '-'
-        if targets:
-            for target in targets:
-                self.database[target] = (status, maintainers)
+        add_targets()
 
 
 class Boards:
-- 
2.41.0.487.g6d72f3e995-goog



More information about the U-Boot mailing list