summaryrefslogtreecommitdiffstats
path: root/lib/bb/cache.py
AgeCommit message (Collapse)Author
2016-03-23cache: Make BB_DONT_CACHE variable externalMarkus Lehtonen
This makes it possible to prevent a recipe to be cached, and thus, parsed every time. Use with care. [YOCTO #8853] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-18MultiProcessCache: make cache filename configurableMarkus Lehtonen
If no cache file name is given a default from class variable is used, like before. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-18bb/cache: drop some unused argumentsMarkus Lehtonen
Drop unused 'd' argument from the cache save methods, simplifying the API. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-22taskdata: add the ability to access world targets listPaul Eggleton
In certain circumstances it can be useful to get access to the world targets list from a recipe in order to add dependencies on some or all of the items in it. If a special function, 'calculate_extra_depends' is defined in the recipe, and the recipe is to be built, then call it at the right point before we calculate which tasks should be run. The function can append items to the "deps" list in order to add dependencies. This is not as tidy a solution as I would have liked, but it does at least do the job. As part of this change, the buildWorldTargets function was moved to bb.providers to make it possible to call from taskdata. Part of the implementation of [YOCTO #8600]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-22cache.py: check existence before add to cachedata.rprovidersRobert Yang
The rprovides maybe contain duplicated lines when parse again, we need check it before add to cachedata.rproviders, similar to what we had done to cachedata.providers. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11bitbake: clean up stamp-base related codesChen Qi
The 'stamp-base' and 'stamp-base-clean' related codes are no longer useful, clean them up. [YOCTO #8468] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-16cache: Don't try to expand __inherit_dataRichard Purdie
Trying to expand a variable which isn't a string doesn't make sense. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-16cache: Handle spaces and colons in directory names for file-checksumsRichard Purdie
If there is a space in a directory name containing a file in file-checksums (e.g. from a file:// url), you currently get tracebacks from bitbake. This improves the code to handle colons and spaces in the file-checksums names since it possible to figure out the correct names. [YOCTO #8267] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-25cache: Clean up getVar usage to modern syntax/styleRichard Purdie
No functional change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-13cooker/cache/parse: Implement pyinofity based reconfigureRichard Purdie
Memory resident bitbake has one current flaw, changes in the base configuration are not noticed by bitbake. The parsing cache is also refreshed on each invocation of bitbake (although the mtime cache is not cleared so its pointless). This change adds in pyinotify support and adds two different watchers, one for the base configuration and one for the parsed recipes. Changes in the latter will trigger a reparse (and an update of the mtime cache). The former will trigger a complete reload of the configuration. Note that this code will also correctly handle creation of new configuration files since the __depends and __base_depends variables already track these for cache correctness purposes. We could be a little more clever about parsing cache invalidation, right now we just invalidate the whole thing and recheck. For now, its better than what we have and doesn't seem to perform that badly though. For education and QA purposes I can document a workflow that illustrates this: $ source oe-init-build-env-memres $ time bitbake bash [base configuration is loaded, recipes are parsed, bash builds] $ time bitbake bash [command returns quickly since all caches are valid] $ touch ../meta/classes/gettext.bbclass $ time bitbake bash [reparse is triggered, time is longer than above] $ echo 'FOO = "1"' >> conf/local.conf $ time bitbake bash [reparse is triggered, but with a base configuration reload too] As far as changes go, I like this one a lot, it makes memory resident bitbake truly usable and may be the tweak we need to make it the default. The new pyinotify dependency is covered in the previous commit. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-08cache/fetch2/siggen: Ensure we track include history for file checksumsRichard Purdie
Currently, if you reference a file url, its checksum is included in the task hash, however if you change to a different file at a different location, perhaps taking advantage of the FILESPATH functionality, the system will not reparse the file in question and change its checksum to match the new file. To correctly handle this, the system not only needs to know if the existing file still exists or not, but also check the existance of every file it would have looked at when computing the original file. We already do this in the bitbake parsing code for class inclusion. This change uses the same technique to log the file list we looked at and if files in these locations exist when they previously did not, to invalidate and reparse the file. Since data stored in the cache is flattened text, we have to use a string form of the data and split on the ":" character which is ugly, but is an internal detail we can improve later if a better method is found. The cache version changes to trigger a reparse since the previous cache data is now incompatible. [YOCTO #7019] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-24lib/bb/*.py: Typo fixes/grammar/comment fixes, nothing functional.Robert P. J. Day
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25codeparser cache improvementsRichard Purdie
It turns out the codeparser cache is the bottleneck I've been observing when running bitbake commands, particularly as it grows. There are some things we can do about this: * We were processing the cache with "intern()" at save time. Its actually much more memory efficient to do this at creation time. * Use hashable objects such as frozenset rather than set so that we can compare objects * De-duplicate the cache objects, link duplicates to the same object saving memory and disk usage and improving speed * Using custom setstate/getstate to avoid the overhead of object attribute names in the cache file To make this work, a global cache was needed for the list of set objects as this was the only way I could find to get the data in at setstate object creation time :(. Parsing shows a modest improvement with these changes, cache load time is significantly better, cache save time is reduced since there is now no need to reprocess the data and cache is much smaller. We can drop the compress_keys() code and internSet code from the shared cache core since its no longer used and replaced by codeparser specific pieces. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25cache: Optimise invalid cache file handlingRichard Purdie
If there is a corrupt/invalid cache file, we'd keep trying to reopen it. This is pointless, simplify the code paths and delete the dead file. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25cache: Don't reload the cache file since we already have this data in memoryRichard Purdie
If we're writing out merged data to disk, its safe to assume that either we loaded the data or couldn't. Loading it again is relatively pointless and time consuming. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-11cache.py: print debug info when EXCLUDE_FROM_WORLDRobert Yang
This gives us an easy way to find out which recipes have been excluded from world when there are many layers. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-30event: Add SkipRecipe event to replace SkipPackageRichard Purdie
In the depths of time we were rather confused about naming. bb files are recipes, the event to skip parsing them should be SkipRecipe, not SkipPackage. This changes bitbake to use the better name but leaves the other around for now. We can therefore start removing references to it from the metadata. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-10cache: don't trigger reparse on recipes with wildcards in SRC_URIPaul Eggleton
Since we now get wildcards in the file checksum list in the cache, we need to ignore them when checking to see if they still exist. This fixes connman-gnome reparsing on every bitbake execution in OE-Core. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-18data_smart: Fix variable reference issuesRichard Purdie
The change to use the expansion cache in VariableParse was incorrect as it was adding in references it shouldn't have been. This patch corrects the codepaths and ensures the references are correct. The cache version is bumped since the previous bug could have leave to invalid checksum calculations and a clean cache is therefore desireable. The impact of the bug was that sstate was not getting reused when it should and some tasks were also being rerun when they should not have been. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-12runqueue: Split runqueue to use bitbake-workerRichard Purdie
This is a pretty fundamental change to the way bitbake operates. It splits out the task execution part of runqueue into a completely separately exec'd process called bitbake-worker. This means that the separate process has to build its own datastore and that configuration needs to be passed from the cooker over to the bitbake worker process. Known issues: * Hob is broken with this patch since it writes to the configuration and that configuration isn't preserved in bitbake-worker. * We create a worker for setscene, then a new worker for the main task execution. This is wasteful but shouldn't be hard to fix. * We probably send too much data over to bitbake-worker, need to see if we can streamline it. These are issues which will be followed up in subsequent patches. This patch sets the groundwork for the removal of the double bitbake execution for psuedo which will be in a follow on patch. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-12fetch2: Fix AUTOINC handlingRichard Purdie
AUTOINC was meant to appear once at the start of the version string. The list of names may not be sorted meaning it could get inserted in the middle. This patch simplifies the code and ensures it appears at the start. Include cache version bump to ensure the cache picks up these changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-07lib/bb/cache.py: invalidate cache when file checksum entry no longer existsPaul Eggleton
Go through the cached list of file checksums and check if any of the files no longer exist; if any are missing then invalidate the cached recipe, which will force it to be reparsed and thus force the list of files to be collected again. This prevents a warning when moving a file to a different location that is still picked up by the recipe, e.g. moving a file from a "files" subdirectory to one named with the recipe name (${BPN}). Fixes [YOCTO #4474]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-31lib/bb/cache.py: Change debugging note to a debug messageMark Hatle
Some apparently debugging was left in in a previous commit. This caused bitbake to return a list of bbappends when things changed from the cache. Make this a proper debug message. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09lib: Clean up various file access syntaxRichard Purdie
Python 3 is stricter about how files are accessed. Specficially: * Use open(), not file() * Use binary mode for binary files (when checksumming) * Use with statements to ensure files get closed * Add missing file close statements Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-30cache.py: Drop support for BROKEN variableRichard Purdie
All it now does is function in a similar way to EXCLUDE_FROM_WORLD and since we have a better named variable for this, lets just drop the usage of BROKEN at the bitbake level. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-25cache.py: remove the duplicated self.file_dependsRobert Yang
There are two "self.file_depends =" lines in cache.py::CoreRecipeInfo: class CoreRecipeInfo(RecipeInfoCommon): __slots__ = () cachefile = "bb_cache.dat" def __init__(self, filename, metadata): self.file_depends = metadata.getVar('__depends', False) [snip] self.file_depends = metadata.getVar('__depends', False) They are duplicated, remove the last one. [YOCTO #3795] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-19parse/cache/cooker: Preserve order in the file inclusion listRichard Purdie
The data returned by get_file_depends() may me used in contexts like checksums where order is important. The current usage of sets means that some of the checksums can change in circumstances they should not. This patch changes to use lists, thereby removing the problem. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-20build/siggen: Add support for stamp 'clean' masksRichard Purdie
Currently when we execute a task, we don't remove other potentially stale stamps. This can mean if you switch between two different versions of a recipe without a clean, the build can get very confused. This patch adds in functionality to allow a wildcard expression of stamp files to be removed when creating a new stamp file. This patch adds in the core of the code to enable this but it also requires metadata support to enable it. When writing this improvement I went through several different options but this was the only way I could find to allow things like noexec tasks to function correctly (where stamps need to be created without the data store). [YOCTO #2961] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-23bitbake: implement checksums for local files in SRC_URIPaul Eggleton
Gathers a list of paths to have checksums calculated at parse time, and processes these when calculating task hashes. Checksums are cached with the file's current mtime. Thus, changing any local file in SRC_URI will now cause the do_fetch taskhash to change, thus forcing a rebuild. This change adds very roughly about an 8% increase in parse time (a few seconds) and maybe a few seconds during runqueue generation, so a fairly moderate performance hit. Note that since paths are resolved at parse time, this will not force a rebuild when files are introduced which would cause that resolved path to be different - for example, where a machine-specific version of a file was added without otherwise changing the recipe. This will need to be handled in a future update. Code to hook this into the signature generator was courtesy of Richard Purdie <richard.purdie@linuxfoundation.org>. Implements [YOCTO #2044]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-23bitbake: refactor out codeparser cache into a separate classPaul Eggleton
We want to be able to reuse most this functionality for the file checksum cache. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-23bitbake: change for adding progress bar in Hob2.Shane Wang
The changes include: - Clean some events in event.py - Fire essential events for Hob2 to handle with more information. - knotty changes Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-23cache: Use configuration's hash value to validate cacheDongxiao Xu
Previously we use the file time stamp to judge if a cache is valid. Here this commit introduce a new method, which calculates the total hash value for a certain configuration's key/value paris, and tag it into cache filename, for example, bb_cache.dat.xxxyyyzzz. This mechanism also ensures the cache's correctness if user dynamically setting variables from some frontend GUI, like HOB. Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-02bitbake: Add description into the cache and clean up cache duplicationShane Wang
With the addition of new cache domains, the summary, license and section information is no longer requred in the core cache since its only used by the hob UI. This patch removes the duplicated entries. It also adds the DESCRIPTION field to the cache for the benefit of hob2. Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-27Update users of getVar/setVar to use the data store functions directlyRichard Purdie
(From Poky rev: affd0907253387cee0ba0c7e9f92bcc109895446) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-10Add FAKEROOTNOENV variableRichard Purdie
Add a FAKEROOTNOENV which does the opposite of the FAKEROOTENV variable and is data loaded into the environment for tasks without the fakeroot flag. The intent here is to provide a way to control the environment when we aren't needing fakeroot context which allows us to unload the preload from memory entirely and gain a valuable speedup. I'm not 100% happy with needing this at the bitbake level, particularly with the cache hit but it does give a valuable speedup. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-10bb/cache: rename confusing variableJoshua Lock
The bNeedUpdate variable doesn't reflect its purpose, and doesn't match coding style (type encoded in variable name, camel case) - rename to cache_ok. Signed-off-by: Joshua Lock <josh@linux.intel.com>
2011-07-27bitbake: show more information for NoProvider errorsPaul Eggleton
"Nothing PROVIDES" errors often come up when a recipe has been skipped for some reason, and therefore it is useful to print out that reason information when showing the error so that the user understands why the error has occurred. Given that we already feed the reason information into the skiplist for various situations (COMMERCIAL_LICENSE, COMPATIBLE_MACHINE etc.) this should now output a useful error message for skipped recipes. Fixes [YOCTO #846], [YOCTO #1127] Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-07-25bitbake/cache: allow class names with arguments to be specifiedPaul Eggleton
This ensures we understand e.g. "virtual:multilib:lib64:pn" for multilib. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-07-19cache: fix remnant broken 'info' reference from recent cache changesChristopher Larson
Signed-off-by: Christopher Larson <kergoth@gmail.com>
2011-07-07cache.py: Ensure additional .bbappend files are accounted forRichard Purdie
Currently if a user adds a new .bbappend file to the system, the cache still thinks the cached data is valid. This code fixes that to ensure additions and changed in append application order are accounted for. [YOCTO #1091] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-28bitbake: Add task specific stamp file supportRobert Yang
This patch, based on proof of concept code from Richard adds code to bitbake to allow individual tasks to optionally specify their stamp file using the stamp-base flag. This takes the same form as the STAMP variable but can be specified on a per task basis. Code is also added to runqueue to ensure that if two tasks share the same stamp file, only one will be executed at once. A significant usecase for this code is to share source code (${S}) between recipes where separate build directories (${B}) are used. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-10bitbake/cooker: Fix -b option by ensuring the empty cache structure is presentRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-09cache.py: fix bitbake -s commandScott Garman
This uses the correct index of self.pn when setting up cachedata's pkg_pn, fixing the output of bitbake -s. This fixes bug [YOCTO #1149]. Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-09track skipped packagesPaul Eggleton
Add skiplist to cooker that allows access to the list of packages skipped via SkipPackage (this includes COMPATIBLE_MACHINE, INCOMPATIBLE_LICENSE, etc.) This can be used to enhance error reporting. (From Poky rev: 6c12b7b1099c77b87d4431d55e949cf7c5f52ded) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-07cache: Implement multiple extra cache fields request supportLiping Ke
This patch is to support extra cache. If user needs to request extra cache fields besides CoreRecipeInfo fields, just add a new XXXRecipeInfo class definition as Hob Does. Currently supported Extra RecipeInfo name is an array. We can support multiple extra cache fields at the same time besides CoreRecipeInfo which is needed by all clients. Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-07cache: Introduce new param caches_array into Cache impl.Liping Ke
When using hob ui interface, we need extra cache fields. We will save ui required extra cache fields into a separate cache file. This patch introduce this caches_array parameter. It will be used in the extra cache implementation (following patch). Caches_array at least contains CoreRecipeInfo. If users need extra cache fields support, such as 'hob', caches_array will contain more relevant elements such as HobRecipeInfo. Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-07cache.py: Refactory Current Cache implementationLiping Ke
This patch is for refactorying current cache implementation, the main reason is for introducing extra cache fields requests for image creator as well as other users. The refactory parts include: Move cache data retrieve methods out of Cache Data Fields Definition. Since this retrieve methods will be shared for both CoreRecipeInfo as well as the new introduced extra RecipeInfo in the following patches. Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-07cache.py: Sync what amounts to whitespace with bitbake in poky, pending ↵Richard Purdie
merge of cache patches Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-07universe target: add a new target to collect all recipe targetsSaul Wold
This new universe target is not intended to be used for compiling or building everything, it use is for sanity checking and other tasks that need to find all targets. This does not exclude any broken or virtual targets. (From Poky rev: 28e7041a9c110be2ac5dea1eb1f55ca8f056111e) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-06bitbake/cache.py: Ensure skipped recipes make it into the cache to avoid ↵Richard Purdie
reparsing (From Poky rev: 001a555c2f755d4f8a69b113656d9307ca7ee597) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>