Commit graph

462 commits

Author SHA1 Message Date
Simon Glass
e2ca257287 buildman: Support a tilde to represent the home directory
It is convenient to use ~ to represent the home directory in the
settings file. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
eae1eb0e86 buildman: Correct logic for adding a toolchain
If the toolchain is bad, it should not be added. Correct the logic for
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
a79a9ebee0 buildman: Document the toolchain-prefix section
This is mentioned in examples but should have its own mention in the
'settings' documentation. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
d6ebe17d9d buildman: Correct the indentation in the setting-up section
The example settings file should be indented so that it shows correctly
in the output. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
6bf74a2e0b buildman: Support #include files in defconfigs
This is used by some boards in U-Boot and is a convenient way to deal
with common settings where using a Kconfig files is not desirable.

Detect #include files and process them as if they were part of the
original file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/30
2024-11-19 10:04:47 -06:00
Simon Glass
6d66ded18e buildman: Set up the tout library
Use this to control info and debugging messages. Enable them if -v is
given.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
a63fcdb9a4 buildman: Add a lower-level test for KconfigScanner
This code is tested by test_scan_defconfigs() but it is useful to have
some specific tests for the KconfigScanner's operation in U-Boot. Add
a test which checks that the values are obtained correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-19 10:04:47 -06:00
Simon Glass
02eb9f1665 buildman: Correct some warnings about regex strings
With Python 3.12 some warnings have cropped up. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Simon Glass
ba134c3531 buildman: Allow skipping the dtc build
For most boards, the device-tree compiler is built in-tree, ignoring the
system version. Add a special option to skip this build. This can be
useful when the system dtc is up-to-date, as it speeds up the build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
bf984a6a00 buildman: Retry the build for current source
Buildman retries a failed build when processing a branch, but does not
do this when building current source. It is useful to do this retry in
both cases, so add the logic for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Jerome Forissier
0c2d7ad3e0 buildman/toolchain.py: do not set CROSS_COMPILE for sandbox
When building for sandbox, self.cross is empty.

In MakeEnvironment(), CROSS_COMPILE is defined to be self.cross (with
or without a full path), optionally prefixed by the toolchain wrapper
defined in ~/.buildman. This is fine when self.cross is not empty, but
it doesn't make sense when it is:
- Either there is no wrapper and we end up with an empty CROSS_COMPILE
which is the same as not defining it (the host compiler will be used),
- Or there is a wrapper and CROSS_COMPILE will contain only the wrapper
which obviously is not a valid compiler, hence an error.

Test case:

 $ sudo apt install ccache
 $ grep -q toolchain-wrapper ~/.buildman || \
     printf "[toolchain-wrapper]\nwrapper = ccache\n" >>~/.buildman
 $ make mrproper
 $ ./tools/buildman/buildman sandbox_noinst
 $ ./tools/buildman/buildman sandbox_noinst
 Building current source for 1 boards (1 thread, 24 jobs per thread)
    sandbox:  +   sandbox_noinst
 +arch/sandbox/lib/reloc_sandbox_efi.c:10:15: error: operator '==' has no left operand
 +   10 | #if HOST_ARCH == HOST_ARCH_X86_64
 +      |               ^~
[...]

The GetEnvArgs function is modified too, since the VAR_CROSS_COMPILE
case has the same issue.

In tools/buildman/test.py, testGetEnvArgs is extended and
testMakeEnvironment is added. They check the 'arm' and 'sandbox'
toolchains, with and without a wrapper.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-09-24 13:41:20 -06:00
Simon Glass
d0f74bd417 buildman: Support building within a Python venv
The Python virtualenv tool sets up a few things in the environment,
putting its path first in the PATH environment variable and setting up
a sys.prefix different from the sys.base_prefix value.

At present buildman puts the toolchain path first in PATH so that it can
be found easily during the build. For sandbox this causes problems since
/usr/bin/gcc (for example) results in '/usr/bin' being prepended to the
PATH variable. As a result, the venv is partially disabled.

The result is that sandbox builds within a venv ignore the venv, e.g.
when looking for packages.

Correct this by detecting the venv and adding the toolchain path after
the venv path.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-06 12:45:54 -06:00
Hiago De Franco
1bf048f21b tools/scripts/Kconfig: Update references from kconfig-language.txt to rst
The Linux kernel documentation has transitioned from using
kconfig-language.txt to kconfig-language.rst. Therefore update all
occurrences of kconfig-language.txt.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
2024-08-27 18:01:32 -06:00
Simon Glass
ab84ffccd6 buildman: Make test_process_limit handle time.monotonic()
Newer versions of filelock use time.monotonic() instead of time.time().
Update the test the handle this.

