summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
AgeCommit message (Collapse)Author
2022-08-12classes: Update classes to match new bitbake class scope functionalityRichard Purdie
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. (From OE-Core rev: 081a391fe09a21265881e39a2a496e4e10b4f80b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. (From OE-Core rev: 880c1ea3edc8edef974e65b2d424fc36809ea034) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-04utils: create_cmdline_shebang_wrapper preserve permission and ownershipPaulo Neves
The .real command was not given the same permissions and ownership as the original pre-wrap file and this is now fixed. A situation where the original pre-wrap file did not have write permissions would cause a failure in the wrapping is also fixed. Test update also included. (From OE-Core rev: 47973fd4f3fbb0af1a0d1bc2c39f2900a963177d) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-04utils: create_cmdline_shebang_wrapper whitespace and sed refactorPaulo Neves
Correct whitespace to match the rest of the code in utils. Refactored sed expression with a simpler equivalent. (From OE-Core rev: 68f49af704a4e808ad274d689e884923776edfec) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-01utils: Add cmdline_shebang_wrapper util.Paulo Neves
Useful to work around shebang relocation issues, where shebangs are too long or have arguments in them, thus preventing them from using the /usr/bin/env shebang. (From OE-Core rev: 6edc1fffcbe1405d8c309a75643d7d6cd9a92848) Signed-off-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-07utils: Drop obsolete oe_machinstall functionRichard Purdie
This function does something similar to the bitbake fetcher file search paths and is an old remnant of how this could have once been handled. There are no users in OE-Core and we'd always prefer the fetcher to handle this now as it handles signatures correctly. The direct OVERRIDES reference would likely break any user of the function. Remove it to be safe and ensure it isn't being used anywhere. (From OE-Core rev: d49ba0243e3d28672d16cd02753eb7e85d91bbab) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-07utils: Drop unused variable staging_install from oe_libinstallRichard Purdie
Remove unused variable/code. (From OE-Core rev: 76ade5a2a55eda2975dfa5d6a30ac4cb74421567) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-22utils: Reduce the number of calls to the "dirname" commandOleksandr Popovych
utils.bbclass contains create_cmdline_wrapper() function that creates wrapper script with additional arguments for any passed "$cmd" command, and uses several calls to "dirname". Because "dirname" is an external command, in cases of lots of calls to wrapped "$cmd", each call of "dirname" will incur significant overhead. There are three same calls to "dirname": one for saving it`s output to "realdir" variable, and other two in "exec" command. So last two "dirname" calls can be replaced with cached value from "realdir" variable. (From OE-Core rev: 4b9cf2c80fd14386e0b88a2e6c40a9fa3f1ae0f7) Signed-off-by: Oleksandr Popovych <opopovyc@cisco.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-05-05utils: Drop is_machine_specific()/machine_paths()Richard Purdie
There appear to be no users of these in OE-Core and their functionality is questionable at best too. Probably safest to remove them entirely at this point. (From OE-Core rev: 03c5cfd7611c88ce82d16619a49e3ea9fa7385d8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-05-05utils: Drop FILESPATHPKG usageRichard Purdie
Nothing in OE-Core uses this and its been deprecated for some time. Remove the last reference to it. (From OE-Core rev: 5b27c2f58fa45a55199c08ef219e3b41a09d2fe4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-06utils: Fix create_wrapperAchille Fouilleul
Wrappers generated by create_wrapper do not work properly: python, for example, looks at argv[0] to know if it is running from a virtualenv. Because the wrapper replaces argv[0] with python's canonical path, python cannot tell whether it has been invoked directly or from a virtualenv symlink. This change makes the wrapper pass the original argv[0] down to the real command. (From OE-Core rev: 791e5bfcb449024f295a4f8f507c1012cff76f9d) Signed-off-by: Achille Fouilleul <achille.fouilleul@gadz.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-24utils.bbclass: fix KeyError exceptionChen Qi
The following statement was accidently removed. Add it back. values['ml'] = [''] This patch fixes the following error. Exception: KeyError: 'ml' (From OE-Core rev: 0791c4d39edbedaa493a9fc6aa6e7415f14980bb) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23utils: Fix patch merging errorRichard Purdie
The previous patch has duplicate split calls and one needs to be removed to avoid failures (From OE-Core rev: 02c8d048cbab38a48f698504d0f5e912d3d24a36) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23utils: Rely on get_multilib_datastore() to get the original datastoreRichard Purdie
get_multilib_datastore() should be able to handle the original datastore correctly now so rely upon this rather than custom coding. (From OE-Core rev: 2ae85af480066e252fca01f3005ecac2ff37a8d4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-02classes/utils: Improve all_multilib_tune_valuesRichard Purdie
Currently there is duplication in the code, we can clean this up by extending the multilib variants list. This code also currently fails its its called from an existing multilib context since its assumes the data store passed in is the non-multilib case. When building an image, say lib32-core-image-sato, this leads to incorrect PATH values. To fix this, we also request a data store for the "" variant allowing this corner case to be fixed and for the function to correctly return values for each multilib even when a multilib is already selected. (From OE-Core rev: cc1c481560b81c223170230430308c7e2f08c812) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-02staging/image: Fix multilib recipe sysroot issuesRichard Purdie
Currently if you enable multilib, then build an image, the multilib recipe sysroot is build in the wrong WORKDIR. If you then clean and rebuild the image you see "file exists" errors. This patch ensures the real WORKDIR is used consistently and then cleans/rebuilds also work correctly. (From OE-Core rev: c013ae59a158378d06ecf8eb123df0a10bf986b4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-30classes/utils: remove compatibility functionsRoss Burton
These base_* functions were moved into meta/lib/oe back in 2010 and wrappers left in utils.bbclass for compatibility. It's been eight years, so I think it's time to remove them. (From OE-Core rev: 0391fcad9103abca0796a068f957d0df63ab4776) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-04utils: Make get_multilib_datastore available from lib/oeRichard Purdie
Currently we can't access this function from lib/oe as its a class function. Move it to allow such access. (From OE-Core rev: b241a666f2867ffa425f6d43763d7c3c17941dcf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-10-07utils.bbclass: Support applications with arguments in check_app_exist()Nikolay Merinov
check_app_exist function must support cases when "app" variable defined as "progname --args". For example BUILD_CC="gcc -march=x86-64" must pass sanity check. (From OE-Core rev: 5193ebca0ca8864404fc750def0e738417d104c7) Signed-off-by: Nikolay Merinov <n.merinov@inango-systems.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14utils: Exclude OVERRIDES from hashes in multilib functionsRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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. (From OE-Core rev: 8de0c5d3bd01919e2bf0394f9c485936d6098cec) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31utils: Avoid need to relocate wrapper scriptsRichard Purdie
Whilst the path to the executable is dynamically determined, the passed in environment variables or parameters are not relocatable and rely on the sstate remapping code. In the recipe specific sysroot case this has become more costly. This patch translates such paths into relocatable entries which means that a sed replacement at final installation isn't needed. (From OE-Core rev: 3e02a7cda0ba70e3f9886c5cce37d71361280b11) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-22utils: Factor out common multilib datastore creation functionRichard Purdie
This code is already used in two places and we need it in others so turn it into its own function. (From OE-Core rev: 2a57e1334ff261a7ab45084be0f217e2acfe99af) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09meta/scripts: Various getVar/getVarFlag expansion parameter fixesRichard Purdie
There were a few straggling expansion parameter removals left for getVar/getVarFlag where the odd whitespace meant they were missed on previous passes. There were also some plain broken ussages such as: d.getVar('ALTERNATIVE_TARGET', old_name, True) path = d.getVar('PATH', d, True) d.getVar('IMAGE_ROOTFS', 'True') which I've corrected (they happend to work by luck). (From OE-Core rev: 688f7a64917a5ce5cbe12f8e5da4d47e265d240f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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\) (From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-07utils.bbclass: add function to check for git config userStephano Cetola
If attempting to patch a git repo without a proper git config setup, an error will occur saying user.name/user.email are needed by git am/apply. After some code was removed from kernel-yocto, it was simple enough to reproduce this error by creating a kernel patch and using a container to build. This patch abstracts out functionality that existed in buildhistory for use in other classes. It also adds a call to this functionality to the kernel-yocto class. Fixes [YOCTO #10346] introduced in OE-core revision 0f698dfd1c8bbc0d53ae7977e26685a7a3df52a3 (From OE-Core rev: 25b43cb05c645e43f96bc18906441b8fdc272228) Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-28utils: Add all_multilib_tune_list functionRichard Purdie
Its useful to be able to query a list of variables to obtain the values in each multilib context. This adds such a function which works even if called in the non-default recipe context. (From OE-Core rev: 4202a09dece07c0d3f654c2b1ae504a031b4ee90) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-09utils.bbclass: Added error checking for oe_soinstallHenry Bruce
Fixes [YOCTO #10146] (From OE-Core rev: cd5d532bd2a3f409b9470591c8d6f6b21e5995dd) Signed-off-by: Henry Bruce <henry.bruce@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-09utils.bbclass: Remove trailing whitespaceHenry Bruce
(From OE-Core rev: 1868db95819b45961cd7e8499ecace403e6bc91d) Signed-off-by: Henry Bruce <henry.bruce@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-25utils: check_app_exists: strip whitespace from binary when searchingRoss Burton
It's possible that the binary to be searched for contains whitespace which will cause the search to fail, so strip any whitespace before looking. (From OE-Core rev: 9e920abdb0f3dcfd1a94a90461ec1ddfb2729d83) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-29utils.bbclass: note for deprecated base_containsRobert Yang
(From OE-Core rev: 1a0e56630c5c27d8899dd0979ae0b86bbe227881) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-01utils: Handle MLPREFIX in all_multilib_tune_values()Richard Purdie
MLPREFIX wasn't being set by the function correctly since its not an overridden value but directly set. Handle this variable explicitly so the function returns the expected values. (From OE-Core rev: 99997043d4106cb8a93a5f4512f1ef6f063a1895) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-17utils.bbclass: fix create_cmdline_wrapperJavier Viguera
Similar to commit 4569d74 for create_wrapper function, this commit fixes hardcoded absolute build paths in create_cmdline_wrapper. Otherwise we end up with incorrect paths in users of this function. For example the 'file' wrapper in current released toolchain: exec -a /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-fsl-arm/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-file/5.18-r0/image//opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/bin/file `dirname $realpath`/file.real --magic-file /opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc "$@" (From OE-Core rev: 49ab89eb9f83388e99069a4b53bdc4cba22bb6f3) Signed-off-by: Javier Viguera <javier.viguera@digi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25insane: add checking to standardize how .bbappend files do FILESEXTRAPATHSHongxu Jia
When adding patches or config files from bbappend files, it requires the use of FILESEXTRAPATHS, which has been an issue and failure point for people starting to work with bitbake and oe-core. We add checking to standardize how to use FILESEXTRAPATHS. Only the format of: FILESEXTRAPATHS_append := ":${THISDIR}/Your_Files_Path" or FILESEXTRAPATHS_prepend := "${THISDIR}/Your_Files_Path:" is acceptable. [YOCTO #5412] (From OE-Core rev: 69e083237e632f7d84a7b218dd12d1a5ad95a229) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-25Globally replace oe.utils.contains to bb.utils.containsOtavio Salvador
BitBake has the exact same code as oe.utils.contains so there's no reason to duplicate it. We now rely on the bb.utils.contains code for metadata. (From OE-Core rev: 93499ebc46547f5bf6dcecd5a786ead9f726de28) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-25utils: Add hardlinkdir shell functionRichard Purdie
In a number of places it would be helpful to be able to copy trees of files using hardlinks. This turns out to be harder than you'd expect since there is no good single command that does this well and handles all file types correctly. Abstracting this into a function therefore makes sense, cpio seems as good an option as any other. (From OE-Core rev: 14ef03182e1e5fe7cf6b4112f29e6609631aa78d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-14utils.bbclass: Fix override ordering for FILESPATHRichard Purdie
Currently the overrides are being applied backwards. This means something which is platform specific is overriding something which is machine specific which is clearly not intended. This patch corrects the ordering to match the normal expected behaviour of OVERRIDES. Secondly, all overrides are being searched for each path in turn. What should really happen is that we should look for the highest priority override (e.g. distro or machine) in each layer, then move on to platform/tune (e.g. armv7a) and then to arch (e.g. arm). This patch therefore also reverses the for loops to achieve this behaviour and give the result the user would expect. (From OE-Core rev: 92cbf7eeea553bfa24c7081473fa8bc4ebc1f552) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-17utils: Update bb.which reference and other syntax cleanupRichard Purdie
* bb.which -> bb.utiis.which() * Use modern form of datastore access * Use True, not 1 * Drop pointless imports (From OE-Core rev: 106a4f5b41e5bdeabe588b9ba362f3693b1a9989) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-18utils.bbclass: Tweak create_wrapperRichard Purdie
Currently the full path is specified to exec however this may incorporate a build path which in the nativesdk case, is not transformed to a target system path. This leads to failures due to incorrect paths. This patch ensures the full build path is not encoded into the wrapper script. (From OE-Core rev: 4569d7403638e4c1f637e3a6adb8dea620dc8543) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-30utils.bbclass: ensure $0 is correct in wrapper scriptsRoss Burton
Some packages (eg mesa) will invoke a tool with --version and do string matches on the output (i.e. mesa does $LEX --version |grep "^flex "). This doesn't work with the combination of wrapper scripts and binaries that use $0 as they output "flex.real". Luckily bash's exec lets you set $0. As we want to use this we can't use env, but using export appears to work just as well. (From OE-Core rev: e8d2a2a3646f964ec61ece62e14788cd7184dd01) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-11bitbake.conf/utils: Drop some OVERRIDES from FILESPATHRichard Purdie
There are several overrides that don't make sense as part of FILESPATH. This introduces FILESOVERRIDES and allows us to drop some of the pointless ones, simplifying the files search path further and improving the user experience. If needed by specific recipes, other overrides can be added back in for specific cases. (From OE-Core rev: b8b1b39961332c99d62ee466f7859bd62a0f806f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-21utils: Optimise looping in base_set_filespathRichard Purdie
Calling split on the same expression, once per loop iteration is inefficent and pointless, particularly in a function called by every recipe during parsing. (From OE-Core rev: 566c0e874fc1610f3f97737b5601ef22026c918a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-14utils.bbclass: Fix documentation of create_cmdline_wrapperRichard Purdie
(From OE-Core rev: 56160ca49dd546b7db07ae2021eefef7279b0f10) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-21meta/classes: Various python whitespace fixesRichard Purdie
It was pointed out we have a number of weird indentations in the python functions. This patch cleans up 3, 7 and other weird indentations for the core bbclass files. It also fixes some wierd (odd) shell function indentation which my searches picked up. (From OE-Core rev: 8385d6d74624000d68814f4e3266d47bc8885942) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-19Convert tab indentation in python functions into four-spaceRichard Purdie
(From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-09utils.bbclass: add helper function to add all multilib variants of a ↵Richard Purdie
specific package This is useful for the scenario where we want to add 'gcc' to the root file system for all multilib variants (From OE-Core rev: 7cd54693363882854cd026ebe071e9f2e03d364e) Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-25utils.bbclass: remove the unused oe_systemRobert Yang
The following functions in meta/classes/utils.bbclass were not used by anyone, and they didn't work when I tried to use them: def oe_popen_env(d): def oe_run(d, cmd, **kwargs): def oe_popen(d, cmd, **kwargs): def oe_system(d, cmd, **kwargs): There error was: AttributeError: type object 'str' has no attribute 'getVar' We have bitbake/lib/bb/process.py to instead, so remove them. [YOCTO #2489] (From OE-Core rev: 15ad62ab1be060d8a7cdc2d28167ea3af4cfd5d5) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-26utils.bbclass: Testing via env in create_wrapper is a nice idea but breaks ↵Richard Purdie
things For example, pseudo-native wants to set LD_LIBRBARY_PATH but setting this into the environment here causes the existing pseudo (running during do_install) to poke into paths in /opt and this breaks builds. The simplest fix is simply not to do this. Comments tweaks to match the code. (From OE-Core rev: 1efa999ed02186c9c58cb48418e0c62ecdc82ac7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-05meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)Richard Purdie
Using "1" with getVar is bad coding style and "True" is preferred. This patch is a sed over the meta directory of the form: sed \ -e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \ -e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \ -i `grep -ril getVar *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>