summaryrefslogtreecommitdiff
path: root/tools/buildman/builderthread.py
AgeCommit message (Collapse)AuthorFilesLines
2023-07-24buildman: Move copy_files() out ot BuilderThread classSimon Glass1-23/+24
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-24buildman: Tidy up some comments in builderthreadSimon Glass1-30/+36
Make sure all functions have full argument documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Tidy up reporting of a toolchain errorSimon Glass1-6/+1
Provide the text of the exception when something goes wrong. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Avoid passing result into _read_done_file()Simon Glass1-8/+11
Move the creating of the result object into the function which sets it up, to simplify the code. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Create a function to handle config and buildSimon Glass1-36/+61
Move this code into a _config_and_build() function, so reduce the size of run_commit(). Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move checkout code to a separate functionSimon Glass1-9/+21
Put this in its own function to reduce the size of the run_commit() function Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move code to decide output dirsSimon Glass1-9/+25
Put this in its own function to reduce the size of the run_commit() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move code to remove old outputsSimon Glass1-9/+19
Put this in its own function to reduce the size of the run_commit() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move reading of the done file into a functionSimon Glass1-24/+42
Move this logic into its own function to reduce the size of the run_commt() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move bulid code into its own functionSimon Glass1-10/+30
Split this into its own function so reduce the size of run_commit(). Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move reconfigure code into its own functionSimon Glass1-11/+30
Split this into its own function so reduce the size of run_commit(). Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Convert config_out to string IOSimon Glass1-4/+5
This is probably a little more efficient and it allows passing the object to another function to write data. Convert config_out to use a string I/O device. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move more things into _build_args()Simon Glass1-21/+34
Move more of the argument-building code into this function. Fix a missing assignment for out_rel_dir too. Rename the function since it now builds all the arguments. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Move setting of toolchain arguments to _build_args()Simon Glass1-4/+5
Move a few more pieces to this new function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Start a function to set up the make argumentsSimon Glass1-15/+23
Move some of this code into a new funciion, to help reduce the size of the run_commits() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Drop unnecessary assignment of config_outSimon Glass1-1/+0
This is already set up earlier in the function, so drop the extra assignment. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Correct invalid use of out_dir variableSimon Glass1-2/+2
This variable has a different meaning in the outer scope. Use a different name to avoid confusion, or bugs. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Export _get_output_dir() to avoid warningsSimon Glass1-1/+1
Make this a public memory since it is used outside the class. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Correct most pylint warnings in builderthreadSimon Glass1-44/+51
Fix the easy warnings in this file. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Convert camel case in builderthread.pySimon Glass1-25/+25
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24buildman: Convert camel case in builder.pySimon Glass1-13/+13
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-04buildman: Pass -Werror to the host compiler tooSimon Glass1-0/+1
The host compiler is not failing on warnings at present, when the -E flag is used in buildman. Add the required flag to fix this. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com>
2023-03-08patman: Move library functions into a library directorySimon Glass1-1/+1
The patman directory has a number of modules which are used by other tools in U-Boot. This makes it hard to package the tools using pypi since the common files must be copied along with the tool that uses them. To address this, move these files into a new u_boot_pylib library. This can be packaged separately and listed as a dependency of each tool. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08buildman: Add a flag for reproducible buildsSimon Glass1-0/+2
This is quite a useful thing to use when building since it avoids small size changes between commits. Add a -r flag for it. Also undefine CONFIG_LOCALVERSION_AUTO since this appends the git hash to the version string, causing every build to be slightly different. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08buildman: Support disabling LTOSimon Glass1-0/+2
This cuts down build performance considerably and is not always needed, when checking for build errors, etc. Add a flag to disable it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08buildman: Write out the build command usedSimon Glass1-0/+13
It is sometimes useful to see the exact 'make' command used by buildman for a commit. Add an output file for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-23buildman: Add --allow-missing flag to allow missing blobsTom Rini1-0/+2
Add a new flag to buildman so that we will in turn pass BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI. Allow the settings file to control this. Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-23buildman: Detect binman reporting missing blobsSimon Glass1-1/+5
Buildman should consider a build as a success (with warnings) if missing blobs have been dealt with by binman, even though buildman itself returns and error code overall. This is how other warnings are dealt with. We cannot easily access the 103 exit code, so detect the problem in the output. With this change, missing blobs result in an exit code of 101, although they still indicate failure. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-05buildman: Avoid using board as a variableSimon Glass1-3/+3
We have a module called 'board'. Sometimes buildman uses 'brd' as an instance variable but sometimes it uses 'board', which is confusing and can mess with the module handling. Update the code to use 'brd' consistently, making it easier for tools to determine when the module is being referenced. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in gitutil.pySimon Glass1-1/+1
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in command.pySimon Glass1-5/+5
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Allow adjusting board config on the flySimon Glass1-6/+24
Add a -a option to specify changes to the config before the build commences. For example buildman -a ~CONFIG_CMDLINE disables CONFIG_CMDLINE before doing the build. This makes it easier to try things out as well as to write tests without creating a new board or manually manging the .config file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Provide a hint on how to debug thread crashesSimon Glass1-1/+1
If a thread crashes it is helpful to try the operation again with threading disabled. Add a hint about that. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-20buildman: Write output even on fatal errorSimon Glass1-6/+6
At present buildman does not write any output (to the 'out' and 'err) files if the build terminates with a fatal error. This is to avoid adding lots of spam to the logs. However there are times when this is actually useful, such as when the build fails for an obscure reason such as a Kconfig loop. Update the logic to always write the output, so that the user gets a clue as to what is happening. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29buildman: Use bytes for the environmentSimon Glass1-3/+2
At present we sometimes see problems in gitlab where the environment has 0x80 characters or sequences which are not valid UTF-8. Avoid this by using bytes for the environment, both internal to buildman and when writing out the 'env' file. Add a test to make sure this works as expected. Reported-by: Marek Vasut <marex@denx.de> Fixes: e5fc79ea718 ("buildman: Write the environment out to an 'env' file") Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29buildman: Handle exceptions in threads gracefullySimon Glass1-1/+13
There have been at least a few cases where an exception has occurred in a thread and resulted in buildman hanging: running out of disk space and getting a unicode error. Handle these by collecting a list of exceptions, printing them out and reporting failure if any are found. Add a test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29buildman: Use common code to send an resultSimon Glass1-8/+13
At present the code to report a build result is duplicated. Put it in a common function to avoid this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29buildman: Tidy up a few commentsSimon Glass1-3/+7
Add some function comments which are missing, or missing arguments. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-06buildman: Add an encoding to the out-env fileSimon Glass1-1/+2
The environment may contain some unicode characters. At least that is what seemed to happen on one commit: Building current source for 1 boards (0 threads, 64 jobs per thread) 0 0 0 /1 -1 (starting) Traceback (most recent call last): File ".../tools/buildman/buildman", line 64, in <module> ret_code = control.DoBuildman(options, args) File "tools/buildman/control.py", line 372, in DoBuildman options.keep_outputs, options.verbose) File ".../tools/buildman/builder.py", line 1704, in BuildBoards results = self._single_builder.RunJob(job) File ".../tools/buildman/builderthread.py", line 526, in RunJob self._WriteResult(result, job.keep_outputs, job.work_in_output) File ".../tools//buildman/builderthread.py", line 349, in _WriteResult print('%s="%s"' % (var, env[var]), file=fd) UnicodeEncodeError: 'ascii' codec can't encode characters in position 311-312: ordinal not in range(128) The problem defies repetition with any change at all to buildman. But let's set an encoding in any case. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-05buildman: Support single-threaded operationSimon Glass1-3/+13
At present even if only a single thread is in use, buildman still uses threading. For some debugging it is helpful to do everything in the main process. Allow -T0 to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-23buildman: Remove output binaries before buildingSimon Glass1-1/+13
Buildman reuses build directories from previous builds to avoid the cost of 'make mrproper' for every build. If the previous build produced an SPL image but the current one does not, the SPL image will remain and buildman will think it is a result of building the current board. Remove these files before building, to avoid this problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26patman: Move to absolute importsSimon Glass1-2/+2
At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26buildman: Write output files when using -wSimon Glass1-14/+17
At present buildman does not write its own output files (err, done, the environment) when using -w. However this is useful for when the build is run with -s to check it. In fact ProduceResultSummary() reads the result from those files rather than using the 'result' info directly. So ProcessResult() does not work with -w at present. It does not print any output. Fix this by writing output files even when -w is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26buildman: Use out-env for environment outputSimon Glass1-1/+1
At present the environment used by U-Boot is written to the 'env' directory. This is fine when the output directory is not the same as the source directory, but when it is (as with -w) it conflicts with the source directory of the same name. Rename 'env' to 'out-env' to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Make -I the defaultSimon Glass1-3/+3
At present buildman defaults to running 'mrproper' on every thread before it starts building commits for each board. This can add a delay of about 5 seconds to the start of the process, since the tools and other invariants must be rebuilt. In particular, a build without '-b', to build current source, runs much slower without -I, since any existing build is removed, thus losing the possibility of an incremental build. Partly this behaviour was to avoid strange build-system problems caused by running 'make defconfig' for one board and then one with a different architecture. But these problems were fixed quite a while ago. The -I option (which disabled mrproper) was introduced four years ago and does not seem to cause any problems with builds. So make -I the default and deprecate the option. To allow use of 'mrproper', add a new -m flag. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-11bulidman: Add support for a simple buildSimon Glass1-8/+20
It is useful to run a simple build and put all the output in a single directory. Add a -w option to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-11buildman: Document the members of BuilderJobSimon Glass1-1/+5
This class has a few more members now. Add documentation for them and fix a nit in the 'commits' comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-05buildman: Convert to Python 3Simon Glass1-13/+11
Convert buildman to Python 3 and make it use that, to meet the 2020 deadline. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-02-09buildman: Write the environment out to an 'env' fileSimon Glass1-0/+3
Sometimes it is useful to see the environment that was used to build U-Boot. Write this out to a file in the build directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-01-15buildman: Add support for building with clangSimon Glass1-0/+1
Add a -O option which allows building with clang. Signed-off-by: Simon Glass <sjg@chromium.org>