[PATCH v1 4/5] genboardcfg: allow defconfigs in board directory

Troy Kisky troy.kisky at boundarydevices.com
Sat Dec 18 00:01:30 CET 2021


The adds boards whose defconfigs are in the board's directory.

Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
---
 tools/genboardscfg.py | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 4ee7aa1f891..60e2fe5cf3e 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -37,6 +37,13 @@ COMMENT_BLOCK = '''#
 ''' % __file__
 
 ### helper functions ###
+def find_defconfig_in_board_subdir(f):
+    for (dirpath, dirnames, filenames) in os.walk('board'):
+        for filename in filenames:
+            if filename == f:
+                    return True
+    return False
+
 def try_remove(f):
     """Remove a file ignoring 'No such file or directory' error."""
     try:
@@ -76,6 +83,14 @@ def output_is_new(output):
             if ctime < os.path.getctime(filepath):
                 return False
 
+    for (dirpath, dirnames, filenames) in os.walk('board'):
+        for filename in fnmatch.filter(filenames, '*'):
+            if fnmatch.fnmatch(filename, '.*'):
+                continue
+            filepath = os.path.join(dirpath, filename)
+            if ctime < os.path.getctime(filepath):
+                return False
+
     for (dirpath, dirnames, filenames) in os.walk('.'):
         for filename in filenames:
             if (fnmatch.fnmatch(filename, '*~') or
@@ -94,7 +109,8 @@ def output_is_new(output):
                 continue
             defconfig = line.split()[6] + '_defconfig'
             if not os.path.exists(os.path.join(CONFIG_DIR, defconfig)):
-                return False
+                if not find_defconfig_in_board_subdir(defconfig):
+                    return False
 
     return True
 
@@ -231,6 +247,12 @@ def scan_defconfigs(jobs=1):
                 continue
             all_defconfigs.append(os.path.join(dirpath, filename))
 
+    for (dirpath, dirnames, filenames) in os.walk('board'):
+        for filename in fnmatch.filter(filenames, '*_defconfig'):
+            if fnmatch.fnmatch(filename, '.*'):
+                continue
+            all_defconfigs.append(os.path.join(dirpath, filename))
+
     total_boards = len(all_defconfigs)
     processes = []
     queues = []
@@ -346,6 +368,19 @@ class MaintainersDatabase:
                 targets = []
                 maintainers = []
                 status = '-'
+
+        front, match, rear = file.partition('board/')
+        if match:
+            front, match, rear = file.partition('/MAINTAINERS')
+            if front:
+                for (dirpath, dirnames, filenames) in os.walk(front):
+                    for filename in fnmatch.filter(filenames, '*_defconfig'):
+                        if fnmatch.fnmatch(filename, '.*'):
+                            continue
+                        front, match, rear = filename.rpartition('_defconfig')
+                        if match and not rear:
+                            targets.append(front)
+
         if targets:
             for target in targets:
                 self.database[target] = (status, maintainers)
-- 
2.32.0



More information about the U-Boot mailing list