summaryrefslogtreecommitdiffstats
path: root/meta/classes
AgeCommit message (Collapse)Author
2021-02-12python3targetconfig.bbclass: Make py3 dep and tasks only for target recipesKhem Raj
python3targetconfig append target python3 to dependencies unconditionally, and here its inherited unconditionally too but distutils3-base is inherited in BBCLASSEXTEND'ed recipes and other not-target recipes as well. Hence the change added via 9c8f666097802cb594a759989edcf01603a22df3 is now bridging the native dependencies with target python3 and thats resulting all sorts of rebuilds for multimachine builds e.g. MACHINE=qemuarm bitbake python3-scons-native MACHINE=qemumips bitbake python3-scons-native results in rebuilds for python3-scons-native bitbake-diffsigs shows Hash for dependent task python/python3-scons-native_3.1.2.bb:do_populate_sysroot changed from 1cdb93193b416477df6faa137e83a967b433c7aa29033146b405153f73f36933 to 3cea1e7cbedd121ecb768fbc291cc4e4d7d3b5c0442897 0e3b97bd058d162065 Hash for dependent task python/python3-scons-native_3.1.2.bb:do_install changed from 8d6018fd03ffc6060a04532dc39a5b7ccca1be026a69d069cb4fb11aef86dd89 to c5f1d173596a8e910f45a2b6e0b4dab96cd0102be4d62bd3156 229cb0f5ebb11 Hash for dependent task python/python3-scons-native_3.1.2.bb:do_compile changed from e3ee4b52a15267e6ae7853ec19a666b2fb62608a597608793336382d1c45f8a0 to 1e582043dfe6b3e00aaa532f363ce6afb37652abe837dac 7cc9769194c43eae1 Hash for dependent task python/python3-scons-native_3.1.2.bb:do_configure changed from 770a4d5a77a96ebd9e1e7368f710bca3f88e3b1266dffa3b2d0360b1e3a81e27 to a366982778b03eee5165c3117ee778f848acdfaa2 b346650fbdf114ac70ab57b Hash for dependent task python/python3-scons-native_3.1.2.bb:do_prepare_recipe_sysroot changed from 958910037856ff5d5eb2b5162b3cdd02a3a710fc543b933cfeba771ee095cb72 to 474333fb565f908992fd3716 4935aaecf31a79e867826fe634cde4f44171d8e7 Hash for dependent task python/python3_3.9.0.bb:do_populate_sysroot changed from 7ac1c4fcbb2eacf98d2c32d991751bd2f3c7d55e2e32f2c9e485e7f5975fecf8 to 25dcfe74a95af19cce8df7c29311cc5edbbf6ad 08777e46a6fa6e417c0445018 ... Therefore limit effects of this class only for target recipes. Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Alexander Kanavin <alex.kanavin@gmail.com> Cc: Martin Jansa <Martin.Jansa@gmail.com> Cc: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c99bb79087e74a967286469e1d8888a546ebec83) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-12meta: drop _PYTHON_SYSCONFIGDATA_NAME hacksAlexander Kanavin
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit d3a81dd0e72a3495bfc7cc969c2bb806b666023d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-12distutils3-base.bbclass: use python3targetconfigAlexander Kanavin
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 9c8f666097802cb594a759989edcf01603a22df3) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-12python3: split python target configuration into own classAlexander Kanavin
Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was problematic as it was leaking into host python environment, which was causing tracebacks depending on host distro and action (typically anything involving importing sysconfig module). The new class sets the variable only in specific tasks where it is needed, and should be inherited explicitly: - use python3native to run scripts with native python - use python3targetconfig to run scripts with native python if those scripts need to access target config data (such as correct installation directories). This also adds a dependency on target python, so should be used carefully to avoid lengthening builds. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 5a118d4e7985fa88f04c3611f8db813f0dafce75) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-11image_types.bbclass: tar: use posix format instead of gnuMartin Jansa
* gnu isn't compatible with --xattrs used e.g. here: https://github.com/advancedtelematic/meta-updater/blob/d3a832f66e8802cb45536ff278d5c77f946d341d/classes/image_types_ostree.bbclass#L16 causing do_image_tar failing with: | tar: --xattrs can be used only on POSIX archives | Try 'tar --help' or 'tar --usage' for more information. * https://www.gnu.org/software/tar/manual/html_chapter/tar_8.html says about posix format: This is the most flexible and feature-rich format. It does not impose any restrictions on file sizes or file name lengths. This format is quite recent, so not all tar implementations are able to handle it properly. However, this format is designed in such a way that any tar implementation able to read `ustar' archives will be able to read most `posix' archives as well, with the only exception that any additional information (such as long file names etc.) will in such case be extracted as plain text files along with the files it refers to. This archive format will be the default format for future versions of GNU tar. and: The default format for GNU tar is defined at compilation time. You may check it by running tar --help, and examining the last lines of its output. Usually, GNU tar is configured to create archives in `gnu' format, however, future version will switch to `posix'. * I've compared tar on centos7 and ubuntu-18.04: bash-4.2$ cat /etc/centos-release CentOS Linux release 7.9.2009 (Core) bash-4.2$ tar --version tar (GNU tar) 1.26 ... bash-4.2$ tar --help | tail -n 5 *This* tar defaults to: --format=gnu -f- -b20 --quoting-style=escape --rmt-command=/etc/rmt --rsh-command=/usr/bin/ssh ... bitbake@e0ee76f81c2f:/$ grep VERSION /etc/os-release VERSION="18.04.5 LTS (Bionic Beaver)" VERSION_ID="18.04" VERSION_CODENAME=bionic bitbake@e0ee76f81c2f:/$ tar --version tar (GNU tar) 1.29 ... bitbake@e0ee76f81c2f:/$ tar --help | tail -n 5 ... *This* tar defaults to: --format=gnu -f- -b20 --quoting-style=escape --rmt-command=/usr/lib/tar/rmt --rsh-command=/usr/bin/rsh Both support posix format (as pax POSIX 1003.1-2001). But centos7 version is already too old anyway, because it doesn't support --sort=name used since: https://git.openembedded.org/openembedded-core/commit/?id=4fa68626bbcfd9795577e1426c27d00f4d9d1c17 and https://git.openembedded.org/openembedded-core/commit/?id=f19e43dec63a86c200e04ba14393583588550380 says that 1.28 is the minium version now and https://git.openembedded.org/openembedded-core/commit/?id=7a66434cf11b7f051699b774e4fccd6738351368 recommends to use install-buildtools for hosts with tar < 1.28 On the other side latest tumbleweed from: https://hub.docker.com/r/opensuse/tumbleweed with tar-1.33 alredy defaults to posix format: b99dbb3d86dd:/ # head -n 3 /etc/os-release NAME="openSUSE Tumbleweed" ID="opensuse-tumbleweed" b99dbb3d86dd:/ # tar --version tar (GNU tar) 1.33 ... b99dbb3d86dd:/ # tar --help | tail -n 3 *This* tar defaults to: --format=posix -f- -b20 --quoting-style=escape --rmt-command=/usr/bin/rmt --rsh-command=/usr/bin/ssh I've packaged some sample rootfs directory with both tars and the result is identical (with --format=gnu as well as --format=posix). with ubuntu: tar --sort=name --format=gnu --numeric-owner -cf rootfs.ubuntu.gnu.tar -C rootfs . tar --xattrs --xattrs-include=* --sort=name --format=posix --numeric-owner -cf rootfs.ubuntu.posix.tar -C rootfs . tumbleweed: tar --sort=name --format=gnu --numeric-owner -cf rootfs.tumbleweed.gnu.tar -C rootfs . tar --xattrs --xattrs-include=* --sort=name --format=posix --numeric-owner -cf rootfs.tumbleweed.posix.tar -C rootfs . centos7 (without --sort=name): tar --format=gnu --numeric-owner -cf rootfs.centos7.gnu.tar -C rootfs . tar --xattrs --xattrs-include=* --format=posix --numeric-owner -cf rootfs.centos7.posix.tar -C rootfs . size is identical: -rw-r--r-- 1 mjansa mjansa 2487480320 Feb 5 09:19 rootfs.ubuntu.gnu.tar -rw-r--r-- 1 mjansa mjansa 2487480320 Feb 5 10:17 rootfs.centos7.gnu.tar -rw-r--r-- 1 mjansa mjansa 2487480320 Feb 5 10:26 rootfs.tumbleweed.gnu.tar -rw-r--r-- 1 mjansa mjansa 2579875840 Feb 5 10:15 rootfs.ubuntu.posix.tar -rw-r--r-- 1 mjansa mjansa 2579875840 Feb 5 10:16 rootfs.centos7.posix.tar -rw-r--r-- 1 mjansa mjansa 2579875840 Feb 5 10:26 rootfs.tumbleweed.posix.tar but md5s aren't: 5e3880283379dd773ac054e20562fdea rootfs.centos7.gnu.tar abeaf992c780aa780a27be01365d26f5 rootfs.centos7.posix.tar 0c6ee59d87ab56583293262de110bca4 rootfs.tumbleweed.gnu.tar 1555bc7276eaba924bf82a13a010fd6d rootfs.tumbleweed.posix.tar 553d802bba351e273191bd5b2a621b66 rootfs.ubuntu.gnu.tar b6d7b43b30174686f6625ba3c7aefdc6 rootfs.ubuntu.posix.tar diffoscope shows some differences when using gnu format: $ diffoscope rootfs.tumbleweed.gnu.tar rootfs.ubuntu.gnu.tar ... -00239890: 3030 3000 3030 3737 3637 0020 4b00 0000 000.007767. K... +00239890: 3030 3000 3031 3135 3737 0020 4b00 0000 000.011577. K... ... -00239900: 0075 7374 6172 2020 0000 0000 0000 0000 .ustar ........ +00239900: 0075 7374 6172 2020 0072 6f6f 7400 0000 .ustar .root... ... -00239920: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +00239920: 0000 0000 0000 0000 0072 6f6f 7400 0000 .........root... with posix format there are also some differences shown by diffoscope: $ diffoscope rootfs.tumbleweed.posix.tar rootfs.ubuntu.posix.tar 016a4c00: 2e2f 7573 722f 6269 6e2f 5061 7848 6561 ./usr/bin/PaxHea -016a4c10: 6465 7273 2f63 6861 7474 722e 6532 6673 ders/chattr.e2fs -016a4c20: 7072 6f67 7300 0000 0000 0000 0000 0000 progs........... +016a4c10: 6465 7273 2e32 322f 6368 6174 7472 2e65 ders.22/chattr.e +016a4c20: 3266 7370 726f 6773 0000 0000 0000 0000 2fsprogs........ ... 03937000: 2e2f 7573 722f 6269 6e2f 5061 7848 6561 ./usr/bin/PaxHea -03937010: 6465 7273 2f63 6f6e 7461 696e 6572 642d ders/containerd- -03937020: 6374 7200 0000 0000 0000 0000 0000 0000 ctr............. +03937010: 6465 7273 2e32 322f 636f 6e74 6169 6e65 ders.22/containe +03937020: 7264 2d63 7472 0000 0000 0000 0000 0000 rd-ctr.......... so cannot really say which format is better for reproducible tar archives from different distros, but posix at least supports xattrs and it's the format for future. Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 3ecea58f2a3382d9f4b410d6ad7089111334cb6f) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-11image_types: Ensure tar archives are reproducibleRichard Purdie
The tar output seems to vary depending on the version of tar used and distro configuration. Be explict about the output format to avoid this and be determinstic. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c56f3c9febc1732aa1302524c6c4da36f16bd1f7) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-09classes/image_types_wic: Reorder do_flush_pseudodbRicardo Ribalda
When IMAGE_FSTYPES contains more types than wic, it can happen than the pseudo database is not flushed properly. This can be solved by changing the order of when do_flush_pseudodb is launched. Yocto Bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13898 Fixes: dde90a5dd2b2 ("wic: Fix multi images .wks with bitbake") Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 445b0a9544b55735496bbb23dbff3399b3b9e9a4) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04npm.bbclass: use python3 for npm configVyacheslav Yurkov
python2-native executable is not available in sysroot anymore, which causes compilation of some nodejs modules to fail. Switch to python3 as a default python version. Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit d21f50ecf8e8683a92b7d234fa8225c2c1470595) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04buildhistory.bbclass: avoid exception for empty BUILDHISTORY_FEATURES variablePeter Bergin
An exception is fired when a BuildStarted event is sent to buildhistory bbclass and the variable BUILDHISTORY_FEATURES is not set. ERROR: Execution of event handler 'buildhistory_eventhandler' failed Traceback (most recent call last): File "<...>/meta/classes/buildhistory.bbclass", line 862, in buildhistory_eventhandler(e=<bb.event.BuildStarted object at 0x7f94c3810250>): python buildhistory_eventhandler() { > if e.data.getVar('BUILDHISTORY_FEATURES').strip(): reset = e.data.getVar("BUILDHISTORY_RESET") AttributeError: 'NoneType' object has no attribute 'strip' This can happen in a multiconfig build where the default configuration use the buildhistory class but not the configuration in mc. It should be a rare case that this happens and it was found in a missconfigured build. Signed-off-by: Peter Bergin <peter@berginkonsult.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit a74e30a4de02c8efd3e7102ba7a4fe06df53cc34) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04kernel.bbclass: fix deployment for initramfs imagesAwais Belal
The do_bundle_initramfs() only processes kernel image types that are found in KERNEL_IMAGETYPE_FOR_MAKE whereas the build system can generate other types that are not directly supported by the kernel build system. In which case when we come to the deploy phase not all the images mentioned in KERNEL_IMAGETYPES would have a respective initramfs bundled image. An example is using vmlinux.gz in KERNEL_IMAGETYPES and enabling initramfs and then we see install: cannot stat 'arch/arm64/boot/vmlinux.gz.initramfs': No such file or directory So we align the deploy phase with bundle initramfs phase and pick up relevant initramfs bundled images using KERNEL_IMAGETYPE_FOR_MAKE instead of KERNEL_IMAGETYPES. Signed-off-by: Awais Belal <awais_belal@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 526bdd88ccd758204452579333ba188e29270bde) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04package: Ensure do_packagedata is cleaned correctlyRichard Purdie
In an earlier commit, libprocps was split into a separate package leaving no shlibs in the main package. A bug was seen where igt-gpu-tools wouldn't build correctly in some cases as it thought the librbary was still in the main package, throwing qa errors as a result. The issue was due to an extra file being left in the sstate output of the do_packagedata task in the shlibs2/ folder which contained the bad shlibs information. The reason for this was that the temporary directory used in this task wasn't being cleaned so files which were deleted were not handled correctly. Add a missing cleandirs entry to fix this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 50f17d0a655a3a2556f9fcad67259101c2814a36) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04package.bbclass: hash equivalency and pr serviceMark Hatle
When the PR service is enabled a number of small changes may happen to variables. In the do_package step a call to package_get_auto_pr will end up setting PRAUTO and modifying PKGV (if AUTOINC is there). PRAUTO is then used by EXTENDPRAUTO, which is then used to generate PKGR. Since this behavior typically happens BEFORE the BB_UNIHASH is calculated for do_package, we need a way to defer the expansion until after we have the unihash value. Writing out the pkgdata files w/o AUTOPR and PKGV (AUTOINC) expanded to placeholder values is the easiest way to deal with this. All other variables are expanded as expected. In the next task, typically do_packagedata, we will then use the UNIHASH from the do_package to get the PR (AUTOPR) as well as generate the AUTOINC replacement value (now PRSERV_PV_AUTOINC). The do_packagedata then translates the placeholders to the final values when copying the data from pkgdata to pkgdata-pdata-input. Also update the prservice test case. With unihash, just changing the do_package (via a _append) will not change the PR. So write the date to a specific file that is incorporated into the unihash to ensure it is always different for the test. Various assert messages were also updated to make it easier to figure out where/why a problem occured. Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2e32f37b0e4abc438c8f60e673cd18a5cc110768) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04cve_check: add CVE_VERSION_SUFFIX to indicate suffix in versioningLee Chee Yang
add CVE_VERSION_SUFFIX to indicate the version suffix type, currently works in two value, "alphabetical" if the version string uses single alphabetical character suffix as incremental release, blank to not consider the unidentified suffixes. This can be expand when more suffix pattern identified. refactor cve_check.Version class to use functools and add parameter to handle suffix condition. Also update testcases to cover new changes. Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 5dfd5ad5144708b474ef31eaa89a846c57be8ac0) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04cve-check: replace Looseversion with custom version classLee Chee Yang
The way distutils.version.LooseVersion compare version are tricky, it treat all these ( "1.0-beta2", "1.0-rc1", "1.0A", "1.0p2" and "1.0pre1") as greater version than "1.0". This might be right for "1.0A" and "1.0p1" but not for the rest, also these version could be confusing, the "p" in "1.0p1" can be "pre" or "patched" version or even other meaning. Replace Looseversion with custom class, it uses regex to capture common version format like "1.1.1" or tag format using date like "2020-12-12" as release section, check for following known string/tags ( beta, rc, pre, dev, alpha, preview) as pre-release section, any other trailing characters are difficult to understand/define so ignore them. Compare release section and pre-release section saperately. included selftest for the version class. [YOCTO#14127] Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 6ced85e9ddd3569240f1e8b82130d1ac0fffbc40) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-02-04sanity.bbclass: Check if PSEUDO_IGNORE_PATHS and paths under pseudo control ↵Dorinda
overlap Added a sanity check for when PSEUDO_IGNORE_PATHS and paths under pseudo control overlap to avoid random failures generated. [YOCTO #14193] Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 6e4bd8cabcdedf4b52345ef5eb421f71d0f19b1d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-29staging: Clean up files installed into the sysrootRichard Purdie
There are a variety of files being installed into $datadir which we don't need. Pick the top "offenders" which amount of thousands of files and simply don't install them. These include things like test data, terminfo data, locale data for native tools and so on. This saves copying these files into native and target sysroots and should improve performance (smaller sstate, fewer files to copy around). With this and the python recipe change, alsa-tools went from: recipe-sysroot: 18357 recipe-sysroot-native: 14129 to recipe-sysroot: 10809 recipe-sysroot-native: 8079 which is a decent improvement. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 366c72941fe1c24d0b1d96df46e13cb9eb4e79d6) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-29externalsrc: Detect code changes in submodulesTomasz Dziendzielski
The srctree_hash was calculated only from main source directory ignoring changes in submodules. [YOCTO #13748] Use submodule--helper to determine all submodules, and calculate hash from all git tree objects names combined. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 50ff9afb3990bcf60b4fa1f937506cb84028c32d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28externalsrc: Fix parsing error with devtool non-git sourcesTomasz Dziendzielski
If srcdir is under poky directory (e.g. devtool poky/build/workspace/sources) and is not a git repository then ${@srctree_hash_files(d)} will run "git rev-parse --git-dir" and detect poky directory as git-dir and run "'git', 'add', '-A', '.'], cwd=s_dir" trying to add srcdir but build dir is in .gitignore and latest git will fail with "The following paths are ignored by one of your .gitignore files: build" which will end with "ExpansionError during parsing". In this commit I added a check if git_dir is the same as git-dir from TOPDIR (which will detect poky directory) and if yes, then treat srcdir as non-git sources. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 95fbac8dcad6c93f4c9737e9fe13e92ab6befa09) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28sanity.bbclass: sanity check for if bitbake is present in PATHDorinda
If a user executes the environment script instead of sourcing it, there's an error about an empty element in PATH. This is because bitbake isn't present in environment variable PATH. Hence, this patch adds a sanity check to verify if bitbake is present in PATH and if bitbake isn't present issue a warning message. [YOCTO #13822] Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e08799913a7f207bc63e085eb98196fd61ed57bc) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28sanity: Verify that user isn't building in PSEUDO_IGNORE_PATHSDorinda
If a user builds in a path in PSEUDO_IGNORE_PATHS, random failures are generated. Hence this patch adds a sanity check in sanity.bbclass to ensure that a user isn't building in PSEUDO_IGNORE_PATHS. [YOCTO #14179] Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7a681525e904914e938de25df5cc64209097d15d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28image_types_wic: Move wic working directoryPaul Barker
By default the wic working directory is placed under the output directory. When invoking wic under bitbake, the wic output directory is added to PSEUDO_PATHS_IGNORE to avoid issues with files being removed from outside a pseudo environment (see oe-core commit ad8f5532ff). However, wic will copy the rootfs directory into its working directory if it needs to add or remove content before creating a filesystem image. This copy of the rootfs directory must be tracked by pseudo in order to keep the permissions correct in the resulting image. So we can't have the wic working directory under a path in PSEUDO_PATHS_IGNORE unless we like broken permissions. To fix this the new '-w' argument to wic is used to move the working directory away from the output directory. Note that wic deletes the temporary working directory automatically when it finishes creating an image so users won't normally see the 'tmp-wic' directory under WORKDIR. Fixes [Yocto #14129] Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 4d07169499c47fa9dc759e6f81843416a6dc25c5) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28wic: Allow exec_native_cmd to run HOSTTOOLSPaul Barker
This allows programs from HOSTTOOLS (e.g. 'install', 'rm', 'mv', etc) to be more easily executed by wic. Without this change only programs from an actual *-native recipe built by bitbake can be executed by wic. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8eb186acdecfbb3151c9a0ab148358e3fe5cce39) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28license.bbclass: Add COMMON_LICENSE_DIR and LICENSE_PATH dirs to ↵Martin Jansa
PSEUDO_IGNORE_PATHS * now without ${COREBASE}/meta in PSEUDO_IGNORE_PATHS after: 73d538f207 bitbake.conf: Prevent pyc file generation in pseudo context the do_package tasks are failing when LICENSE_CREATE_PACKAGE is enabled pseudo.log shows that it's because of license texts copied from ${COREBASE}/meta: path mismatch [46 links]: ino 96733640 db '/OE/build/tmp-glibc/work/all-oe-linux/foo/1.0/image/usr/share/licenses/foo/generic_Apache-2.0' req '/OE/build/openembedded-core/meta/files/common-licenses/Apache-2.0'. Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 39423a33595e7ade82fc88f55823660f8532cb84) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28distutils3: allow setup.py to be run from a different directory to ${S}Jack Mitchell
Sometimes setup.py can be buried deep in a source tree. This has traditionally been solved with setting S to the subdirectory in the source. However with the new pseudo changes, some python modules make changes to files beneath ${S}, for example: S = "${WORKDIR}/git/python/pythonmodule" then in setup.py it works with source code in a relative fashion, such as: ../../src This causes pseudo to abort as it isn't tracking the paths. Therefore implement the variable DISTUTILS_SETUP_PATH so that recipes can use: S = "${WORKDIR}/git" DISTUTILS_SETUP_PATH = "${S}/python/pythonmodule" inherit distutils3 This allows the full source tree to be monitored, while distutils can run setup.py from a location other than ${S}. Signed-off-by: Jack Mitchell <ml@embed.me.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ddcc349cede0c4fe1909df1ded7b0a7c509cd758) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28uninative: Don't use single sstate for pseudo-nativeRichard Purdie
pseudo-native is a bit special. It conditionally compiles in support for xattr, statx and statvfs amongst other options. If a pseudo-native binary is used on a system where these functions are present but it wasn't compiled in we see hard to debug permissions problems. An example is the devtool.DevtoolExtractTests.test_devtool_deploy_target oe-selftest which shows a cryptic error: File "/home/pokybuild/yocto-worker/oe-selftest-fedora/build/meta/lib/oeqa/selftest/cases/devtool.py", line 1388, in test_devtool_deploy_target self.assertEqual(filelist1, filelist2) File "/usr/lib64/python3.9/unittest/case.py", line 831, in assertEqual assertion_func(first, second, msg=msg) File "/usr/lib64/python3.9/unittest/case.py", line 1037, in assertListEqual self.assertSequenceEqual(list1, list2, msg, seq_type=list) File "/usr/lib64/python3.9/unittest/case.py", line 1019, in assertSequenceEqual self.fail(msg) File "/usr/lib64/python3.9/unittest/case.py", line 670, in fail raise self.failureException(msg) AssertionError: Lists differ: ['-rwxr-xr-x 6000 6000 /etc/init.d/mdmonitor', '-rw-r-[10124 chars]n.8'] != ['-rwxr-xr-x root root /etc/init.d/mdmonitor', '-rw-r-[10124 chars]n.8'] First differing element 0: '-rwxr-xr-x 6000 6000 /etc/init.d/mdmonitor' '-rwxr-xr-x root root /etc/init.d/mdmonitor' This is due to a version of pseudo without statx being used on a system where ls uses statx, hence the files are displayed as 6000.6000 instead of root.root. Avoid this by always building pseudo-native for the specific distro in question rather than using a universal sstate feed. This hopefully fixes one of the mysterious AB-INT issues. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 6e3785a3f1f3cf68f5fe101cd6bebe91db165973) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28base.bbclass: use os.path.normpath instead of just comparing WORKDIR and S ↵Martin Jansa
as strings * cannot use os.path.samefile, because S/B might not exist at this time yet * there is issue with PSEUDO_IGNORE_PATHS when some recipe sets e.g. S = "${WORKDIR}/" whole WORKDIR gets added to PSEUDO_IGNORE_PATHS and then the build can fail with various strange errors, in my case do_package was failing when do_package calls: fix_perms(.../1.0-r0/package/etc, 755, 0, 0, /etc) and fails with "[Errno 1] Operation not permitted:" Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 50b11a61ab29acb8ec990668353e0b7305114628) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28abi_version,sanity: Tell users TMPDIR must be clean after pseudo changesRichard Purdie
After the recent path ignore changes, there are invalid entries in exiting pseudo databases which will trip up users with the new abort() (proving how common the pseudo potential corrpution is!). Inform them a clean TMPDIR is needed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 016ee90e210c9b15b80e8370d83f41a14867a413) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28wic: Handle new PSEUDO_IGNORE_PATHS variableRichard Purdie
Adjust wic to correctly handle the new PSEUDO_IGNORE_PATH variable and avoid inode corruption issues. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 13500f5234361385c365c7c35e83f99435500481) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28wic: Fix multi images .wks with bitbakeRicardo Ribalda Delgado
In order to support .wks files with multiple images inside bitbake we need to explicitly set the pseudo database in use. Eg: If we try this .mks: part / --source rootfs --ondisk sda --fstype=ext4 part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4 The username for all the files under /export will be set to the runner of bitbake (usually UID 1000). Before we run wic, we need to make sure that the pseudo database will be flushed, and contains all the data needed. Cc: Paul Barker <pbarker@konsulko.com> Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit dde90a5dd2b22a539095d1bac82acc15c6380ac8) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-28base/bitbake.conf: Enable pseudo path filteringRichard Purdie
This is a pretty big change to the way pseudo operates when used in OpenEmbedded. Normally, pseudo monitors and logs (adds to its database) any file created or modified whilst in a fakeroot environment. There are large numbers of files we simply don't care about the permissions of whilst in that fakeroot context, for example ${S}, ${B}, ${T}, ${SSTATE_DIR}, the central sstate control directories, This change uses new functionality in pseudo to ignore these directory trees, resulting in a cleaner database with less chance of "stray" mismatches if files are modified outside pseudo context. It also should reduce some overhead from pseudo as the interprocess round trip to the server is avoided. There is a possible complication where some existing recipe may break, for example, we found a recipe which was writing to "${B}/install" for "make install" in do_install and since we listed ${B} as not to be tracked, there were errors trying to chown root for files in this location. This patch fixes a few corner cases in OE-Core when used with this new ignore list: * The archiver directory matched a "${WORKDIR}/deploy*" pattern so was renamed to something else since that directory does need its root permissions * The ${S} and ${B} ignoring is conditional on them being different to ${WORKDIR} * package_write_* task output (the debs/rpms/ipks) are now owned by the build user so we don't want the file ownership information in the hashequiv outhash calculation even if they are built under pseudo. * The fontcache postinstall intercept is run under qemu outside of pseudo context so delete files it may delete up front where pseudo can see this. * SSTATE_DIR is in PSEUDO_PATHS_IGNORE, which is in FAKEROOTENV which is cached by bitbake. We therefore need to trigger reparsing if this changes, which means SSTATE_DIR can be in BB_HASHBASE_WHITELIST but not BB_HASHCONFIG_WHITELIST. Rework the variables to handle this. This otherwise breaks some of our sstate tests in oe-selftest. * Ignore the temp directory wic uses for rebuilding rootfs. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ad8f5532ffaead9a5ad13e1034fe9e5e1b7979f4) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-27linuxloader: Avoid confusing string concat errorsRichard Purdie
None is a bad choice of return value for functions used in variables (strings) as a failure results in concatination errors. Use a string with a clear meaning that can be searched for instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-19waf: don't assume the waf intepretter is goodRoss Burton
Waf typically uses `python` as the intepretter but inside a task this does not exist. Typically this is solved by patching waf (see the glmark2 recipe) but not all versionf of Waf support Python 3 so we can't assume a specific interpretter. Instead, create a new variable WAF_PYTHON for the correct interpretter, and default this to `python3`. If the user has a recipe that needs Python 2 then this can be changed in the recipe. (From OE-Core rev: 802e80d35e6374b9b80f89068d00b84fe2d04ca1) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 85b6301c6190a1d1823de9bfe7285f7a7d15a46f) [Fixes build issue on Ubuntu 20 with mvp https://github.com/openembedded/meta-openembedded/issues/304 ] Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-19classes/waf: Add build and install argumentsJoshua Watt
Adds variables that can be used to allow a recipe to pass extra arguments to `waf build` and `waf install`. In most cases, you want to pass the same arguments to `build` and `install` (since install is a superset of `build`), so by default setting EXTRA_OEWAF_BUILD also affects `waf install`, but this can be overridded. (From OE-Core rev: 493e17a2f5cbbbe3b1e435dadb281b007bca2cbf) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 633652284b13dc78206f4cc8e81f29de44777b75) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-18license_image.bbclass: fix missing recipeinfo on selfMichael Ho
Resolve a build bug where image recipes with a do_deploy task will fail. If the image recipe inheriting license_image.bbclass has a deploy task, then the function get_deployed_dependencies will add itself to the list of recipes to get license information for. However, image recipes don't generally deploy license info so this results in an error. File: '/nvme/poky/meta/classes/license_image.bbclass', lineno: 192, function: license_deployed_manifest ... Exception: FileNotFoundError: [Errno 2] No such file or directory: '/nvme/poky/build/tmp/deploy/licenses/core-image-minimal/recipeinfo' Add a corner case to exclude the originating image recipe from the list of dependencies to check. Signed-off-by: Michael Ho <Michael.Ho@bmw.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 13fb39e49e55a0bc7c78b0bfdc372163b3f9e70a) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-18systemd.bbclass: improve error message when a service unit specified in ↵Chris Laplante
SYSTEMD_SERVICE is not found The previous message was fairly useless without diving into the bbclass. Signed-off-by: Chris Laplante <mostthingsweb@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ef6117b148be65536e89409a83cbfd22049c652e) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-11go.bbclass: don't stage test data with sources of dependenciesThomas Perrot
As for the sources the dependencies contain test data, ELF files and other binaries which aren't necessary for building and which lead to unnecessary QA warnings. Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7faea9766127fe4e1023c89b140cc98020655155) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-04populate_sdk_base: Fix condition syntax if SDK_RELOCATE_AFTER_INSTALL is ↵Tomasz Dziendzielski
disabled If variable is set to empty string the comparison is "if [ -eq 1 ]" which fails with "[: -eq: unary operator expected". Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 36a2dc83fd0e1d6e2b8441e24a4cbc48a6c4fc19) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-04uboot-extlinux-config: exclude OVERRIDES from do_create_extlinux_config vardepsChristopher Larson
This function is primarily *appending* configuration entries to the overrides, it only gets it to ensure it's set at all, so doesn't belong in the vardeps. Having a dependency on OVERRIDES means you cannot use a bbclass like distrooverrides without changing the signatures of recipes using this class. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit fef74d3651d432977caef8fea54fc54bf2784a74) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-04grub-efi-cfg: exclude OVERRIDES from build_efi_cfg vardepsChristopher Larson
This function is primarily *appending* configuration entries to the overrides, it only gets it to ensure it's set at all, so doesn't belong in the vardeps. Having a dependency on OVERRIDES means you cannot use a bbclass like distrooverrides without changing the signatures of recipes using this class. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8fad5db8c3275a0dc9fdb37761f2e9381e1413da) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-04archiver.bbclass: Fix --runall=deploy_archives for imagesRobert Yang
Fixed: INHERIT += "archiver" COPYLEFT_LICENSE_INCLUDE = "*" $ bitbake core-image-minimal --runall=deploy_archives [snip] KeyError: '/path/to/meta/recipes-core/images/core-image-minimal.bb:do_ar_original' [snip] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 59785a51110c450c7629218f6042f1d9d309618e) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2021-01-01kernel: set COMPATIBLE_HOST to *-linuxRoss Burton
The target system triple contains whether the target is Linux or not, so use it to avoid situations where you can attempt to build a kernel for systems which don't support Linux. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit b1eeeab21a81990321468ddbdd1745ea24d1828d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-12-11metadata_scm: Fix signature handling of METADATA_REVISION and METADATA_BRANCHRichard Purdie
We're not interested in the dependencies of these functions and what those functions look like, we're interested in the value the variable has. Force the hashed value to be the actual value from the function. This means using METADATA_REVISION in DISTRO_VERSION for example now correctly rebuilds when it changes value. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 005651dc782859c01f170fb974811b2a13cb2cef) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-12-10kernel-module-split.bbclass: fix kernel modules getting marked as CONFFILESGratian Crisan
Yi pointed out that commit 1a70a92d1f10 ("kernel-module-split.bbclass: identify kernel modconf files as configuration files") is unintentionally adding the actual kernel /lib/modules .ko files to the CONFFILES variable. The root cause is the re-use of the 'files' variable in that commit. Fix it by using a separate variable to keep track of the generated module .conf files that need to be marked as configuration files. Fixes: 1a70a92d1f10 ("kernel-module-split.bbclass: identify kernel modconf files as configuration files") Reported-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit db5f2ca532db4f0d2e05b7cb5f9d146e1dd76ab3) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-12-10image_types: sort tarball file listingsRoss Burton
Help rootfs tarballs be reproducible by sorting the file listing. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 4fa68626bbcfd9795577e1426c27d00f4d9d1c17) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30fs-perms: Ensure /usr/src/debug/ file modes are correctRichard Purdie
If files are copied into /usr/src/debug directly from WORKDIR (e.g. makedevs) we'd get the permissions from the checkout which would depend on the host umask. Avoid this and be deterministic by setting the file modes consistently. Core code copies the files in so we're responsible for the permissions. Unfortunately to force this change to apply we need to invalidate both the package tasks and the hash equivalance mappings since file mode 'corruption' already made it into the output hashes (both input options were mapped to the output hashes). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1f958bcd6c9cd12ec76d80586cba15f4d6ed17a7) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30distutils-common-base: fix LINKSHARED expansionAnuj Mittal
Add the missing $ so SECURITY_CFLAGS actually gets expanded. Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 6ed2f892ebb0b4e30a3bf167eac68027ea378a2d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30cve-check: show real PN/PVRoss Burton
The output currently shows the remapped product and version fields, which may not be the actual recipe name/version. As this report is about recipes, use the real values. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 18827d7f40db4a4f92680bd59ca655cca373ad65) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30license_image.bbclass: use canonical name for license filesVyacheslav Yurkov
When copying license files to the image rootfs, i.e to /usr/share/common-licenses, a canonical name of a license should be used, otherwise duplicated files end up in common-licenses directory. For example, GPL-2.0 license according to conf/license.conf can be referenced in recipes as GPL-2, GPLv2, and GPLv2.0. If a license name is used directly, we end up with three files in the rootfs with the same content. If a canonical name used instead, then each license gets copied only once. Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 670fe71dd18ea675f35581db4a61fda137f8bf00) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30roofs_*.bbclass: fix missing vardeps for do_rootfsLoic Domaigne
As per lib/oe/rootfs.py and lib/oe/package_manager/???/__init__.py the PACKAGE_FEED baseurl is defined as the joined paths of: URIS/BASE_PATHS/ARCHS Therefore, the do_rootfs task should depend furthermore on PACKAGE_FEED_{BASE_PATHS,ARCHS} to properly retrigger a build if the value changes. Signed-off-by: Loic Domaigne (ljd) <tech@domaigne.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e5329464f5ebad909c4c9bd27a718bbd8f4cc221) Signed-off-by: Steve Sakoman <steve@sakoman.com>
2020-11-30kernel: Set proper LD in KERNEL_KCONFIG_COMMANDWonmin Jung
With 'ld-is-gold' and linux kernel 5.4 or later, menuconfig task for kernel recipes will fail with: $ bitbake -c menuconfig virtual/kernel ... scripts/kconfig/mconf Kconfig scripts/Kconfig.include:43: gold linker 'x86_64-poky-linux-ld' not supported /OE/build/tmp/work-shared/qemux86-64/kernel-source/scripts/kconfig/Makefile:29: recipe for target 'menuconfig' failed make[2]: *** [menuconfig] Error 1 /OE/build/tmp/work-shared/qemux86-64/kernel-source/Makefile:606: recipe for target 'menuconfig' failed make[1]: *** [menuconfig] Error 2 /OE/build/tmp/work-shared/qemux86-64/kernel-source/Makefile:185: recipe for target '__sub-make' failed make: *** [__sub-make] Error 2 Command failed. This is because that the KERNEL_LD variable already set in kernel-arch.bbclass isn't used by do_menuconfig function of cml1.bbclass. To fix this issue specify LD variable while calling the kernel menuconfig command through KERNEL_KCONFIG_COMMAND. Signed-off-by: Wonmin Jung <wonmin82@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1faf66ce0b1f8f5165277161e07e25e672370c3f) Signed-off-by: Steve Sakoman <steve@sakoman.com>