summaryrefslogtreecommitdiffstats
path: root/lib/bb/cache.py
AgeCommit message (Collapse)Author
2021-03-11runqueue: Print pseudo.log if fakeroot task failedTomasz Dziendzielski
Currently if pseudo fails we can only see the path to pseudo.log. If we have no access to server and can only rely on bitbake log then debugging becomes impossible. This printing needs to be added in runqueue level, not inside task execution, because in some cases task fails with pseudo abort really early and we don't even see any log. In this change I'm adding pseudo log printing in every fakeroot task failure that logged `mismatch`, `error` or `fatal` to logfile, because we have no other way to communicate with pseudo if it failed or not. Only lines from last pseudo server execution will be printed. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Jan Brzezanski <jan.brzezanski@gmail.com> Signed-off-by: Adrian Walag Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Mikolaj Lasota <mikolaj.lasota@protonmail.com> Signed-off-by: Wiktor Baura <wbaura@gmail.com> Signed-off-by: Kamil Kwiek <kamil.kwiek@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-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-21cache: Make CoreRecipeInfo include rprovides_pkg for skipped recipesPeter Kjellerstedt
This will be needed by SkippedPackage in the cooker. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-11-20bitbake: cache: Remove bad keys() functionJoshua Watt
Removes the keys() function from the MulticonfigCache. This appears to be a leftover from before the class inherited from collections.Mapping, is now unnecessary, and was outright incorrect. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-30cache: remove unused variables.Maxime Roussin-Bélanger
Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25fetch2: Drop globbing supprt in file:// SRC_URIsRichard Purdie
Globbing in file:// urls is terminally broken. Currently when its used, the file checksum code is basically bypassed. This means changes to the source files don't change the task checksum, the task doesn't rebuild when the inputs change and things generally break. To make globbing work generically, we'd have to scan the file system for all possible matches to the glob and log whether they exist or not. We can't simply log the files which exist, we have to also know which files could later exist and influence the choice of file so we know when to reparse. For a simple file://xxx/*, this could be done but for bigger patterns, it becomes much more problemtic. We already support file://xxx/ in urls. So, lets decide we'll not support globs in file://urls. Worse case users can put files in a directory and reference that, moving files into place if needed. Remove all the glob special cases (see the comments if anyone doesn't believe this is terminally broken) and error to the user if they have such urls. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-19cache: Bump cache versionJoshua Watt
The layout of the cache data hasn't changed, but the cache has now been split into different files for multiconfig. If a user pulls in these changes, it's possible that their base cache will still contain the combined multiconfig cache entries, which are now unexpected and generate errors like: Unexpected multiconfig: foo Bumping the version fixes this since the old cache data won't be considered valid anymore. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-12bitbake: cache: Fix error message with bad multiconfigJoshua Watt
The virtualfn variable is not defined, the filename is what should be shown instead. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-08bitbake: cache: Fix error when cache is rebuiltJoshua Watt
It is expected that load_cachfile() returns an integer indicating how many entries were loaded from the cache. In the event the cache needs to be rebuilt, 0 must be returned to prevent python from attempting to add an None and an integer together. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> 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: Improve loggingJoshua Watt
Improves the logging of Cache objects by prefixing the log messages with the multiconfig name of the cache, so as to distinguish between multiple instances of the class. Also adds a more log messages. 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-04-24cache: Fix performance problem with large numbers of source filesRichard Purdie
Some companies are using large numbers of patch files in SRC_URI. Rightly or wrongly that exposes a performance problem where the code does not handle the large string manipulations in a way which works efficienty in python. This is a modified version of a patch from z00539568 <zhangyifan46@huawei.com153340508@qq.com which addresses the performance problem. I modified it to use a more advanced regex, retain the "*" check and cache the regex. [YOCTO #13824] 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-01cache: Lower debug level for wold build messagesRichard Purdie
These messages spam the logs for no good reason, they were useful for debugging a particular problem long ago but are distracting noise now. Disable them. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06siggen: Clean up task reference formatsRichard Purdie
Currently siggen uses the format "<filename>.<taskname>" for referencing tasks whilst runqueue uses "<filename>:<taskname>". This converts to use ":" as the separator everywhere. This is an API breaking change since the cache is affected, as are siginfo files and any custom signature handlers such as those in OE-Core. Ultimately this will let us clean up and the accessor functions from runqueue, removing all the ".rsplit(".", 1)[0]" type code currently all over the place. Once a standard is used everwhere we can update the code over time to be more optimal. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-02cache: Add SimpleCache classRichard Purdie
This adds a simple version of the MultiProcessCache which can be used to save and load cache data, useful for a new usecase we have in sigdata/runqueue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-18cache: Create a symlink for current cachefileRobert Yang
So that people or other tools can easily know which one is being used, just like what we did for run.do_task and log.do_task, otherwise, we have no way to know it. I usually use "ls -t", but it isn't reliable since the one which is being used may not the latest one. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15cache: Set packages for skipped recipesRobert Yang
The provides and rprovides had been set for skipped recipes, packages are similar to them (all of them provide something), so also set it. This makes it easier to figure out the RDEPENDS issues, for example, lmsensors (lmsensors_3.5.0.bb) RRECOMMENDS lmsensors-config-fancontrol (lmsensors-config_1.0.bb), but lmsensors-config is skipped for some reasons, then if we run: $ bitbake lmsensors ERROR: Nothing RPROVIDES 'lmsensors-config-fancontrol' (but /path/to/lmsensors_3.5.0.bb RDEPENDS on or otherwise requires it) NOTE: Runtime target 'lmsensors-config-fancontrol' is unbuildable, removing... Missing or unbuildable dependency chain was: ['lmsensors-config-fancontrol'] ERROR: Required build target 'lmsensors' has no buildable providers. Missing or unbuildable dependency chain was: ['lmsensors', 'lmsensors-config-fancontrol'] We had no way to know who rprovides lmsensors-config-fancontrol, we can figure it out by bitbake/contrib/dump_cache.py after this patch. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15cache: Remove duplicated lines for provides and rprovidesRobert Yang
Whether skip or not, they are always set, so move the lines ahead to avoid duplicated lines. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-10multiconfig: Switch from 'multiconfig' -> 'mc'Richard Purdie
After real world use its clear the "multiconfig:" prefix to multiconfig tasks, whilst clear, is also clumbersome. Switch to use the short version instead. mcdepends will continue to work with "multiconfig:" for now as well. The commandline will only accept mc: going forward. [YOCTO #11168] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Strip old editor directives from file headersRichard Purdie
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-07cache: Cleanup deprecated function usageRichard Purdie
Remove a deprecated warning and stop using our own deprecated API! Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-26codeparser: Track oe.utils.conditional usageMartin Jansa
* base_conditional was already removed from oe-core: http://git.openembedded.org/openembedded-core/commit/?id=0391fcad9103abca0796a068f957d0df63ab4776 after the usage was migrated to oe.utils.conditional: http://git.openembedded.org/openembedded-core/commit/?id=c97acbd034532895ce57c6717ed1b3ccc7900b0d so we can handle just ".conditional" version * add 1st parameter to variable dependencies, that way when you use FOO = "${@oe.utils.conditional('VAR', 'VALUE', 'true', 'false')" FOO variable will have dependency on VAR variable and you don't need to add FOO[vardeps] += "VAR" manually every time you use oe.utils.conditional * this is similar to contains tracking from: https://bugzilla.yoctoproject.org/show_bug.cgi?id=3890 http://git.openembedded.org/bitbake/commit/?id=ed2d0a22a80299de0cfd377999950cf4b26c512e http://git.openembedded.org/bitbake/commit/?id=0b9d117631ce909312d53b93289e61defc6be01c but conditional is simpler, we don't need to handle the first parameter as a set Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-09bitbake: cache: improve debug messageRobert Yang
* Print message when cachefile is found/not can help debug. * Update "Using cache in" to "Cache dir:" since it was the same as the debug message of "codeparser & file checksum caches", which caused confusion. And whether the cache file will be used or not is still unknown at that time, so just print the cache dir. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-18cache.py: fix whitespacePaul Eggleton
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-28cache: don't insert PN into PACKAGESRoss Burton
The cache code currently inserts PN into the package list if it isn't already present. Whilst this ensures that the package list contains something which is important for native recipes that don't set PACKAGES, it causes confusing behaviour where a normal recipe doesn't have PN in PACKAGES: for example adding dhcp to IMAGE_INSTALL will parse successfully but fail at rootfs time as the dhcp recipe doesn't generate a dhcp package. Solve this by only adding PN to the cache's package list if the package list is empty. This results in the package list for recipes such as DHCP being correct, but native recipes continue to have just PN in the list as before. [ YOCTO #5533 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10cache: prevent division-by-zero in load_cahefile()Markus Lehtonen
[YOCTO 11315] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-05codeparser: improve handling of contains_any() and filter()Paul Eggleton
Ensure we handle bb.utils.contains_any() as separate items, rather than how we handle contains() where every item must be in the list. Additionally, enable handling bb.utils.filter() which for the purposes of looking at dependencies is the same as contains_any(). Additionally bump the codeparser cache and recipe cache versions to invalidate the user's existing caches (ensuring that the changes take effect and avoiding "taskhash mismatch" errors respectively). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: remove True option to getVarFlag callsJoshua Lock
getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02cache: allow parsing a recipe with a custom config datastorePaul Eggleton
To accommodate the OpenEmbedded layer index recipe parsing, we have to have the ability to pass in a custom config datastore since it constructs a synthetic one. To make this possible after the multi-config changes, rename the internal _load_bbfile() function to parse_recipe(), make it a function at the module level (since it doesn't actually need to access any members of the class or instance) and move setting __BBMULTICONFIG inside it since other code will expect that to be set. Part of the fix for [YOCTO #10192]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-08-17bitbake: Initial multi-config supportRichard Purdie
This patch adds the notion of supporting multiple configurations within a single build. To enable it, set a line in local.conf like: BBMULTICONFIG = "configA configB configC" This would tell bitbake that before it parses the base configuration, it should load conf/configA.conf and so on for each different configuration. These would contain lines like: MACHINE = "A" or other variables which can be set which can be built in the same build directory (or change TMPDIR not to conflict). One downside I've already discovered is that if we want to inherit this file right at the start of parsing, the only place you can put the configurations is in "cwd", since BBPATH isn't constructed until the layers are parsed and therefore using it as a preconf file isn't possible unless its located there. Execution of these targets takes the form "bitbake multiconfig:configA:core-image-minimal core-image-sato" so similar to our virtclass approach for native/nativesdk/multilib using BBCLASSEXTEND. Implementation wise, the implication is that instead of tasks being uniquely referenced with "recipename/fn:task" it now needs to be "configuration:recipename:task". We already started using "virtual" filenames for recipes when we implemented BBCLASSEXTEND and this patch adds a new prefix to these, "multiconfig:<configname>:" and hence avoid changes to a large part of the codebase thanks to this. databuilder has an internal array of data stores and uses the right one depending on the supplied virtual filename. That trick allows us to use the existing parsing code including the multithreading mostly unchanged as well as most of the cache code. For recipecache, we end up with a dict of these accessed by multiconfig (mc). taskdata and runqueue can only cope with one recipecache so for taskdata, we pass in each recipecache and have it compute the result and end up with an array of taskdatas. We can only have one runqueue so there extensive changes there. This initial implementation has some drawbacks: a) There are no inter-multi-configuration dependencies as yet b) There are no sstate optimisations. This means if the build uses the same object twice in say two different TMPDIRs, it will either load from an existing sstate cache at the start or build it twice. We can then in due course look at ways in which it would only build it once and then reuse it. This will likely need significant changes to the way sstate currently works to make that possible. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17cache: Build datastores from databuilder objectRichard Purdie
Rather than passing in a datastore to build on top of, use the data builder object in the cache and base the parsed recipe from this. This turns things into proper objects building from one another rather than messy mixes of static and class functions. This sets things up so we can support parsing and building multiple configurations. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17cache: Split Cache() into a NoCache() parent objectRichard Purdie
There are some cases we want to parse recipes without any cache setup or involvement. Split out the standalone functions into a NoCache variant which the Cache is based upon, setting the scene for further cleanup and restructuring. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17cache/cooker: Pass databuilder into bb.cache.Cache()Richard Purdie
Rather that the current mix of static and class methods, refactor so that the cache has the databuilder object internally. This becomes useful for the following patches for multi config support. It effectively completes some of the object oriented work we've been working towards in the bitbake core for a while. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17cache: Make virtualfn2realfn/realfn2virtual standalone functionsRichard Purdie
Needing to access these static methods through a class doesn't make sense. Move these to become module level standalone functions. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-17cache/ast: Move __VARIANTS handling to parse cache functionRichard Purdie
Simple refactoring to allow for multiconfig support. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Don't interleave pickle cache file writingRichard Purdie
For some reason the data written in this way is coming back out the files out of order. I've not been able to simplify the test case to a point where this was standalone reproducible. Simplify the code and write out the cache files sequentially since this seems to avoid the errors and makes the code more readable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Add better cache loading sanity checksRichard Purdie
We've seen cache corruption where the pairs come out in a different order to the way we saved them for unknown reasons. Add better sanity checking to give a more user friendly error rather than a crash/traceback. Also allows the system to reparse and recover. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Drop/simplify pointless type checkingRichard Purdie
Since we no longer have random data like version fields in these structures and we can assume any extra cache data subclasses our class, simplify the code. This is mostly reindenting after removal of the pointless type checks. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Improve versions fields handlingRichard Purdie
Firstly, don't store the versions fields in memory in the cache objects data store. This just complicates the code for no good reason. Secondly, write the version fields to all cache files, not just the core one. This makes everything consistent and easier. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Correctly handle missing extra cachesRichard Purdie
If an "extras" cache file is corrupted, the system would not notice and later fail with errors about missing entries. Add a test for this which means we can fall back to re-parsing in those cases. [YOCTO #9902] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-22cache: Move the parsing message to a more logical placeRichard Purdie
Otherwise you can look at the log and wonder why parsing isn't happening when it really is due to other code paths. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-01bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-18cache: Increase cache version after task checksum calculation changesRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>