srcdir (str): Directory containing source code (Kconfig files)
fname (str): MAINTAINERS file to be parsed
"""
- def add_targets():
- """Add any new targets"""
+ def add_targets(linenum):
+ """Add any new targets
+
+ Args:
+ linenum (int): Current line number
+ """
+ added = False
if targets:
for target in targets:
self.database[target] = (status, maintainers)
+ added = True
+ if not added and (status != '-' and maintainers):
+ leaf = fname[len(srcdir) + 1:]
+ if leaf != 'MAINTAINERS':
+ self.warnings.append(
+ f'WARNING: orphaned defconfig in {leaf} ending at line {linenum + 1}')
targets = []
maintainers = []
status = '-'
with open(fname, encoding="utf-8") as inf:
- for line in inf:
+ for linenum, line in enumerate(inf):
# Check also commented maintainers
if line[:3] == '#M:':
line = line[1:]
if match and not rear:
targets.append(front)
elif line == '\n':
- add_targets()
+ add_targets(linenum)
targets = []
maintainers = []
status = '-'
- add_targets()
+ add_targets(linenum)
class Boards:
params_list, warnings = self._boards.build_board_list(config_dir, src)
self.assertEquals(2, len(params_list))
self.assertEquals(
- ["WARNING: no status info for 'board0'",
+ ['WARNING: orphaned defconfig in boards/board0/MAINTAINERS ending at line 4',
+ "WARNING: no status info for 'board0'",
"WARNING: no maintainers for 'board0'"], warnings)
# Remove the maintainer line (M:) from a file (this should be fine)
self.assertEquals(2, len(params_list))
self.assertFalse(warnings)
- # Add another record, this should be ignored
+ # Add another record, this should be ignored with a warning
extra = '\n\nAnother\nM: Fred\nF: configs/board9_defconfig\nS: other\n'
tools.write_file(main, data + extra, 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: orphaned defconfig in boards/board0/MAINTAINERS ending at line 16'],
+ warnings)