]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Tidy up common code in parse_file()
authorSimon Glass <sjg@chromium.org>
Wed, 19 Jul 2023 23:48:18 +0000 (17:48 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 24 Jul 2023 15:34:10 +0000 (09:34 -0600)
Use a function to add to the maintainers database, to avoid duplicating
the same code twice.

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

index 541c82ff9960e6619904f1269444587a7e7c6fc0..df57f278daad5e3d934e48379c82abf3d7f5fb17 100644 (file)
@@ -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: