mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-17 07:21:36 +01:00
buildman: Provide an argument to the -R option
Allow writing the file to a selected location, since otherwise this is controlled by the buildman configuration, so cannot be determined by the caller. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/17
This commit is contained in:
parent
1b21842eab
commit
a1431e6c97
@ -1303,9 +1303,10 @@ 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 <filename>` flag to force
|
||||||
of the file - in that case buildman exits after writing the file. with exit code
|
regeneration of the file - in that case buildman exits after writing the file
|
||||||
2 if there was an error in the maintainer files.
|
with exit code 2 if there was an error in the maintainer files. To use the
|
||||||
|
default filename, use a hyphen, i.e. `-R -`.
|
||||||
|
|
||||||
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.
|
||||||
|
|||||||
@ -106,7 +106,7 @@ def ParseArgs():
|
|||||||
default=False, help="Use an O= (output) directory per board rather than per thread")
|
default=False, help="Use an O= (output) directory per board rather than per thread")
|
||||||
parser.add_option('-r', '--reproducible-builds', action='store_true',
|
parser.add_option('-r', '--reproducible-builds', action='store_true',
|
||||||
help='Set SOURCE_DATE_EPOCH=0 to suuport a reproducible build')
|
help='Set SOURCE_DATE_EPOCH=0 to suuport a reproducible build')
|
||||||
parser.add_option('-R', '--regen-board-list', action='store_true',
|
parser.add_option('-R', '--regen-board-list', type='string',
|
||||||
help='Force regeneration of the list of boards, like the old boards.cfg file')
|
help='Force regeneration of the list of boards, like the old boards.cfg file')
|
||||||
parser.add_option('-s', '--summary', action='store_true',
|
parser.add_option('-s', '--summary', action='store_true',
|
||||||
default=False, help='Show a build summary')
|
default=False, help='Show a build summary')
|
||||||
|
|||||||
@ -209,6 +209,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
|
|||||||
if not os.path.exists(options.output_dir):
|
if not os.path.exists(options.output_dir):
|
||||||
os.makedirs(options.output_dir)
|
os.makedirs(options.output_dir)
|
||||||
board_file = os.path.join(options.output_dir, 'boards.cfg')
|
board_file = os.path.join(options.output_dir, 'boards.cfg')
|
||||||
|
if options.regen_board_list and options.regen_board_list != '-':
|
||||||
|
board_file = options.regen_board_list
|
||||||
|
|
||||||
brds = boards.Boards()
|
brds = boards.Boards()
|
||||||
if options.maintainer_check:
|
if options.maintainer_check:
|
||||||
|
|||||||
@ -233,28 +233,32 @@ class TestFunctional(unittest.TestCase):
|
|||||||
return command.run_pipe([[self._buildman_pathname] + list(args)],
|
return command.run_pipe([[self._buildman_pathname] + list(args)],
|
||||||
capture=True, capture_stderr=True)
|
capture=True, capture_stderr=True)
|
||||||
|
|
||||||
def _RunControl(self, *args, brds=None, clean_dir=False,
|
def _RunControl(self, *args, brds=False, clean_dir=False,
|
||||||
test_thread_exceptions=False):
|
test_thread_exceptions=False, get_builder=True):
|
||||||
"""Run buildman
|
"""Run buildman
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
args: List of arguments to pass
|
args: List of arguments to pass
|
||||||
brds: Boards object
|
brds: Boards object, or False to pass self._boards, or None to pass
|
||||||
|
None
|
||||||
clean_dir: Used for tests only, indicates that the existing output_dir
|
clean_dir: Used for tests only, indicates that the existing output_dir
|
||||||
should be removed before starting the build
|
should be removed before starting the build
|
||||||
test_thread_exceptions: Uses for tests only, True to make the threads
|
test_thread_exceptions: Uses for tests only, True to make the threads
|
||||||
raise an exception instead of reporting their result. This simulates
|
raise an exception instead of reporting their result. This simulates
|
||||||
a failure in the code somewhere
|
a failure in the code somewhere
|
||||||
|
get_builder (bool): Set self._builder to the resulting builder
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
result code from buildman
|
result code from buildman
|
||||||
"""
|
"""
|
||||||
sys.argv = [sys.argv[0]] + list(args)
|
sys.argv = [sys.argv[0]] + list(args)
|
||||||
options, args = cmdline.ParseArgs()
|
options, args = cmdline.ParseArgs()
|
||||||
|
if brds == False:
|
||||||
|
brds = self._boards
|
||||||
result = control.DoBuildman(options, args, toolchains=self._toolchains,
|
result = control.DoBuildman(options, args, toolchains=self._toolchains,
|
||||||
make_func=self._HandleMake, brds=brds or self._boards,
|
make_func=self._HandleMake, brds=brds, clean_dir=clean_dir,
|
||||||
clean_dir=clean_dir,
|
|
||||||
test_thread_exceptions=test_thread_exceptions)
|
test_thread_exceptions=test_thread_exceptions)
|
||||||
|
if get_builder:
|
||||||
self._builder = control.builder
|
self._builder = control.builder
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -1002,3 +1006,12 @@ endif
|
|||||||
self.assertEquals(2, len(params_list))
|
self.assertEquals(2, len(params_list))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
|
|
||||||
|
def testRegenBoards(self):
|
||||||
|
"""Test that we can regenerate the boards.cfg file"""
|
||||||
|
outfile = os.path.join(self._output_dir, 'test-boards.cfg')
|
||||||
|
if os.path.exists(outfile):
|
||||||
|
os.remove(outfile)
|
||||||
|
with test_util.capture_sys_output() as (stdout, stderr):
|
||||||
|
result = self._RunControl('-R', outfile, brds=None,
|
||||||
|
get_builder=False)
|
||||||
|
self.assertTrue(os.path.exists(outfile))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user