aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/cooker.py
AgeCommit message (Collapse)Author
2022-06-17cooker: Drop sre_constants usagejansa/1.50Richard Purdie
As reported by Martin Jansa <Martin.Jansa@gmail.com>: bitbake/lib/bb/cooker.py:16: DeprecationWarning: module 'sre_constants' is deprecated import sre_constants it's deprecated since 3.11 with: https://github.com/python/cpython/issues/91308 The correct replacement for our usage is re.error so use that instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-24cooker: Fix task-depends.dot for multiconfig targetsRichard Purdie
The right hand side of dependencies in the task dependency file generated by bitbake -g was missing multiconfig prefixes, corrupting the data. Fix this. [YOCTO #14621] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1d5ca721040c5e39aefa11219f62710de6587701) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-24cooker: Handle parsing results queue raceRichard Purdie
The previous fix introduced a race where the queue might not be empty but all the parser processes have exited. Handle this correctly to avoid occasional errors. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8e7f2b6500e26610f52d128b48ca0a09bf6fb2cb) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-24cooker: Remove debug code, oops :(Richard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 19291665fa8b6cc331290f2542af3e8e653203f1) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-24cooker: Handle parse threads disappearing to avoid hangsRichard Purdie
If one of the parse threads disappears during parsing for some reason, bitbake currently hangs. Avoid this (and zombie threads hanging around) by joining() threads which have exited. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit dc86a533d951d13643ce446533370da804782afc) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-16cooker: check if upstream hash equivalence server is availableJose Quaresma
When the user specify an invalid upstream hash equivalence server in BB_HASHSERVE_UPSTREAM notify the user that we can't connect the server. Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit be45aeb9a84f30c28711e87e2d2a4a86320a8d94) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
2021-09-24cooker/process: Fix typos in exiting messageMartin Jansa
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1ff1ea3880d293b14ce0fc65e3bc4c938d587a2f) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
2021-09-16cooker: Allow upstream for local hash equivalence serverJoshua Watt
The hash equivalence server has had the option to support a read-only upstream server for some time now when launched as a standalone program, but there was no way to set the upstream when using a locally started server. Add a new variable called BB_HASHSERVE_UPSTREAM that can be used to specify an upstream server when a local hash equivalence server is used (e.g. BB_HASHSERVE is "auto") Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 250fa17f1391ff1ee01ab9b51d2a4f9aa35c1d1e) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-12bitbake: cooker: Add REQUIRED_VERSION checksCharlie Davies
Add logic to check that if REQUIRED_VERSION has been set that the cooker class method findBestProviders properly handles the case where the REQUIRED_VERSION has not been found. Fixes [YOCTO #10096] Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-12bitbake: lib: add Required Version to Bitbake --show-versions commandCharlie Davies
This commit adds a new column to the Bitbake --show-versions command called Required Version. This column will display any packages which have a REQUIRED_VERSION successfully set. Fixes [YOCTO #10096] Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-20Force parser shutdown after catching an exceptionJan Brzezanski
Commit bebef58b21bdff7a3ee1fa2449b7df19144f26fd introduced forcing parser shutdown as default in case of build abort. In this case bitbake sometimes hangs after facing error during parsing, waiting for child processes to finish. Killing it then will spawn zombie processes. Thus we force the shutdown after catching an exception. Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-10logging: Make bitbake logger compatible with python loggerJoshua Watt
The bitbake logger overrode the definition of the debug() logging call to include a debug level, but this causes problems with code that may be using standard python logging, since the extra argument is interpreted differently. Instead, change the bitbake loggers debug() call to match the python logger call and add a debug2() and debug3() API to replace calls that were logging to a different debug level. [RP: Small fix to ensure bb.debug calls bbdebug()] Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-09cooker: Ensure reparsing is handled correctlyRichard Purdie
From tinfoil, if you edit bblayers.conf and break it, then call parseConfiguration (e.g. by adding a bad layer with bitbake-layers), the system doens't show any parse error yet it should. Add in a call to the updateCache function so that things really are reparsed when requested. Partially fixes [YOCTO #14054] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-31lib/bb: Don't treat mc recipe (Midnight Commander) as a multiconfig targetTomasz Dziendzielski
When we run `devtool build mc` recipe's task dependencies are expanded to "mc:do_populate_sysroot" where "mc" name is treated as multiconfig and "do_package_sysroot" as multiconfigname. | ERROR: Multiconfig dependency mc:do_populate_sysroot depends on | nonexistent multiconfig configuration named do_populate_sysroot Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-12-21cooker: Include all packages a recipe provides in SkippedPackage.rprovidesPeter Kjellerstedt
The provided packages by a skipped recipe are supposed to be listed in SkippedPackage.rprovides, which is used when generating a meaningful error message when a build fails because of a skipped package. Previously this variable only contained the contents of ${RPROVIDES}. However, most recipes don't define RPROVIDES, they define RPROVIDES_<pkg> for each package they provide. Additionally, the recipe provides the packages in PACKAGES without them being included in ${RPROVIDES}. Before this change, having a runtime dependency on a skipped non-recipe package would result in a build error stating that the build failed because the package was skipped, but without providing any reason for why it was skipped. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-01cooker: Avoid tracebacks if data was never setupRichard Purdie
Recent changes mean data might not be setup. If its not, avoid tracebacks. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-14cooker: Block SIGINT in worker processesJoshua Watt
Blocks SIGINT in the worker processes to prevent them from running the parent process signal handler, which causes them to deadlock under certain circumstances. [YOCTO #14034] Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-12cooker/command: Fix disconnection handlingRichard Purdie
After the recent init changes, if a client disconnects before issuing a command, the cooker can break in the reset handlers. Add some guards in the code to prevent this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-09cooker.py: Save prioritized BBFILES to BBFILES_PRIORITIZEDRobert Yang
The original code saved BBFILES back to BBFILES without any changes which isn't usefule, so remove that line. Now save prioritized BBFILES to BBFILES_PRIORITIZED which can accelerate the query a lot for the one which relies on it such as bb.utils.get_file_layer(). Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-07cooker: Ensure parser worker signal handlers are defaultRichard Purdie
Otherwise this can interfer with multiprocessing exit handling. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-06cooker: Avoid parser deadlocksRichard Purdie
If you make parsing fail (e.g. add something like: X := "${@d.getVar('MCMACHINES').split()[1]}" to meson.bbclass, then run "while true; do bitbake -g bash; done" it will eventually hang. It appears the cancel_join_thread() call the parsing failure triggers, breaks the results_queue badly enough that it sits in read() indefintely (called from self.result_queue.get(timeout=0.25)). The timeout only applies to lock aquisition, not the read call. I've tried various other approaches such as using cancel_join_thread() in other places but the only way things don't lock up is to avoid cancel_join_thread() entirely for results_queue. I do have a concern that this may adversely affect Ctrl+C handling but equally, its broken now already and this appears to improve things. [YOCTO #14034] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-06cooker: Ensure parser is cleaned upRichard Purdie
During cooker shutdown, its possible the parser isn't cleaned up. Fix this (which may partially explain why threads were left hanging around at exit). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-05cooker: Assign a name to the sync thread to aid debuggingRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-05cooker: Ensure parser replacement calls parser final_cleanupRichard Purdie
This could potentialy account for some of the missing thread cleanup we're seeing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-03cooker/cookerdata: Use BBHandledException, not sys.exit()Richard Purdie
Calling sys.exit() in the middle of the code is rather antisocial. We catch this in various places but we shouldn't have to. In all these cases we have already sent events explaining to the user what happened. This means the correct exception is BBHandledException. The recent startup changes have moved the point a lot of this code gets called to inside the UI, with memres it would have always been possible from there anyway. This change makes things much more consistent. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25cooker: Ensure cooker's enviroment is updated on updateConfigRichard Purdie
Only the env variables which were added to the datastore were being updated. We need to update the whole copy, we just only trigger a reparse if any of the variables making it into the datastore change. This avoids a bug where variables such as DISPLAY in a new UI context would break under memory resident bitbake. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker: Ensure BB_ORIGENV is updated by changes to configuration.envRichard Purdie
Changes to configuration.env were not updating BB_ORIGENV, fix this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24main/server/process: Drop configuration object passingRichard Purdie
The first thing the UIs do is update the server config from the UI. We can just rely upon that and start the server with a standard config, removing the need to pass the confusing configuration object around as well as configParams, which contains a similar copy of some of the data. This makes memory resident bitbake work the same way as the normal mode, removing the opportunity for some class of bugs. The xmlrpcinterface and server_timeout values are passed in at server startup time now and there no longer a second option in the configuration which is effective ignored once the server starts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker: Defer configuration init to after UI connectionRichard Purdie
Currently we end up parsing the base configuration multiple times as initially, the right settings haven't come from the UI. We can defer this until later in startup using runCommand as a trigger. The advantage to doing this is improved startup times and ultimately we should be able to avoid the double parse of the base configuration. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker/cookerdata: Ensure UI event log is updated from commandlineRichard Purdie
Currently the eventlog is not handled correctly for memory resident bitbake. Fix this by allowing adpations to configuration changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker/cookerdata/main: Improve loglevel handlingRichard Purdie
Rather than passing debug/verbose/debug_domains around, pass the computed output of these. Ensure that the cooker sets the levels to match the levels currently set in the UI and generally try and make it easier to understand what the code is doing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24build/msg: Cleanup verbose option handlingRichard Purdie
The levels of indirection to set these verbose logging options is rather crazy. This attempts to turn things into two specific options with much more specific meanings. For now its all still controlled by the commandline verbose option and should funciton as previously, with the addition that the BB_VERBOSE_LOGS option can now be task specific. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-23cooker: Explictly shut down the sync threadRichard Purdie
Hongxu Jia reported a problem where the bb_cache files were not always being written out correctly. This was due to the sync thread being terminated prematurely. Whilst the preceeding changes mean the exit handler for this thread is now correctly called since we switch to using sys.exit() instead of os._exit(), this write can happen after we drop the bitbake lock, leading to potential races. Avoid that headache by adding in explicit thread join() calls before we drop the lock (which atexit or Finalize can't do). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-23cooker: Ensure parse_quit thread is closed downRichard Purdie
Each run through the parser would leak a thread from the queue created to shut the parser down. Close this down correctly and clean up the code flow slightly whilst in the area, making sure this thread does shut down correctly (we don't care if it loses data). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-12server/process: Simplfy idle callback handler functionRichard Purdie
Having the idle callbacks abstracted via the configuration object makes no sense. Its like this for historical reasons from the multiple server backends but we don't need this now so simplfy. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-22cooker: Handle multiconfig name mappings correctlyRichard Purdie
"bitbake mc:arm:bash mc:arm:busybox" works but "bitbake multiconfig:arm:bash multiconfig:arm:busybox" does not. The reason is the list is modified whilst iterating. Don't do that. [YOCTO #13607] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-22cooker: Improve multiconfig configuration error reportingRichard Purdie
This avoids a traceback if an invalid multiconfig is referenced in the bitbake commandline and tweaks the message to make it more understanable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-21cooker: Fix unmatched files handling leading to misleading warningsRichard Purdie
Currently if all recipes in a layer are skipped, there are warnings that the BBFILE_PATTERN_ entry didn't match anything. We probably shouldn't do this for skipped recipes. The current code is hard to understand, not least as it passes variables which functions modify by reference rather than giving a return value. Update calc_bbfile_priority() to return values rather than modifying them. Refactor the code to try and make it clearer what its doing and fix the skipped recipe issue by passing in the list of parsed files. The function is complicated by the need to not rerun regex matching more than we ever have to which complicates the flow, it would be easier if we just reran operations multiple times. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-06bitbake: cache: Cache size optimizationJoshua Watt
Now that there is a cache object per multiconfig, it is not necessary for each cache object to parse all other multiconfigs. Instead, each cache now only parses the files for it's multiconfig. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-06bitbake: cache: Use multiconfig aware cachesJoshua Watt
Splits the parsing cache to maintain one cache per multiconfig instead of one global cache. This is necessary now that the files and appends can vary for each multiconfig. A bb.cache.MulticonfigCache dictionary-like proxy object is created instead of a single bb.cache.Cache object. This object will create and properly initialize bb.cache.Cache object for each multiconfig, and each of these caches has a dedicated cache file with a name based on the multiconfig. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-06bitbake: cooker: Split file collections per multiconfigJoshua Watt
Splits the cooker to track a collection per multiconfig instead of a single collection for all multiconfigs. Practically speaking, this allows each multiconfigs to each have different BBMASKs that apply to it instead of each one using the mask specified in the base configuration. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-06cooker: Respect multiconfig parameterJoshua Watt
The cooker had a multiconfig parameter for the findProviders() and findBestProviders() API, but it was being ignored. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-02cooker: Reset parse status unpon clientCompleteRichard Purdie
If for example a tinfoil connection edits the datastore, a subsequent connection can be "corrupted" by those changes. By setting the parse status of the caches as False at exit, the behaviour becomes the same as a newly setup server as a new data store is setup. This avoids problems in tests when BB_SERVER_TIMEOUT is set as the server is properly reset between connections. [YOCTO #13812] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-02-19cooker: Reset loghandlerRichard Purdie
When parsing, reset the loghandler when finished, else the messages can be misleading. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-02-17cooker/siggen: Empty siggen cache during parsingRichard Purdie
When parsing recipes its apparent the memory usage of bitbake rises linearly with number of recipes parsed. It shouldn't. Using tracemalloc (thanks for the tip Joshua Lock) it was clear that the dependency information left behind in siggen was the culprit. Add a new method to allow us to drop this information. We don't need it after the recipe has been parsed and hashes calculated (at runtime its different but only the currently executing task would be in memory). This should give signficant memory usage improvements for bitbake and that in turn should help speed on more constrained systems, as well as when used in multiconfig environments. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-02-06cooker/toaster: replaced deprecated method warn() with warning()Frazer Clews
Removed the deprecated methods as it will only cause problems later on, and since warn() just calls warning(), it shouldn't change anything Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19lib: amend code to use proper singleton comparisons where possibleFrazer Clews
amend the code to handle singleton comparisons properly so it only checks if they only refer to the same object or not, and not bother comparing the values. Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19lib: remove unused importsFrazer Clews
removed unused imports which made the code harder to read, and slightly but less efficient Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-08cooker: Keep track of watched files using a set instead of a listPeter Kjellerstedt
When there are many watched files, keeping track of them using lists is suboptimal. Using sets improves the performance considerably. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-11-13cooker: Remove a left-over comment about expanded_dataPeter Kjellerstedt
This should have been removed together with expanded_data in commit e3694e73 (cooker/command: Drop expanded_data). Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>