diff options
author | Simon Glass <sjg@chromium.org> | 2023-07-19 17:48:26 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-07-24 09:34:10 -0600 |
commit | 9a7cc8121f974582d3f07201b3e119e0d7c91559 (patch) | |
tree | 7b3c7cb1579be5f776c8a32e3fed5d3ed087cc8f /tools | |
parent | 1aaaafadcca2cf6a4203784b8b2b1555c04919e8 (diff) | |
download | u-boot-9a7cc8121f974582d3f07201b3e119e0d7c91559.tar.gz u-boot-9a7cc8121f974582d3f07201b3e119e0d7c91559.tar.bz2 u-boot-9a7cc8121f974582d3f07201b3e119e0d7c91559.zip |
buildman: Correct logic for missing maintainers
An orphaned board should produce a warning, as should a missing name for
the maintainer (when '-' is provided). Add these cases.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildman/boards.py | 14 | ||||
-rw-r--r-- | tools/buildman/func_test.py | 20 |
2 files changed, 27 insertions, 7 deletions
diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 269cafa6ad..e608f7990d 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -341,11 +341,15 @@ class MaintainersDatabase: str: Maintainers of the board. If the board has two or more maintainers, they are separated with colons. """ - if not target in self.database: - self.warnings.append(f"WARNING: no maintainers for '{target}'") - return '' - - return ':'.join(self.database[target][1]) + entry = self.database.get(target) + if entry: + status, maint_list = entry + if not status.startswith('Orphan'): + if len(maint_list) > 1 or (maint_list and maint_list[0] != '-'): + return ':'.join(maint_list) + + self.warnings.append(f"WARNING: no maintainers for '{target}'") + return '' def parse_file(self, srcdir, fname): """Parse a MAINTAINERS file. diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index c962083a43..bb9eea335d 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -923,13 +923,29 @@ Active aarch64 armv8 - armltd total_compute board2 'WARNING: orphaned defconfig in boards/board0/MAINTAINERS ending at line 4', ], warnings) - # Remove the maintainer line (M:) from a file (this should be fine) + # Mark a board as orphaned - this should give a warning + lines = ['S: Orphaned' if line.startswith('S') else line + for line in orig_data.splitlines(keepends=True)] + tools.write_file(main, ''.join(lines), binary=False) + params_list, warnings = self._boards.build_board_list(config_dir, src) + self.assertEquals(2, len(params_list)) + self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings) + + # Change the maintainer to '-' - this should give a warning + lines = ['M: -' if line.startswith('M') else line + for line in orig_data.splitlines(keepends=True)] + tools.write_file(main, ''.join(lines), binary=False) + params_list, warnings = self._boards.build_board_list(config_dir, src) + self.assertEquals(2, len(params_list)) + self.assertEquals(["WARNING: -: unknown status for 'board0'"], warnings) + + # Remove the maintainer line (M:) from a file lines = [line for line in orig_data.splitlines(keepends=True) if not line.startswith('M:')] tools.write_file(main, ''.join(lines), binary=False) params_list, warnings = self._boards.build_board_list(config_dir, src) self.assertEquals(2, len(params_list)) - self.assertFalse(warnings) + self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings) # Move the contents of the second file into this one, removing the # second file, to check multiple records in a single file. |