mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-27 08:41:35 +02:00
buildman: Return an error if there are maintainer warnings
Detect warnings about missing maintain info and return result code 2 in that case. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5579ce747d
commit
add76e7c44
@ -1314,7 +1314,8 @@ Using boards.cfg
|
|||||||
This file is no-longer needed by buildman but it is still generated in the
|
This file is no-longer needed by buildman but it is still generated in the
|
||||||
working directory. This helps avoid a delay on every build, since scanning all
|
working directory. This helps avoid a delay on every build, since scanning all
|
||||||
the Kconfig files takes a few seconds. Use the -R flag to force regeneration
|
the Kconfig files takes a few seconds. Use the -R flag to force regeneration
|
||||||
of the file - in that case buildman exits after writing the file.
|
of the file - in that case buildman exits after writing the file. with exit code
|
||||||
|
2 if there was an error in the maintainer files.
|
||||||
|
|
||||||
You should use 'buildman -nv <criteria>' instead of greoing the boards.cfg file,
|
You should use 'buildman -nv <criteria>' instead of greoing the boards.cfg file,
|
||||||
since it may be dropped altogether in future.
|
since it may be dropped altogether in future.
|
||||||
|
@ -276,11 +276,13 @@ class MaintainersDatabase:
|
|||||||
value: tuple:
|
value: tuple:
|
||||||
str: Board status (e.g. 'Active')
|
str: Board status (e.g. 'Active')
|
||||||
str: List of maintainers, separated by :
|
str: List of maintainers, separated by :
|
||||||
|
warnings (list of str): List of warnings due to missing status, etc.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Create an empty database."""
|
"""Create an empty database."""
|
||||||
self.database = {}
|
self.database = {}
|
||||||
|
self.warnings = []
|
||||||
|
|
||||||
def get_status(self, target):
|
def get_status(self, target):
|
||||||
"""Return the status of the given board.
|
"""Return the status of the given board.
|
||||||
@ -296,7 +298,7 @@ class MaintainersDatabase:
|
|||||||
str: 'Active', 'Orphan' or '-'.
|
str: 'Active', 'Orphan' or '-'.
|
||||||
"""
|
"""
|
||||||
if not target in self.database:
|
if not target in self.database:
|
||||||
print(f"WARNING: no status info for '{target}'", file=sys.stderr)
|
self.warnings.append(f"WARNING: no status info for '{target}'")
|
||||||
return '-'
|
return '-'
|
||||||
|
|
||||||
tmp = self.database[target][0]
|
tmp = self.database[target][0]
|
||||||
@ -306,7 +308,7 @@ class MaintainersDatabase:
|
|||||||
return 'Active'
|
return 'Active'
|
||||||
if tmp.startswith('Orphan'):
|
if tmp.startswith('Orphan'):
|
||||||
return 'Orphan'
|
return 'Orphan'
|
||||||
print(f"WARNING: {tmp}: unknown status for '{target}'", file=sys.stderr)
|
self.warnings.append(f"WARNING: {tmp}: unknown status for '{target}'")
|
||||||
return '-'
|
return '-'
|
||||||
|
|
||||||
def get_maintainers(self, target):
|
def get_maintainers(self, target):
|
||||||
@ -320,7 +322,7 @@ class MaintainersDatabase:
|
|||||||
maintainers, they are separated with colons.
|
maintainers, they are separated with colons.
|
||||||
"""
|
"""
|
||||||
if not target in self.database:
|
if not target in self.database:
|
||||||
print(f"WARNING: no maintainers for '{target}'", file=sys.stderr)
|
self.warnings.append(f"WARNING: no maintainers for '{target}'")
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
return ':'.join(self.database[target][1])
|
return ':'.join(self.database[target][1])
|
||||||
@ -677,6 +679,9 @@ class Boards:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
params_list (list of dict): A list of the board parameters
|
params_list (list of dict): A list of the board parameters
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list of str: List of warnings collected due to missing status, etc.
|
||||||
"""
|
"""
|
||||||
database = MaintainersDatabase()
|
database = MaintainersDatabase()
|
||||||
for (dirpath, _, filenames) in os.walk('.'):
|
for (dirpath, _, filenames) in os.walk('.'):
|
||||||
@ -688,6 +693,7 @@ class Boards:
|
|||||||
params['status'] = database.get_status(target)
|
params['status'] = database.get_status(target)
|
||||||
params['maintainers'] = database.get_maintainers(target)
|
params['maintainers'] = database.get_maintainers(target)
|
||||||
params_list[i] = params
|
params_list[i] = params
|
||||||
|
return database.warnings
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def format_and_output(cls, params_list, output):
|
def format_and_output(cls, params_list, output):
|
||||||
@ -731,11 +737,17 @@ class Boards:
|
|||||||
jobs (int): The number of jobs to run simultaneously
|
jobs (int): The number of jobs to run simultaneously
|
||||||
force (bool): Force to generate the output even if it is new
|
force (bool): Force to generate the output even if it is new
|
||||||
quiet (bool): True to avoid printing a message if nothing needs doing
|
quiet (bool): True to avoid printing a message if nothing needs doing
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if all is well, False if there were warnings
|
||||||
"""
|
"""
|
||||||
if not force and output_is_new(output):
|
if not force and output_is_new(output):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(f'{output} is up to date. Nothing to do.')
|
print(f'{output} is up to date. Nothing to do.')
|
||||||
return
|
return True
|
||||||
params_list = self.scan_defconfigs(jobs)
|
params_list = self.scan_defconfigs(jobs)
|
||||||
self.insert_maintainers_info(params_list)
|
warnings = self.insert_maintainers_info(params_list)
|
||||||
|
for warn in warnings:
|
||||||
|
print(warn, file=sys.stderr)
|
||||||
self.format_and_output(params_list, output)
|
self.format_and_output(params_list, output)
|
||||||
|
return not warnings
|
||||||
|
@ -188,12 +188,12 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
|
|||||||
board_file = os.path.join(options.output_dir, 'boards.cfg')
|
board_file = os.path.join(options.output_dir, 'boards.cfg')
|
||||||
|
|
||||||
brds = boards.Boards()
|
brds = boards.Boards()
|
||||||
brds.ensure_board_list(board_file,
|
ok = brds.ensure_board_list(board_file,
|
||||||
options.threads or multiprocessing.cpu_count(),
|
options.threads or multiprocessing.cpu_count(),
|
||||||
force=options.regen_board_list,
|
force=options.regen_board_list,
|
||||||
quiet=not options.verbose)
|
quiet=not options.verbose)
|
||||||
if options.regen_board_list:
|
if options.regen_board_list:
|
||||||
return 0
|
return 0 if ok else 2
|
||||||
brds.read_boards(board_file)
|
brds.read_boards(board_file)
|
||||||
|
|
||||||
exclude = []
|
exclude = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user