aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
AgeCommit message (Collapse)Author
2018-11-23sstate.bbclass: Only remove sstate file when task is existedRobert Yang
This can improve the performance a lot for "bitbake <recipe-native/cross/crosssdk> -ccleansstate" when there are a lot of sstate files. For example: * Before $ bitbake quilt-native -ccleansstate - Check log.do_cleansstate: Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_package.tgz* Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_package_qa.tgz* Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_package_write_rpm.tgz* Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_packagedata.tgz* Removing /sstate-cache/*/sstate:quilt-native::0.65:r0::3:*_populate_lic.tgz* Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_populate_sysroot.tgz* There are no package tasks for quilt-native, so the first 4 lines doesn't make any sense, but the glob pattern "sstate-cache/*/*" is very time consuming when there are no disk caches. E.g., I have more than 600,000 sstate files: - Without disk caches # echo 3 >/proc/sys/vm/drop_caches $ time python3 -c 'import glob; glob.glob("/sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_package.tgz*")' real 4m32.583s user 0m5.768s sys 0m12.892s - With disk caches (e.g., run it in the second time) $ time python3 -c 'import glob; glob.glob("/sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_package.tgz*")' real 0m5.128s user 0m2.772s sys 0m2.308s So the 4 removing *package* commands cost more than 20s or 272s in theory. * After $ bitbake quilt-native -ccleansstate - Check log.do_cleansstate: Removing /sstate-cache/*/sstate:quilt-native::0.65:r0::3:*_populate_lic.tgz* Removing /sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_populate_sysroot.tgz* We can see that it saved 20s or 272s in theory. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-22sstate.bbclass: set SSTATE_EXTRAPATHWILDCARD explicitlyRobert Yang
The glob.glob("/sstate/*/*/") is very time consuming, set SSTATE_EXTRAPATHWILDCARD explicity to avoid that. This can save a lot of time when there are many sstate files. For example, I have more than 600,000 sstate files: * Before - Without disk caches $ time python3 -c 'import glob; glob.glob("/sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_populate_sysroot.tgz*")' real 4m32.583s user 0m5.768s sys 0m12.892s - With disk caches $ time python3 -c 'import glob; glob.glob("/sstate-cache/*/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_populate_sysroot.tgz*")' real 0m4.111s user 0m2.348s sys 0m1.756s * After $ time python3 -c 'import glob; glob.glob("/sstate-cache.bak/universal/*/sstate:quilt-native:x86_64-linux:0.65:r0:x86_64:3:*_populate_sysroot.tgz*")' - Without disk caches: real 0m7.928s user 0m0.172s sys 0m0.124s - With disk caches: real 0m0.131s user 0m0.088s sys 0m0.044s We can see that it saves about 3.8s with disk caches, and saves about 264s without disk caches. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-09-12sstate.bbclass: update SSTATE_DUPWHITELISTKai Kang
Update SSTATE_DUPWHITELIST in sstate.bbclass. * remove ${DEPLOY_DIR_RPM}/noarch/ which is not overwritten any more * add directories for package target-sdk-provides-dummy Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-28sstate.bbclass: make SSTATE_PRUNE_OBSOLETEWORKDIR could be overwrittenKai Kang
Define variable SSTATE_PRUNE_OBSOLETEWORKDIR with '?=' in sstate.bbclass, then it could be overwritten by user configuration. Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23sstate: add intel-microcode to SSTATE_DUPWHITELISTYongxin Liu
intel-microcode multilib recipes can generate identical overlapping files: microcode.cpio. Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-16sstate: Optimise SSTATE_EXCLUDEDEPS_SYSROOT handlingRichard Purdie
Using re.compile() is around six times faster than recompiling the regexp each time so maintain a cache. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15sstate: use SSTATE_EXCLUDEDEPS_SYSROOT for skipping ↵André Draszik
base-passwd|shadow-sysroot recipes Use the newly introduced SSTATE_EXCLUDEDEPS_SYSROOT for specifying the base-passwd|shadow-sysroot recipes to be excluded from a recipe sysroot. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15sstate: use SSTATE_EXCLUDEDEPS_SYSROOT for skipping *-initial recipesAndré Draszik
Use the newly introduced SSTATE_EXCLUDEDEPS_SYSROOT for specifying the *-initial recipes to be excluded from a recipe sysroot. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15sstate: allow specifying indirect dependencies to exclude from sysrootAndré Draszik
Currently, a dependency on any -native recipe will pull in all dependencies of that -native recipe in the recipe sysroot. This behaviour might not always be wanted, e.g. when that -native recipe depends on build-tools that are not relevant for the current recipe. This change adds a SSTATE_EXCLUDEDEPS_SYSROOT variable, which will be evaluated for such recursive dependencies to be excluded. The idea is similar to http://lists.openembedded.org/pipermail/openembedded-core/2018-January/146324.html except that the list is not hard-coded anymore. SSTATE_EXCLUDEDEPS_SYSROOT is evaluated as two regular expressions of recipe and dependency to ignore, e.g. in the above flex-native / bison-native use-case, one would specify SSTATE_EXCLUDEDEPS_SYSROOT = ".*->(flex|bison)-native" in layer.conf. The existing special handling of "-initial" as well as "base-passwd" and "shadow-sysroot" could also be streamlined: SSTATE_EXCLUDEDEPS_SYSROOT += "\ .*->.*-initial.* \ .*(base-passwd|shadow-sysroot)->.* \ " Another anticipated user is meta-java, where certain newer JDKs can only be bootstrapped (built) using older JDKs, but it doesn't make much sense to copy all those older JDKs and their own build tools (ant, etc.) into the sysroot of recipes wanting to be built using the newer JDK (only), e.g.: SSTATE_EXCLUDEDEPS_SYSROOT += "\ openjdk-8-native->(ant-native|attr-native|coreutils-native|icedtea7-native|libxslt-native|make-native|openssl-native|zip-native|unzip-native) \ " Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15sstate/lib.oe.path: Ensure file sparseness is preservedRichard Purdie
Files when restored from sstate were missing their sparseness. Fix up various functions to preserve this and make things more deterministic. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-15sstate: Ensure a given machine only removes things which it createdRichard Purdie
Currently if you build qemux86 and then generic86, the latter will remove all of the former from deploy and workdir. This is because qemux86 is i586, genericx86 is i686 and the architctures are compatible therefore the sstate 'cleaup' code kicks in. There was a valid reason for this to ensure i586 packages didn't get into an i686 rootfs for example. With the rootfs creation being filtered now, this is no longer necessary. Instead, save out a list of stamps which a give machine has ever seen in a given build and only clean up these things if they're no longer "reachable". In particular this means the autobuilder should no longer spend a load of time deleting files when switching MACHINE, improving build times. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-14sstate: Remove DEPLOY_DIR_IMAGE from SSTATE_DUPWHITELISTRichard Purdie
Replace the generic whitelist entry with entries for the three specific 'problem' cases in OE-Core. This means the general DEPLOY_DIR_IMAGE entry doesn't mask problems for others as was recently encoutered by users reported on irc. In the whitelisted cases they occur only in multilib builds and the files are identical. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-08sstate: Add sstate usage summary to the buildRichard Purdie
Currently the user has no indication of how much sstate was already present or that would be used by the build. This change adds some summary information so that the user can see how much reuse is occurring. To fully work it needs some extra information from a recent bitbake commit but this is optional. When combined with bitbake --dry-run this feature can be used to check if sstate would be reused in a build. [YOCTO #12749] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-24sstate/bitbake.conf: Use pigz if availableRichard Purdie
Currently the compression of sstate objects is single threaded. In the case of ltp, this takes around 33s. If we add pigz into the list of non-fatal HOSTTOOLS and then use if it available when building the sstate object, this time drops to around 6s. Since pigz is now widely available this is an optimisation we should utilise. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-06classes/sstate: Remove unused argumentJoshua Watt
Removes an unused argument to pstaging_fetch() Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-06classes/sstate: Remove trailing whitespaceJoshua Watt
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-04sstate.bbclass: drop obsolete codesChen Qi
The SSTATECLEANFUNCS mechanism was introduced to solve user/group deletion problem. After RSS mechanism was introduced, there's no need to do so. There was a patch to remove these obsolete codes for useradd.bbclass, but the codes in sstate.bbclass were not removed. So clean it up. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-04-07sstate.bbclass: Add ${PACKAGE_EXTRA_ARCHS} to SSTATE_ARCHSPeter Kjellerstedt
This makes sure files provided by packages that use any of the extra architectures defined using ${PACKAGE_EXTRA_ARCHS} are cleaned from tmp/sysroot-components when sstate_eventhandler2() executes. Without this, changing a package from using one of the extra architectures to another architecture would lead to files being leftover in tmp/sysroot-components, which could later be picked up when creating the RSS for another package rather than the files that belonged to the updated package. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-10sstate.bbclass: sstate_hardcode_path(): fix for multilibRobert Yang
It only substituted staging_target for target recipe which didn't work for multilib, for example, postinst-useradd-lib32-polkit: * No multilib: PATH=/path/to/tmp-glibc/work/core2-64-wrs-linux/polkit/0.113-r0/recipe-sysroot-native/bin staging_target=/path/to/tmp-glibc/work/core2-64-wrs-linux/polkit/0.113-r0/recipe-sysroot The PATH would be substituted to: FIXMESTAGINGDIRTARGET-native/bin Not the funny "-native/bin", this works well. * When multilib: PATH=/path/to/tmp-glibc/work/core2-32-wrsmllib32-linux/lib32-polkit/0.113-r0/recipe-sysroot-native/bin staging_target=/path/to/tmp-glibc/work/core2-32-wrsmllib32-linux/lib32-polkit/0.113-r0/lib32-recipe-sysroot Now staging_target endswith "/lib32-recipe-sysroot", so it can't replace '/recipe-sysroot-native' in PATH , so PATH can't be fixed, and there would be build errors when building multilib + rm_work, for example: chown: invalid user: ‘polkitd:root’ Substitute staging_host for target recipe can fix the problem, now all of native, cross and target need substitute staging_host, so we can simply the code a little. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-10nativesdk/sdk: Update sdk dummy providersRichard Purdie
When we migrated rpm v5 -> v4, we lost the ability to drop "per file" dependencies from the rpm backend for things like "/bin/bash" and "/usr/bin/env" which meant the sdks were becomming 'bloated'. This restores the functionality using a dummy package, similarly to the way the buildtools perl issue was addressed. It also removes the non-functional old code so as not to confuse people in future. I ran into this problem trying to filter dependencies to only rpms a build directly depends upon and it turns out we have some determinism issues in this area so this is something key to fix. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-10sstate.bbclass: Add progress bars when removing from the sysrootsPeter Kjellerstedt
If there are many recipes that should be cleaned out from the sysroots, it can actually take some time. This adds a progress bar to give a visual clue that the clean up is actually progressing. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-10-16sstate.bbclass: provide an exception for useradd scenarioMaxin B. John
Packages, which depend on users/groups created from other packages, needs "shadow-native" as a build time dependency. So, add an exception to the "shadow-native" from otherwise discarded native/cross tools dependency. Fixes [YOCTO #11960] Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-18devtool: rework source extraction so that dependencies are handledPaul Eggleton
Since it was first implemented, devtool's source extraction (as used by the devtool modify, extract and upgrade subcommands) ignored other recipe dependencies - so for example if you ran devtool modify on a recipe that fetches from svn or is compressed using xz then it would fail if those dependencies hadn't been built first. Now that we can execute tasks in the normal way (i.e. tinfoil.build_targets()) then we can rework it to use that. This is slightly tricky in that the source extraction needs to insert some logic in between tasks; luckily we can use a helper class that conditionally adds prefuncs to make that possible. Some side-effects / aspects of this change worth noting: * Operations are a little slower because we have to go through the task dependency graph generation and other startup processing. There's not really any way to avoid this though. * devtool extract didn't used to require a workspace, now it does because it needs to create a temporary bbappend for the recipe. (As with other commands the workspace be created on the fly if it doesn't already exist.) * I want any existing sysroot files and stamps to be left alone during extraction since we are running the tasks off to the side, and especially devtool extract should be able to be used without touching these. However, this was hampered by the automatic removal process in sstate.bbclass triggered by bb.event.ReachableStamps when the task signatures change, thus I had to introduce a way to disable this removal on a per-recipe basis (we still want it to function for any dependencies that we aren't working on). To implement this I elected to use a file written to tmp/sstate-control which gets deleted automatically after reading so that there's less chance of stale files affecting future sessions. I could have used a variable but this would have needed to be whitelisted and I'd have to have poked its value in using the setVariable command. Fixes [YOCTO #11198]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-07-31sstate: Improve SSTATE_SKIP_CREATIONRichard Purdie
Currently, dummy archives are created for skipped sstate tasks. We relied on these never being installed (the setscene task is missing) however this leads to odd behaviour as for example the setscene stamps are never looked at. Rather than trying to continue with the two separate behaviours, really skip package creation. We do need the file manipulation steps to install files under sstate control from a manifest perspective so we only skip at the final creation step. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-28meta: Fix return value checks from subprocess.call()'sMikko Rapeli
Python function subprocess.call() returns the return value of the executed process. If return values are not checked, errors may go unnoticed and bad things can happen. Change all callers of subprocess.call() which do not check for the return value to use subprocess.check_call() which raises CalledProcessError if the subprocess returns with non-zero value. https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module All users of the function were found with: $ git grep "subprocess\.call" | \ egrep -v 'if.*subprocess\.call|=\ +subprocess\.call|return.*subprocess\.call' Tested similar patch on top of yocto jethro. Only compile tested core-image-minimal on poky master branch. Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-11sstate: Ensure native/cross recipes have relocation of HOSTTOOLS_DIRRichard Purdie
The previous change to relocate HOSTTOOLS wasn't complete as some files, particularly in gcc stashed build directories were not being correctly relocated. This patch addresses the issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-01sstate.bbclass, staging.bbclass: Handle HOSTTOOLS_DIR when restoring statePeter Kjellerstedt
Paths to host tools that have been copied to ${HOSTTOOLS_DIR} may end up in the sstate cache. They thus need to be corrected when restoring from the sstate cache. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-13base-passwd/useradd: Various improvements to useradd with RSSRichard Purdie
Currently there are multiple issues with useradd: * If base-passwd rebuilds, it wipes out recipe specific user/group additions to sysroots and causes errors * If recipe A adds a user and recipe B depends on A, it can't see any of the users/groups A adds. This patch changes base-passwd so it always works as a postinst script within the sysroot and copies in the master files, then runs any postinst-useradd-* scripts afterwards to add additional user/groups. The postinst-useradd-* scripts are tweaked so that if /etc/passwd doesn't exist they just exit, knowning they'll be executed later. We also add a dummy entry to the dummy passwd file from pseudo so we can avoid this too. There is a problem where if recipe A adds a user and recipe B depends on A but doesn't care about users, it may not have a dependency on the useradd/groupadd tools which would therefore not be available in B's sysroot. We therefore also tweak postinst-useradd-* scripts so that if the tools aren't present we simply don't add users. If you need the users, you add a dependency on the tools in the recipe and they'll be added. We add postinst-* to SSTATE_SCAN_FILES since almost any postinst script of this kind is going to need relocation help. We also ensure that the postinst-useradd script is written into the sstate object as the current script was only being added in a recipe local way. Thanks to Peter Kjellerstedt <pkj@axis.com> and Patrick Ohly for some pieces of this patch. [Yocto #11124] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-12sstate.bbclass: check if mirror directory is writableEd Bartosh
Commit 51edde653707e7a3cd2186082458f01f32cd1996 makes a wrong assumption that SSTATE_MIRRORS have write permissions. A mirror is by definition outside of it's user control. In my use case it happens I does not have permissions to update the access time of the dereferenced symbolic-link file. Checked if file is writable before changing its atime. Thanks to Paulo Neves for the patch. [YOCTO #11307] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-08sstate: Skip glibc do_stash_locale and gcc do_gcc_stash_builddir tasksRichard Purdie
We never need these tasks as dependencies of other sstate tasks since they're only ever needed to build artefacts so we can always skip them and save some time/space. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-22sstate: Ensure installation directory is empty before executionRichard Purdie
When you enable the systemd DISTRO_FEATURE, opkg-native contains systemd units which have a relocation fixme list. When systemd isn't in DISTRO_FEATURES, there are no fixmes required. Unfortunately as sstate isn't cleaning up its installation directory before use, if you install the systemd version, then install the non-systemd version from sstate, it would leave behind the fixme file from the systemd version and breakage results as it would try and fixup files which don't exist. The solution is to ensure the unpack/install directory is clean before use. It does raise other questions about opkg-native, systemd and DISTRO_FEATURES but there is an underlying sstate issue here too which would cause missing file failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-13package_rpm.bbclass: make architecture-independent .rpm packages "noarch" ↵Alexander Kanavin
instead of "all" Too many places in dnf/rpm4 stack make that assumption; let's not fight against it. Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
2017-03-10sstate.bbclass: update .siginfo atimeEd Bartosh
.siginfo files are not being accessed from local or NFS-mounted sstate mirrors when sstate package is installed, so their atime is not updated. If sstate mirror is cleaned based on access time, they get deleted, even though they are still being used. Updated atime of .siginfo symlinks with 'touch -a'. This command dereferences symlinks pointing to the local mirror and updates atime of the .siginfo file on the mirror. [YOCTO #10857] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-28kernel, license, sstate, rootfs.py: Remove deploy directory READMEMike Crowe
It isn't clear that the README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt file in the deploy directory warrants the complexity it brings elsewhere. Let's just remove it entirely. In particular, if two do_image_complete tasks run in parallel they risk both trying to put their image into ${DEPLOY_DIR_IMAGE} at the same time. Both will contain a README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt file. In theory this should be safe because "cp -alf" will just cause one to overwrite the other. Unfortunately, coreutils cp also has a race[1] which means that if one copy creates the file at just the wrong point the other will fail with: cp: cannot create hard link ‘..../tmp-glibc/deploy/images/pantera/README_-_DO_NOT_DELETE_FILES_IN_THIS_D.txt’ to +‘..../tmp-glibc/work/rage_against-oe-linux-gnueabi/my-own-image/1.0-r0/deploy-my-own-image-complete/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt’: File exists [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25680 Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-15classes: Drop now unneeded update_data callsRichard Purdie
Now that the datastore works dynamically we don't need the update_data calls so we can just remove them. They're not actually done anything at all for a while. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-09sstate: Make absolute symlinks an errorRichard Purdie
The current relocation code is broken, at least in the native case. Fixing it would mean trying pass in new data on sstate tasks about the relative positioning of symlinks compared to the sstate relocation paths. Whilst we could do this, right now I'm favouring making this an error and fixing the small number of problematic recipes we have in OE-Core (3). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-01sstate/staging: Batch log messages for performanceRichard Purdie
According to profile data, repeated calls to bb.debug and bb.note in the extend_recipe_sysroot() codepath were accounting for 75% of the time (1.5s) in calls from tasks like do_image_complete. This batches up the log messages into one call into the logging system which gives similar behaviour to disabling the logging but retains the debug information. Since setscene_depvalid is also called from bitbake's setscene code, we have to be a little creative with the function parameters and leave the other debug output mechanism in place. This should hopefully speed up recipe specific sysroots. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31sstate: Make SSTATE_SCAN_CMD vars configurable using weak defaults.Kristian Amlie
For this we move them out of the python section so they can be overridden on a per-recipe basis. The motivation for this change is that not all tool chains need the path modifications provided by the command, and these will provide alternative or empty commands. The Go compiler is such an example. Signed-off-by: Kristian Amlie <kristian.amlie@mender.io> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-28sstate: Allow sstate_clean_manifest to take a prefixRichard Purdie
Manifest files containing the same duplicated prefix are wasteful on space and ultimately this costs build time. Add support for manifest files with common prefixes removed and use the prefix if the path isn't absolute. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23classes/oeqa: Replace subprocess.check_call() with check_output()Richard Purdie
If you use subprocess.check_output() the traceback will contain the output when the command fails which is very useful for debugging. There is no good reason not to use this everywhere. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23Switch to Recipe Specific SysrootsRichard Purdie
This patch is comparatively large and invasive. It does only do one thing, switching the system to build using recipe specific sysroots and where changes could be isolated from it, that has been done. With the current single sysroot approach, its possible for software to find things which aren't in their dependencies. This leads to a determinism problem and is a growing issue in several of the market segments where OE makes sense. The way to solve this problem for OE is to have seperate sysroots for each recipe and these will only contain the dependencies for that recipe. Its worth noting that this is not task specific sysroots and that OE's dependencies do vary enormously by task. This did result in some implementation challenges. There is nothing stopping the implementation of task specific sysroots at some later point based on this work but that as deemed a bridge too far right now. Implementation details: * Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in TMPDIR/sysroot-components/PACKAGE_ARCH/PN. * WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE. * This construction is primarily done by a new do_prepare_recipe_sysroot task which runs before do_configure and consists of a call to the extend_recipe_sysroot function. * Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot dependencies. * We have to do a search/replace 'fixme' operation on the files installed into the sysroot to change hardcoded paths into the correct ones. We create a fixmepath file in the component directory which lists the files which need this operation. * Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each time a new loader is added. These are handled by adding files in bindir with the name prefixed by "postinst-" and are run in each sysroot as its created if they're present. This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them. * Since a recipe can have multiple tasks and these tasks can run against each other at the same time we have to have a lock when we perform write operations against the sysroot. We also have to maintain manifests of what we install against a task checksum of the dependency. If the checksum changes, we remove its files and then add the new ones. * The autotools logic for filtering the view of m4 files is no longer needed (and was the model for the way extend_recipe_sysroot works). * For autotools, we used to build a combined m4 macros directory which had both the native and target m4 files. We can no longer do this so we use the target sysroot as the default and add the native sysroot as an extra backup include path. If we don't do this, we'd have to build target pkg-config before we could built anything using pkg-config for example (ditto gettext). Such dependencies would be painful so we haven't required that. * PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy for each machine. The paths therefore changed, the behaviour did not. * The ccache class had to be reworked to function with rss. * The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal recipe name therefore remains a bad idea. * The logic in insane needed tweaks to deal with the new path layout, as did the debug source file extraction code in package.bbclass. * The logic in sstate.bbclass had to be rewritten since it previously only performed search and replace on extracted sstate and we now need this to happen even if the compiled path was "correct". This in theory could cause a mild performance issue but since the sysroot data was the main data that needed this and we'd have to do it there regardless with rss, I've opted just to change the way the class for everything. The built output used to build the sstate output is now retained and installed rather than deleted. * The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold up against testing. This has been rewritten too. There are some assumptions made about paths, we save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is here works but is a little hardcoded and an area for future improvement. * In order to work with eSDK we need a way to build something that looks like the old style sysroot. "bitbake build-sysroots" will construct such a sysroot based on everything in the components directory that matches the current MACHINE. It will allow transition of external tools and can built target or native variants or both. It also supports a clean task. I'd suggest not relying on this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have to have built that in a previous bitbake invocation. * pseudo is run out of its components directory. This is fine as its statically linked. * The hacks for wayland to see allarch dependencies in the multilib case are no longer needed and can be dropped. * wic needed more extensive changes to work with rss and the fixes are in a separate commit series * Various oe-selftest tweaks were needed since tests did assume the location to binaries and the combined sysroot in several cases. * Most missing dependencies this work found have been sent out as separate patches as they were found but a few tweaks are still included here. * A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my hand. That implementation can probably be neater but this is on the list of things to cleanup later at this point. In summary, the impact people will likely see after this change: * Recipes may fail with missing dependencies, particularly native tools like gettext-native, glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors * Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst * There was a separate patch series dealing with roots postinst native dependency issues. Any postinst which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS. There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean we've found all the issues. Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the task logfiles, not the console so I've intentionally left this like that for now. We can turn it down easily enough in due course. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19sstate: Drop the depchain isPostDep() checksRichard Purdie
The dependencies of do_package_write_* tasks are either going to be packaging tools needed to build the packages, or, native tools needed at postinst time. Now we've formalised this dependency pattern, drop the hardcoded list and work based on the rule. The package creation tools are usually the same tools needed at rootfs/postinst time anyway so the difference is moot. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19Revert "classes/sstate: add a mode to error if sstate package unavailable"Paul Eggleton
It turns out that this check cannot work. We don't have the information to know whether an sstate package is really needed at this point in the execution, so we check the availability for things that we won't actually end up needing later on. Thus we can't fail if some of these aren't found or we'll get needless failures. This check was intended to give earlier more accurate errors when sstate artifacts failed to download, but that's not practical so we'll rely solely on the task execution check that was added within the runqueue. This reverts most of commit 9e711b54487c3141d7264b8cf0d74f9465020190 (we still need to allow BB_SETSCENE_ENFORCE through from the external environment since the eSDK relies upon that.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19sstate: Fix EXTRA_STAGING_FIXMES handlingRichard Purdie
The code wasn't working properly, tweak so that it works as expected and the grep expression includes the right patterns. Not sure this code has ever worked prior to this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09classes/sstate: fix file conflict messagePaul Eggleton
* Fix not decoding output from grep ("Matched in b'manifest...') * Fix showing "Matched in b''" if no match (show "not matched to any task" instead) * Drop the filtering out of .populate-sysroot from matched manifest names - it should have been .populate_sysroot so it doesn't work, and in any case the value of removing the task name is questionable given that we aren't removing it for any other task, and that the rest of the filename isn't only the task name, we might as well have the whole thing. At least then you can do a find on that exact name without wildcards and find it. * Fix indenting of file list entries and indent "matched in" further underneath * Minor punctuation fixes Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-09classes/sstate: handle filenames containing square bracketsPaul Eggleton
If a recipe installs a file or directory whose name contains square brackets [ ] that form a valid glob expression and that file then they won't be correctly removed from the sysroot, because we pass each path in the sstate manifest to our oe.path.remove() function which calls glob.glob() on the path passed into it and the expression won't actually match the original filename. Since we don't expect to put any wildcarded expressions in the sstate manifests, and we already have a try...except around this, we can actually use os.remove() here instead. Similarly, when we pass existing file paths to "grep" looking through the manifests, we don't want those paths to be treated as regexes - so use grep's -F command line switch. Fixes [YOCTO #10836]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16meta: 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: Ross Burton <ross.burton@intel.com>
2016-12-16meta: 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: Ross Burton <ross.burton@intel.com>
2016-11-03sstate: Ensure we don't remove sigbasedata filesRichard Purdie
We don't remove sigdata files, we also shouldn't remove sigbasedata files as this hinders debugging. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-05classes/sstate.bbclass: Enable thread lock when checkstatusAníbal Limón
The checkstatus function fires an event to notify bitbake UI about the progress of the task, this function is implemented using ThreadPool and is causing event lose when multiple threads tries to fire an event (writes over socket/fd). [YOCTO #10330] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>