summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package.py
AgeCommit message (Collapse)Author
2022-01-13package: Add support for kernel strippingSaul Wold
Extend runstrip() to accept additional argument to enable sharing it with the kernel do_strip() so that KERNEL_IMAGE_STRIP_EXTRA_SECTIONS can be passed. Since is_elf() understands kernel modules there is no need to keep a seperate list for kernmodules or hardcode the values to runstrip. Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-27lib/oe/package: remove unneeded npm_split_package_dirs functionJean-Marie LEMETAYER
The npm_split_package_dirs function was used by the recipetool when creating npm recipes. This is not the case anymore. Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-26package: Improve determinismRichard Purdie
Its possible in cases with multiple shlib providers we were not being deterministic. Add in a couple of sorted() calls to fix the shlibs and pkgconfig cases with this potential issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-14meta: Fix Deprecated warnings from regexsRichard Purdie
Fix handling of escape characters in regexs and hence fix python Deprecation warnings which will be problematic in python 3.8. Note that some show up as: """ meta/classes/package.bbclass:1293: DeprecationWarning: invalid escape sequence \.   """ where the problem isn't on 1293 in package.bbclass but in some _prepend to a package.bbclass function in a different file like mesa.inc, often from do_package_split() calls. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23lib/oe/package.py: use bb.utils.break_hardlinks helperRasmus Villemoes
This does the same thing, but is more efficient in case st_nlinks is (already) 1. Depends on bitbake commit 7ae93cf40ab91965147055100432961436bce46c . Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-09package: skip strip on signed kernel modulesfoocampo
Executing strip action on kernel modules removes the signature. Is not possible to strip and keep the signature, therefore avoid strip signed kernel modules. Signed-off-by: Omar Ocampo <omar.ocampo.coronado@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-24package/package_manager: multiprocess_exec -> multiprocess_launchRichard Purdie
After this replacement, the parent exception handling works so we don't need subprocess wrapping with bb.error in the underlying functions. The underlying contexts also have better module handling so the imports can be cleaned up. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-24package: Call file to determine elf status in parallelRichard Purdie
This allows the calls to is_elf (which calls file) to happen in parallel allowing a speedup of do_package and do_populate_sysroot for native recipes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-24package: Refactor to remove isElf/is_elf function duplicationRichard Purdie
There are probably further cleanups needed here but this at least removes the major code duplication between these two similar funcitons, keeping the kernel module ".ko" extension check for efficiency to avoid opening and reading file contents in the general case. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-24package: Don't use subshell to execute fileRichard Purdie
We don't need any functionality from the shell here, its just extra fork overhead. Therefore remove it and use subprocess directly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-19package.py: use single quotes for path passed to file in is_elf()Andre McCurdy
Align package.py is_elf() with recent changes in package.bbclass isELF(): http://git.openembedded.org/openembedded-core/commit/?id=7877761534b0c2492da6289e9f2269d41b6ed464 Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-04-18package.bbclass: Add '-b' option to file call in isELFMark Hatle
The isELF function works by running: result = file <pathname> if 'ELF' in result By default 'file' will prepend the result with the path name of the file that is being checked. This usually works fine, such as: $ file /home/foo/openembedded-core/meta/classes/package.bbclass /home/foo/openembedded-core/meta/classes/package.bbclass: Python script, ASCII text executable, with very long lines However, if the path includes 'ELF', ELF will end up in the result, and then the check will return positive. $ file /home/ELF/openembedded-core/meta/classes/package.bbclass /home/ELF/openembedded-core/meta/classes/package.bbclass: Python script, ASCII text executable, with very long lines This will then result in the isELF coming back true, and possibly causing the checks that use isELF, such as the 'is it already stripped' check, to do the incorrect thing. Adding the '-b' option to file will result in the path being omitted in the result: $ file /home/ELF/openembedded-core/meta/classes/package.bbclass Python script, ASCII text executable, with very long lines Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-01lib/oe/package: Improve filedeprunner subprocess handlingRichard Purdie
Currently the exit code of the spawned program isn't checked so it can fail and the do_package task will continue merrily upon its way. Use subprocess.check_output() to ensure we check the exit code and redirect stderr to stdout so if it fails, we see the error output. We can then drop the existing exception handling as the subprocess exception gives a much better error. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27package.py: strip_execs: Support for .ko modulesTobias Hagelborn
* Support stripping of .ko modules verifying file extension and check of content "vermagic=" Signed-off-by: Tobias Hagelborn <tobiasha@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27package.py: Fix some lint errorsTobias Hagelborn
- rename type to exec_type not to shadow type - rename isELF is_elf Signed-off-by: Tobias Hagelborn <tobiasha@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-16package.bbclass: Restore functionality to detect RPM dependenciesPeter Kjellerstedt
During the transition to dnf and rpm4, the functionality to automatically make RPM determine dependencies was lost. Before the transition, an OE specific tool called rpmdeps-oecore had been added to the rpm suit. It was based on the rpmdeps tool that is part of rpm. For each file specified on its command line, it would output the provides and requires that RPM could determine. During the transition to rpm4, rpmdeps-oecore was replaced with the standard rpmdeps. However, what no one noticed was that unless rpmdeps is given options, e.g., -P or -R, to tell it what it should output, it will not output anything. Thus, it would do all the work to determine the requirements, but would keep silent about it. And since no output from rpmdeps is expected unless there are requirements, there were no warnings indicating that everything was not working as expected. Porting the old rpmdeps-oecore to work with rpm4 is not really possible since it relied on being able to access internals of RPM that are no longer available. However, it turned out that rpmdeps had a debug option, --rpmfcdebug, that would output exactly the information that we need, albeit in a different format and to stderr. To make this usable, rpmdeps has now received a new option, --alldeps, which sends the information we need to stdout. (From OE-Core rev: 958501b3d9201aaabb81ec644c6049e0c9b737e7) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-28package.py: Add function strip_execsTobias Hagelborn
Strip all executables in a directory. Utility function placed in oe-package together with run_strip. strip_execs is based on strip_sysroot from staging.bbclass Moving out datastore references in favor of function parameters. Signed-off-by: Tobias Hagelborn <tobiasha@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-12Revert "package.bbclass: Restore functionality to detect RPM dependencies"Richard Purdie
This reverts commit aea90e9ee6f34e7c1c08307080b1e29646668df6. RP hadn't meant to merge this yet and its causing problems so delay it until its ready.
2017-06-12package.bbclass: Restore functionality to detect RPM dependenciesPeter Kjellerstedt
During the transition to dnf and rpm4, the functionality to automatically make RPM determine dependencies was lost. Before the transition, an OE specific tool called rpmdeps-oecore had been added to the rpm suit. It was based on the rpmdeps tool that is part of rpm. For each file specified on its command line, it would output the provides and requires that RPM could determine. During the transition to rpm4, rpmdeps-oecore was replaced with the standard rpmdeps. However, what no one noticed was that unless rpmdeps is given options, e.g., -P or -R, to tell it what it should output, it will not output anything. Thus, it would do all the work to determine the requirements, but would keep silent about it. And since no output from rpmdeps is expected unless there are requirements, there were no warnings indicating that everything was not working as expected. Porting the old rpmdeps-oecore to work with rpm4 is not really possible since it relied on being able to access internals of RPM that are no longer available. However, it turned out that rpmdeps had a debug option, --rpmfcdebug, that would output exactly the information that we need, albeit in a different format and to stderr. To make this usable, rpmdeps has now received a new option, --alldeps, which sends the information we need to stdout. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-14package: Fix various rpmdeps relocation issuesRichard Purdie
There are several issues with rpmdeps after the rpm v5 -> v4 transition: * _rpmfc_magic_path is an invalid option for rpm4 * --rpmpopt is an invalid option for rpm4 * we need to use the path to rpmrc since otherwise it poitns at the original build path * we need to set MAGIC in the environment so libmagic can find its files. This patch addresses those and ensures rpmdeps works in relocated builds from sstate (or with rm_work). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-04lib/oe/package.py: remove @ from package nameAnders Darander
@ isn't allowed in package names. Angular2 packages often have @ in their names. Signed-off-by: Anders Darander <anders@chargestorm.se> 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-12-08package_manager: remove strings and migrate to direct arraysStephano Cetola
When using subprocess call and check_output, it is better to use arrays rather than strings when possible to avoid whitespace and quoting problems. [ YOCTO #9342 ] Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20oe/lib/package: handle shlibs files disappearingRoss Burton
During a parallel build it's possible for unrelated shlib files to be removed if the recipe they came from is about to be rebuilt. They can't be involved in the dependency chains as otherwise they wouldn't be removed, so just silently handle files disappearing. [ YOCTO #8555 ] Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-02classes/lib: Complete transition to python3Richard Purdie
This patch contains all the other misc pieces of the transition to python3 which didn't make sense to be broken into individual patches. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02classes/lib: Update to use python3 command pipeline decodingRichard Purdie
In python3, strings are unicode by default. We need to encode/decode from command pipelines and other places where we interface with the real world using the correct locales. This patch updates various call sites to use the correct encoding/decodings. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06recipetool: create: fix picking up false npm package directoriesPaul Eggleton
It is possible for a Node.js module to have node_modules subdirectories that contain no package.json file (e.g. iotivity-node has such a directory). It appears these should simply be ignored, or else with the way the current code works we will get errors later. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-14npm.bbclass: Stop packagenames containing underscores from being generatedBrendan Le Foll
Package names cannot contain underscores yet some npm modules use them as part of the name, replace them with hyphens in the package name. Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-03-09recipetool: create: split npm module dependencies into packagesPaul Eggleton
Rather than rolling all of an npm module's dependencies into the same package, split them into one module per package, setting the SUMMARY and PKGV values from the package.json file for each package. Additionally, mark each package with the appropriate license using the license scanning we already do, falling back to the license stated in the package.json file for the module if unknown. All of this is mostly in aid of ensuring all modules and their licenses now show up in the manifests for the image. Additionally we set the main LICENSE value more concretely once we've calculated the per-package licenses, since we have more information at that point. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-29split_and_strip_files: regroup hardlinks to make build deterministicEd Bartosh
Reverted 7c0fd561bad0250a00cef63e3d787573112a59cf Created separate group of hardlinks for the files inside the same package. This should prevent stripped files to be populated outside of package directories. This turns out not to be straightforward and has overlap with the other hardlink handling code in this area. The code is condensed into a more concise and documented form. [Original patch from Ed with tweaks from RP] [YOCTO #7586] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-29lib/oe/package: Improve strip subprocess handlingRichard Purdie
Currently if the strip process fails, we get a message but don't know why. This adds code to show the return value and any error output. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-20meta/lib/oe/package.py: fix files ownership in packagesFabrice Coulon
This fix solves the problem with the ownership of files in packages. The do_install task was producing correct and expected output but when the files were being put in, e.g. a rpm package, the ownership could be different than that in the do_install task. [YOCTO #7428] Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Fabrice Coulon <fabrice.coulon@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-01-23lib/oe/package: Ensure strip breaks hardlinksRichard Purdie
Normally, strip preserves hardlinks which in the case of the way our hardlink rather than copy functionality works, is a disadvantage and leads to non-deterministic builds. This adds a move into place after the strip operation to ensure hardlinks are broken and we bring back build determinism. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com>
2014-12-21classes/package: move read_shlib_providers() to a common unitPaul Eggleton
This allows us to use this function elsewhere in the code. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-07package.py: use subprocess.Popen for rpmdeps callMartin Jansa
* I've noticed errors like this in log.do_package: DEBUG: Executing python function package_do_filedeps sh: 1: Syntax error: "(" unexpected sh: 1: Syntax error: "(" unexpected DEBUG: Python function package_do_filedeps finished which are actually caused by some filenames included in package containing '()' characters Maybe we should change meta/classes/package.bbclass to fail when some filedeprunner call fails like this and fix filedeprunner to escape '()' and other possibly dangerous chars it's called like this: processed = list(pool.imap(oe.package.filedeprunner, pkglist)) * don't use shell=True * show the command when it fails and let do_package task to fail Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-02-06package: Process package stripping in parallelRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06package.bbclass: Multithread per file dependency generation codeRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>