summaryrefslogtreecommitdiff
path: root/tools/buildman/builder.py
AgeCommit message (Collapse)AuthorFilesLines
2021-04-29buildman: Handle exceptions in threads gracefullySimon Glass1-5/+17
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-03-05buildman: Support single-threaded operationSimon Glass1-22/+38
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>
2021-02-14buildman: 'Thread' object has no attribute 'isAlive'Heinrich Schuchardt1-1/+1
The isAlive() method was deprecated in Python 3.8 and has been removed in Python 3.9. See https://bugs.python.org/issue37804. Use is_alive() instead. Since Python 2.6 is_alive() has been a synonym for isAlive(). So there should be no problems for users using elder Python 3 versions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22buildman: Use git worktrees instead of git clones when possibleAlper Nebi Yasak1-8/+40
This patch makes buildman create linked working trees instead of clones of the source repository, but keeps updating the older clones of the repository that might already exist. These worktrees share "everything except working directory specific files such as HEAD, index, etc." with the source repository. See the git-worktree(1) manual page for more information. If git-worktree isn't available, silently falls back to cloning the repository. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2020-07-29buildman: Show the build rate at the endSimon Glass1-1/+2
It is interesting to note the number of builds completed per second to track machine performance and build speed. Add a 'rate' value at the end of the build to show this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-06-12buildman: Remove _of_#_ from results directory pathsOvidiu Panait1-5/+5
Currently, the following scenario will rebuild the first commit even though it is not really necessary - the commit sha or the position in the patchset did not change: $ git am <local-patch-0001> $ tools/buildman/buildman -P -E -W -b master mx6 <do some more development work> $ git am <local-patch-0002> $ tools/buildman/buildman -P -E -W -b master mx6 <- will rebuild the first commit as well, even though nothing has changed about it. This is due to the fact that previous results directories get removed when the number of commits change. By removing the _of_#_ part of the directory path, the commits will be rebuilt only if the commit sha or the position in the patchset changes. Also, update the testcase to reflect this change. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-04-26patman: Move to absolute importsSimon Glass1-4/+4
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: Move to absolute importsSimon Glass1-2/+2
At present buildman 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 buildman to use absolute imports. Also adjust moveconfig.py too since it uses some buildman modules and cannot work without this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26buildman: Write output files when using -wSimon Glass1-0/+5
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-21buildman: Add an option to ignore migration warningsSimon Glass1-1/+11
These are becoming more common now. They cause boards to show warnings which can be mistaking for compiler warnings. Add a buildman option to ignore them. This option works only with the summary option (-s). It does not affect the build process. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Add an option to ignore device-tree warningsSimon Glass1-10/+17
Unfortunately the plague of device-tree warnings has not lifted. These warnings infiltrate almost every build, adding noise and confusion. Add a buildman option to ignore them. This option works only with the summary option (-s). It does not affect the build process. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Make -I the defaultSimon Glass1-4/+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-21buildman: Show a summary of the build resultSimon Glass1-0/+17
When buildman finishes it leaves the last summary line visible, which shows the number of successful builds, builds with warnings and builds with errors. It is useful also to see how many builds were done in total along with the time taken. Show these on a separate line before buildman finishes. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Limit the length of progress messagesSimon Glass1-1/+1
If a progress message is longer than the terminal line it will scroll the terminal. Limit the messages to the terminal width. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Show the number of builds remainingSimon Glass1-4/+9
It is nice to see the actual number of builds remaining to complete. Add this in the progress message, using a different colour. Drop the unnecessary 'name' variable while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Drop unused output codeSimon Glass1-5/+0
The commit counter is a hangover from when buildman processed each board for a commit. Now buildman processes each commit for a board, so this output is never triggered. Delete it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Show a message when fetching a repoSimon Glass1-1/+4
Fetching updated versions of a repo can take time. At present buildman gives no indication that it is doing this. Add a message to explain the delay. Tidy up a few other messages while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Drop the line-clearing code in BuilderSimon Glass1-25/+3
The new feature in terminal can be used by buildman. Update the Builder class accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Use spaces in the board listSimon Glass1-1/+1
At present the board names shown with -l are separated by commas. This makes it hard to double-click to select a particular board. Also it is not possible to select all boards and paste them as arguments to a subsequent buildman run, since buildman requires spaces to separate the list on the command line, not commas. Change the output format to use spaces instead of commas. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Show the list of boards in magentaSimon Glass1-4/+11
It is quite hard to see the list of board for each error line since the colour is the same as the actual error line. Show the board list in magenta so that it is easier to distinguish them. There is no point in checking the colour of the overall line, since there are now multiple colours. So drop those tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Use an object to hold error linesSimon Glass1-17/+52
At present the string for each error line is created in _CalcErrorDelta() and used to create the summary output. This is inflexible since all the information (error/warning character, error line, list of boards with that error line) is munged together in a string. Create an object to hold this information and only convert it to a string when printing the actual output. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Use yellow consistently for warning linesSimon Glass1-1/+1
At present warnings are shown in yellow in the summary (-s) but magenta in the detail listing (-e). Use yellow in both. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21buildman: Refactor error-line output int a functionSimon Glass1-13/+19
Reduce the amount of repeated code by creating an _OutputErrLines() function to hold this code. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-11buildman: Allow building within a subdir of the current dirSimon Glass1-1/+2
This is useful in some situations, in particular with -w and when building in-tree. Now that we are more careful about what we remove in _PrepareOutputSpace(), it should be safe to relax this restriction. Update the progress information also so it is clear what buildman is doing. Remove files can take a long time. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-11buildman: Be more selective about which directories to removeSimon Glass1-5/+22
At present buildman removes any directory it doesn't intend to write output into. This is overly expansive since if the output directory happens to be somewhere with existing files, they may be removed. Using an existing directory for buildman is not a good practice, but since the result might be catastrophic, it is best to guard against it. A previous commit[1] fixed this by refusing to write to a subdirectory of the current directory, assumed to have U-Boot source code. But we can do better by only removing directories that look like the ones buildman creates. Update the code to do this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> [1] 409fc029c40 tools: buildman: Don't use the working dir as build dir
2020-04-11buildman: Update help for -dSimon Glass1-3/+3
This help is a bit ambiguous. It only does anything if asked to show size changes with -S. Update the help and the function comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-11bulidman: Add support for a simple buildSimon Glass1-2/+13
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-01-30tools: buildman: fix typoFlavio Suligoi1-1/+1
Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-12-11buildman: Ignore blank lines during size checksTom Rini1-1/+2
Today when parsing the .sizes files we get a warning about an invalid line in the file as it's blank. Solve this by checking that we have a non-blank line prior to processing. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-05buildman: Convert to Python 3Simon Glass1-24/+23
Convert buildman to Python 3 and make it use that, to meet the 2020 deadline. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-05-22buildman: Deal more nicely with invalid build-status fileSimon Glass1-1/+6
The 'done' files created by buildman may end up being empty if buildman runs out of disk space while writing them. At present buildman dies with an exception when using -s to check the build status. Fix this. Seriesl-cc: trini Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-21buildman: Show boards with warning with w+Simon Glass1-4/+13
At present we should boards with warnings in the same way as those with errors. This is not ideal. Add a new 'warn' state and show these listed in yellow to match the actual warning lines printing with -e. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-21buildman: Rename the good, better, worse variablesSimon Glass1-14/+14
At present we don't distinguish between errors and warnings when printing the architecture summary. Rename the variables to better describe their purpose. 'Worse' at present means we got an error, so use that as the name. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-21buildman: Detect dtc warningsSimon Glass1-1/+3
At present messages from the device-tree compiler like this: arch/arm/dts/socfpga_arria10_socdk_sdmmc.dtb: Warning (avoid_unnecessary_addr_size): /clocks: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property are detected as errors since they don't match the gcc warning regex. Add a new one for dtc to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29buildman: Avoid hanging when the config changesSimon Glass1-1/+1
Something has changed in the last several month such that when buildman builds U-Boot incrementally and a new CONFIG option has been added to the Kconfig, the build hanges waiting for input: Test new config (NEW_CONFIG) [N/y/?] (NEW) Since binamn does not connect the build's stdin to anything this waits on stdin to the build thread, which never comes. Eventually I suspect all the threads end up in this state and the build does not progress. Fix this by passing /dev/null as input to the build. That way, if there is a new CONFIG, the build will stop (and fail): Test new config (NEW_CONFIG) [N/y/?] (NEW) Error in reading or end of file. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07buildman: Add support for environment delta in summaryAlex Kiernan1-15/+113
When summarising the builds, add the -U option to emit delta lines for the default environment built into U-Boot at each commit. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-05buildman: add option -E for treating compiler warnings as errorsDaniel Schwierzeck1-1/+4
Add a new option '-E' for treating all compiler warnings as errors. Eventually this will pass 'KCFLAGS=-Werror' to Kbuild. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2017-06-09buildman: Fix bloat option when 'new' only drops functionsTom Rini1-1/+1
In the case where a new build only decreases sizes and does not increase any size we still want to report what functions have been dropped when doing a bloat comparison. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-13buildman: Handle commit subjects containing unicodeSimon Glass1-2/+3
One of these has crept in in this commit: 40a808f1 ARCv2: SLC: Make sure busy bit is set properly on SLC flushing Adjust buildman to handle it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-12-02buildman: Clean up odd characters on the terminalSimon Glass1-1/+1
At present buildman leaves behind a few characters during its progress updates, which looks odd. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-12-02buildman: Squash useless output from -KSimon Glass1-12/+22
When using #define CONFIG_SOME_OPTION, the value it set to '1'. When using defconfig (i.e. CONFIG_SOME_OPTION=y) the value is set to 'y'. This results in differences showing up with -K. These differences are seldom useful. Adjust buildman to suppress these differences by default. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-12-02buildman: Add an option to just create the configSimon Glass1-1/+4
Normally buildman does a full build of a board. This includes creating the u-boot.cfg file which contains all the configuration options. Buildman uses this file with the -K option, to show differences in effective configuration for each commit. Doing a full build of U-Boot just to create the u-boot.cfg file is wasteful. Add a -D option which causes buildman to only create the configuration. This is enough to support use of -K and can be done much more quickly (typically 5-10 times faster). Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Don't show a stacktrace on Ctrl-CSimon Glass1-0/+7
When Ctrl-C is pressed, just exited quietly. There is no sense in displaying a stack trace since buildman will always be in the same place: waiting for threads to complete building all the jobs on the queue. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Drop the 'active' flag in the builderSimon Glass1-7/+0
This serves no real purpose, since when we are not active, we exit. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Allow builds to terminate cleanlySimon Glass1-2/+6
It is annoying that buildman does not respond cleanly to Ctrl-C or SIGINT, particularly on machines with lots of CPUS. Unfortunately queue.join() blocks the main thread and does not allow it to see the signal. Use a separate thread instead, Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Print a message indicating the build is startingSimon Glass1-0/+1
Make it clear when buildman actually starts building. This happens when it has prepared the threads, working directory and output directories. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Print a message when removing old directoriesSimon Glass1-0/+6
When buildman starts, it prepares its output directory by removing any old build directories which will not be used this time. This can happen if a previous build left directories around for commit hashes which are no-longer part of the branch. This can take quite a while, so print a message to indicate what is going on. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-09buildman: Tidy up the 'cloning' messageSimon Glass1-1/+3
On a machine with a lot of CPUs this prints a lot of useless lines of the form: Cloning repo for thread <n> Adjust the output so that these all appear on one line, and disappear when the cloning is complete. Note: This cloning is actually unnecessary and very wasteful on disk space (about 3.5GB each time). It would be better to create symlinks. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17buildman: allow more incremental buildingStephen Warren1-2/+8
One use-case for buildman is to continually run it interactively after each small step in a large refactoring operation. This gives more immediate feedback than making a number of commits and then going back and testing them. For this to work well, buildman needs to be extremely fast. At present, a couple issues prevent it being as fast as it could be: 1) Each time buildman runs "make %_defconfig", it runs "make mrproper" first. This throws away all previous build results, requiring a from-scratch build. Optionally avoiding this would speed up the build, at the cost of potentially causing or missing some build issues. 2) A build tree is created per thread rather than per board. When a thread switches between building different boards, this often causes many files to be rebuilt due to changing config options. Using a separate build tree for each board would avoid this. This does put more strain on the system's disk cache, but it is worth it on my system at least. This commit adds two command-line options to implement the changes described above; -I ("--incremental") turns of "make mrproper" and -P ("--per-board-out-dir") creats a build directory per board rather than per thread. Tested: ./tools/buildman/buildman.py tegra ./tools/buildman/buildman.py -I -P tegra ./tools/buildman/buildman.py -b tegra_dev tegra ./tools/buildman/buildman.py -b tegra_dev -I -P tegra ... each once after deleting the buildman result/work directory, and once "incrementally" after a previous identical invocation. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org> # v1 Tested-by: Simon Glass <sjg@chromium.org> # v1 Acked-by: Simon Glass <sjg@chromium.org>