It would be better if filelock had support for writing unit tests which
use locking.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:48 -06:00
Simon Glass
e8effc3854 buildman: Show board list with -x
When -x is used, buildman does not show the list of boards that will be
built, since there are no terms which cause boards to be added, only
terms which cause them to be removed.

Add a special case to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com>
2024-07-26 08:01:06 -06:00
Tom Rini
e13fcae3fc Revert "buildman: Always use the full path in CROSS_COMPILE"
There are operations in buildman that result in running the cross-tools
(such as performing size checks) and now that we have not modified PATH
to know where our tools are, these operations fail.

This reverts commit 6c0a3cf75f.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-08 09:12:34 -06:00
Simon Glass
6c0a3cf75f buildman: Always use the full path in CROSS_COMPILE
The feature to set the toolchain path does not seem to be needed. It
causes problems with venv (see [1]). Let's remove it.

Add some tests while we are here.

It does not look like any docs changes are needed for this.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20240621131423.2363294-6-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
2024-07-03 07:36:33 +01:00
Simon Glass
57abd7c549 buildman: Fix a few typos in toolchain code
Fix 'Thie' and capitalise 'unicode'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-07-03 07:36:33 +01:00
Simon Glass
fa77b51072 buildman: Add python3-pycryptodome
This is used by some Binman entry types, so add it to allow more tests
to pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2024-07-03 07:36:33 +01:00
Simon Glass
e70bac90ff buildman: Add python3-coverage
Add this package so we can run code-coverage tests for Binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2024-07-03 07:36:33 +01:00
Simon Glass
5d679f801d buildman: Add a way to limit the number of buildmans
Buildman uses all available CPUs by default, so running more than one or
two concurrent processes is not normally useful.

However in some CI cases we want to be able to run several jobs at once
to save time. For example, in a lab situation we may want to run a test
on 20 boards at a time, since only the build step actually takes much
CPU.

Add an option which allows such a limit. When buildman starts up, it
waits until the number of running processes goes below the limit, then
claims a spot in the list. The list is maintained with a temporary file.

Note that the temp file is user-specific, since it is hard to create a
locked temporary file which can be accessed by any user. In most cases,
only one user is running jobs on a machine, so this should not matter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Simon Glass
8941477e02 buildman: Add a flag to force mrproper on failure
When a file is removed by a commit (e.g. include/common.h yay!) it can
cause incremental build failures since one of the dependency files from
a previous build may mention the file.

Add an option to run 'make mrproper' automatically when a build fails.
This can be used to automatically resolve the problem, without always
adding the large overhead of 'make mrproper' to every build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Simon Glass
7e93bd30b1 buildman: Avoid rebuilding when --mrproper is used
When this flag is enabled, 'make mrproper' is always used when
reconfiguring, so there is no point in doing it again.

Update this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Simon Glass
3187da4bea buildman: Make mrproper an argument to run_commit()
Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Simon Glass
3f972a4655 buildman: Make mrproper an argument to _config_and_build()
Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Simon Glass
49b158a492 buildman: Make mrproper an argument to _reconfigure()
Pass this in so the caller can change it independently of the member
variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Brandon Maier
698b60a6a2 tools: binman: fix deprecated Python ConfigParser methods
The method `ConfigParser.readfp()` is marked deprecated[1].

In Python 3.12 this method have been removed, so replace it with
`ConfigParser.read_file()`.

[1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Brandon Maier
357bfca5e6 tools: binman: fix deprecated Python unittest methods
The methods `unittest.assertEquals()` and
`unittest.assertRegexpMatches()` are marked deprecated[1].

In Python 3.12 these aliases have been removed, so do a sed to replace
them with their new names.

[1] https://docs.python.org/3.11/library/unittest.html#deprecated-aliases

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
CC: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:33 +01:00
Heinrich Schuchardt
d881da3b42 tools: typo arguemnts
%s/arguemnts/arguemnts/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-05-03 12:22:58 -06:00
Quentin Schulz
341e8a6c7c tools: buildman: fix non-existing SafeConfigParser in Python 3.12+
SafeConfigParser was renamed back in Python 3.2 (yes, no typo) to
ConfigParser[1], but it was still working as an alias until it got
removed in 3.12[2].

[1] https://docs.python.org/3.8/whatsnew/3.2.html#configparser
[2] https://github.com/python/cpython/pull/92503

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2024-01-29 14:54:15 -05:00
Neha Malcom Francis
10fee88d42 tools: binman: ti_board_cfg: Check for linting problems
Use yamllint for checking whether YAML configuration files are adhering
to default yamllint rules.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Suggested-by: Nishanth Menon <nm@ti.com>
2024-01-18 17:50:27 -05:00
Heinrich Schuchardt
86aeacca67 buildman: type cotaining
%s/cotaining/containing/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-12-31 07:21:02 -07:00
Simon Glass
049ee90903 tools: Move python tools to version 0.0.6
A new release has been done with this version, so update it. Use the
version numbers in dependencies also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-13 18:39:06 -05:00
Simon Glass
4c4977cbc9 doc: Update documentation URL
Update to use the new docs.u-boot.org URL for documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-13 18:39:05 -05:00
Simon Glass
dc314185be buildman: Use oldconfig when adjusting the config
We cannot be sure that the new config is consistent, particularly when
changing a major item like CONFIG_CMDLINE. Use 'make oldconfig' to
check that and avoid any such problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-07 14:48:19 -05:00
Simon Glass
ad8dbabc22 buildman: Include symbols in the read-only data section
When symbols switch between the inited data section and the read-only
data section their visbility changes, at present, with the -B option.

This is confusing, since adding 'const' to a variable declaration can
make it look like a significant improvement in bloat. But in fact
nothing has changed.

Add 'r' to the list of symbols types that are recorded, to correct this
problem. Add a constant to make it easier to find this code next time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-11-02 22:38:01 -04:00
Tom Rini
ac897385bb Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-02 10:55:44 -04:00
Simon Glass
2ce06f56cb buildman: Start the clock when the build starts
The Kconfig and maintainer processing can take a while, sometimes 5
seconds or more. This skews the timing printed by buildmand when the build
completes. Start the clock when the threads start to avoid this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
2023-09-23 12:31:25 -06:00
Simon Glass
283dcb63cb buildman: Show progress when regenerating the board.cfg file
This can take a while, so show a message when starting.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by Tom Rini <trini@konsulko.com>
2023-09-23 12:31:25 -06:00
Simon Glass
124a0da554 buildman: Keep all common output files
Make a list of common output extensions and use it to ensure that the -k
option preserves all of these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-09-23 12:31:25 -06:00
Simon Glass
305114eb83 buildman: Fix full help for Python 3.8
With Python versions older than 3.9 Buildman produces an error on
start-up. Fix this with a workaround for importlib.

There is already a workaround for v3.6 but I am not sure if that is still
functioning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-09-23 09:00:37 -06:00
Tom Rini
1193428152 CI: Update to gcc-13.2.0
The latest kernel.org toolchains for gcc are now 13.2.0, so upgrade to
that.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-26 10:07:48 -04:00
Simon Glass
48d4c0a85d buildman: Drop warning about orphaned defconfigs
Some boards use a MAINTAINERS entry to specify common files without
referencing any defconfigs. This is allowed and should not result in a
warning.

Drop the warning in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Simon Glass
1c81e0808b buildman: Exit after reading toolchain
Recent refactoring changed buildman to continue operation after fetching
a toolchain. Fix this.

Fixes: b868064652 ("bulidman: Move toolchain handling to a function")

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Simon Glass
ad1c9b26a8 buildman: Specify the output directory in tests
The default output directory is generally '../' in tests so we end up
trying to create '../.bm-work'. This does not work with azure, so update
these tests to use the temporary directory instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-25 11:39:38 -04:00
Simon Glass
407a1413e3 buildman: Enable test coverage
Enable measuring test coverage for buildman so we can see the gaps. It is
currently at 68%.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ba8d099b95 buildman: Add an option to check maintainers and targets
In poking around it seems that many boards don't define a CONFIG_TARGET
Kconfig variable. This is not strictly necessary, but add an option to
buildman so these can be viewed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
39dbcaa1ad buildman: Use -D for --debug
Change -D to mean --debug for consistency with other tools. This is not a
commonly used option, so the impact should be minimal.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ad0378748e buildman: Add a way to print the architecture for a board
This is useful for some tools and is easily available for buildman. Add
a new --print-arch option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
2ecc5805ac buildman: Move copy_files() out ot BuilderThread class
This does not need to be in the class. Move it out to avoid a pylint
warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00