summaryrefslogtreecommitdiffstats
path: root/meta/classes/license.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. 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. 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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-06-06license.bbclass: Bound beginline and endline in copy_license_files()Peter Kjellerstedt
Ensure that begin_idx (i.e., beginline - 1) and end_idx (i.e., endline) are positive numbers in copy_license_files(). This makes sure the same lines are copied as populate_lic_qa_checksum() uses when it calculates the checksum. Before, beginline=0 would typically lead to that no lines were copied at all. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-24license.bbclass: Remove the available_licenses() functionPeter Kjellerstedt
It is no longer used in OE-Core. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-03-16license: Drop AVAILABLE_LICENSESRichard Purdie
This variable is a performance liability and is highly dependent on which layers are added to the configuration which can cause signature issues for users. We have no users left in OE-Coreso remove it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-07license: expand_wildcard_licenses: add AGPL-3.0* wildcardChristian Eggers
The Yocto reference manual suggests also settings AGPL-3.0 in INCOMPATIBLE_LICENSE. https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-INCOMPATIBLE_LICENSE Fixes: 724fc8047cae ("license: Rework INCOMPATIBLE_LICENSE wildcard handling") Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-02license: Rework INCOMPATIBLE_LICENSE wildcard handlingRichard Purdie
The current wildcard handling is badly documented and inconsistently used and understood. Forcing users to have to use "GPL-3.0-only GPL-3.0-or-later" whilst explict is not very user friendly. Equally, using the current wildcards is ambigious. This supports pre-defined expansions only and at least makes it clear what GPL-3.0* means (it doesn't include the exception licenses). This is hopefully an acceptable compromise between literal meaning and having something usable. Non-SPDX forms of license in this field have been dropped and errors are shown for unsupported expansions and unsupported old style license terms. Users need to carefully consider how to migrate to the new syntax but the meaning should be well defined and clear from here forward. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-01meta, meta-selftest: Replace more non-SPDX license identifiersPeter Kjellerstedt
In commit ceda3238 (meta/meta-selftest/meta-skeleton: Update LICENSE variable to use SPDX license identifiers) all LICENSE variables were updated to only use SPDX license identifiers. This does the same for comments and other variables where it is appropriate to use the official SPDX license identifiers. There are still references to, e.g., "GPLv3", but they are then typically in descriptive text where they refer to the license in a generic sense. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-21meta: Further LICENSE_FLAGS variable updatesSaul Wold
Add further tweaks to comments and variable names for license variable change. Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-21meta: Rename LICENSE_FLAGS variableSaul Wold
Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-17insane,license,license_image: Allow treating license problems as errorsMike Crowe
Use the same WARN_WA and ERROR_QA variables as insane.bbclass to allow individual recipes, the distro or other configuration to determine whether the various detected license errors should be treated as a warning (as now) or as an error. oe.qa.handle_error isn't immediately fatal, so oe.qa.exit_if_errors must be called at the end of do_populate_lic to fail the task. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-14license.bbclass: implement ast.NodeVisitor.visit_ConstantRoss Burton
Since Python 3.8 visit_Num(), visit_Str() and so on are all deprecated and replaced with visit_Constant. We can't yet remove the deprecated functions until we require 3.8, but we can implement visit_Constant to silence the deprecation warnings. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-04license: Exclude COPYING.MIT from pseudoRichard Purdie
Along with the other license exclusions, we need to exclude the top level COPYING.MIT file else when: COPY_LIC_DIRS = "1" COPY_LIC_MANIFEST = "1" is set, we see eSDK failures from a pseudo abort. [YOCTO #14366] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30Convert to new override syntaxRichard Purdie
This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-08license: Drop adding RRECOMMENDS for license packagesRichard Purdie
This changes behaviour when LICENSE_CREATE_PACKAGE is in use. Packages no longer have RRECOMMENDS adding to them. It was highlighted that this doesn't apply to PACKAGES_DYNAMIC, nor can it easily be made to do so. There is also a much easier way to handle this which is: IMAGE_INSTALL_COMPLEMENTARY += "*-lic" which works on a per image basis and doesn't change the underlying package dependencies. I propose we switch to this instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-14license.bbclass: Improve parsing time when INCOMPATIBLE_LICENSES is bigPeter Kjellerstedt
The commit 08cbf1748 (licenses: Update INCOMPATIBLE_LICENSE for 'or-later' handling) increased the parsing time considerably if there are many licenses in INCOMPATIBLE_LICENSE. Reorganize the code to get almost all the time back. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-21licenses: Update INCOMPATIBLE_LICENSE for 'or-later' handlingRichard Purdie
Where a user adds "GPLv3" to INCOMPATIBLE_LICENSE they almost certainly mean both GPLv3-only and GPLv3-or-later. Update the code to handle this correctly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-21licenses: Fix canonical license for 'or-later' handlingRichard Purdie
GPLv2 and GPLv2+ are two difference licenses with different meanings and we can't just pretend they're the same thing. Change the code to treat them separately. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-12-24license.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>
2019-12-16license.bbclass: Make incompatible_pkg_license return incompatible licsPeter Kjellerstedt
This makes it possible to report the incompatible licenses. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-16license.bbclass: Introduce AVAILABLE_LICENSES that lists all licensesPeter Kjellerstedt
Previously, there was SRC_DISTRIBUTE_LICENSES, an undocumented variable that contained a static list of licenses. It was used by expand_wildcard_licenses() to expand any wildcards used in, e.g., INCOMPATIBLE_LICENSE. However, since this static list of licenses has not been kept up-to-date, many licenses were missing, with the result that if one tried to use any of those licenses with a wildcard, no licenses would be found, effectively ignoring that they should be marked as incompatible. This introduces a new (documented) variable, AVAILABLE_LICENSES, that is automatically updated to contain all licenses found in any directories specified by ${COMMON_LICENSE_DIR} and ${LICENSE_PATH}, and uses it instead of SRC_DISTRIBUTE_LICENSES when expanding wildcards. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-10-10license.bbclass: split incompatible license check into a helper functionAlexander Kanavin
This would help with checking incompatible licenses at do_rootfs step in image creation, where it is beneficial to pass the license string directly to the function. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-11meta: license: fix non-SPDX license being removed from INCOMPATIBLE_LICENSEQuentin Schulz
A non-SPDX license (which is not an alias to an SPDX license) cannot currently be marked as incompatible in INCOMPATIBLE_LICENSE. In the current state, we take all INCOMPATIBLE_LICENSE and pass them through expand_wildcard_licenses which is only adding SPDX licenses that match the glob regexp of what is in INCOMPATIBLE_LICENSE (be it a direct match to an SPDX license or via an alias). This does not work well with custom licenses. E.g.: foo.bb: LICENSE = "FooLicense" conf/local.conf: INCOMPATIBLE_LICENSE = "FooLicense" `bitbake foo` Gives no warning, no error, builds and packages successfully, because INCOMPATIBLE_LICENSE is basically empty since FooLicense is neither in SPDXLICENSEMAP nor in SRC_DISTRIBUTE_LICENSES. Let's add the original licenses to the list returned by expand_wildcard_licenses to be able to handle the aforementioned case. INCOMPATIBLE_LICENSE = "FooLicense GPLv2 GPLv3+" used to "resolve" to "GPLv2 GPLv3". It now resolves to "FooLicense GPLv2 GPLv3 GPLv3+" which fixes the issue with custom licenses not being in SPDXLICENSEMAP or SRC_DISTRIBUTE_LICENSES and thus being left out of the blacklisted licenses. I needed to pass a list to expand_wildcard_licenses from the license_image class instead of the current output of map() because the operator [:] does not work on this kind of type, and list(map()) or anything that iterates over map() actually moves the iterator and breaks the forloop right after in expand_wildcard_licenses. Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-23classes: Remove tab indentations in python codeRobert Yang
Use 4 spaces to replace a tab. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-13base.bbclass: Display name of licenses which caused SkipRecipeNathan Rossi
Display the name of the restricted licenses which caused the recipe to be skipped. This makes it easy to determine which license or licenses are missing and need to be checked and whitelisted. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-14classes: sanity-check LIC_FILES_CHKSUMRoss Burton
We assume that LIC_FILES_CHKSUM is a file: URI but don't actually verify this, which can lead to problems if you have a URI that resolves to a path of / as Bitbake will then dutifully checksum / recursively. [ YOCTO #12883 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-25license: Split image license functions to a separate classRichard Purdie
This means the image code is only included in image recipes through the IMAGE_CLASSES variable. This sets things up to allow us to fix image deploy dependency problems. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-02license: Fix and extend recommendations for license packages.Alp Özmert
Changed package recommendations so that the license package of a recipe is recommended for all packages of a recipe instead of for one package given by the recipe name. Pre-patch behaviour results in a missing recommendation when a recipe does not have a package with the same name. Signed-off-by: Alp Özmert <info@ib-oezmert.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-09license.bbclass: be a bit more strict when searching ↵uninative-1.9Martin Jansa
${PN}-${LICENSE_PACKAGE_SUFFIX} in packages * linux-firmware contains ${PN}-license package since this commit: commit 1ee083da0730408fffdbbf5f29abc299c0e61be9 Author: Jackie Huang <jackie.huang@windriver.com> Date: Mon Apr 13 10:17:21 2015 +0800 linux-firmware: fix the mess of licenses * LICENSE_CREATE_PACKAGE functionality in license.bbclass when enabled adds new package with suffix: LICENSE_PACKAGE_SUFFIX ??= "-lic" but then it checks if ${PN}-${LICENSE_PACKAGE_SUFFIX} is included in PACKAGES before adding it and when found it shows: WARNING: linux-firmware-1_0.0+gitAUTOINC+4c0bf113a5-r0 do_package: linux-firmware-lic package already existed in linux-firmware. and doesn't add the ${PN}-lic to PACKAGES and causes another warning: WARNING: linux-firmware-1_0.0+gitAUTOINC+4c0bf113a5-r0 do_package: QA Issue: linux-firmware: Files/directories were installed but not shipped in any package: /usr /usr/share /usr/share/licenses /usr/share/licenses/linux-firmware that's because it was searching ${PN}-lic in PACKAGES as a string so it found ${PN}-lic as a substring of ${PN}-license, add a split to search in an list Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-07license.bbclass: Minor simplification of get_deployed_dependencies()Peter Kjellerstedt
Since ${SSTATE_ARCHS} now contains ${PACKAGE_EXTRA_ARCHS} there is no longer any need to add those extra architectures to the list of architectures handled in get_deployed_dependencies(). Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31classes/license: drop erroneous sha256 parameter in LIC_FILES_CHKSUMPaul Eggleton
In OE-Core commit a48fea275b08ff3d3dfc9a928aeb04768db35873, a check on the value of a "sha256" parameter was added, however there was no mention of this in the commit message and no corresponding code to actually verify the checksum as sha256 was added along with it either, so there's no point in getting the value. Additionally it was assuming that a sha256 value would be present without checking first, with the result that if you leave out the md5 value in a recipe intentionally in order to get it to tell you the correct value on the next build, you got a traceback instead of the appropriate error containing the information. Drop this entirely - if we want to implement this we need to do it properly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-03meta: drop do_bootdirectdisk do_vmimg referencesMing Liu
do_bootdirectdisk and do_vmimg had been dropped by commit 929ba563: [ image: Convert vmdk/vdi/qcow2 to strict CONVERSION_CMD types ] Also drop the references to them and image-vm. Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-08license.bbclass: improve reproducibilityJuro Bystricky
Two identical builds can end up having deploy/licenses folders that differ. This is observed in cases where there are several different license files of the same name in different folders, i.e. "COPYING". In those case we have to differentiate the files somehow and we do it via file expensions such as COPYING.0, COPYING.1. However, which file will get which extension is presently random. This means, for example, that COPYING.0 in one build is the same as COPYING.1 in the other (and vice versa). Although there is mothing wrong with this, for the sake of binary reproducibility it is preferable to have a deterministic outcome. Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-10license: don't assume source files are UTF-8Ross Burton
We can't assume that source files are entirely UTF-8, so when copying the license blocks open the file as binary instead of text. [ YOCTO #11135 ] Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-01license.bbclass: run chown only under pseudoMarkus Lehtonen
The copy_license_files() function in license.bbclass is called in two different contexts. First, it is run as part of the do_populate_lic task. In addition, it is called from do_package task when LICENSE_CREATE_PACKAGE is enabled. The function has code that changes the owner of license files to root which is meant only to happend in the latter case - i.e. under do_package which is run under pseudo. Previously, the code was blindly always running chown and just ignored errors that happened when running from do_populate_lic. This patch changes it to be more intelligent, only doing chown when running under pseudo. [YOCTO #10897] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-01classes/license.bbclass: Don't copy unneeded licenses by packageAníbal Limón
Usually a recipe only provides one package but when provides more than one package the LICENSE variable per package (i.e. linux-firmware) needs to take into account to avoid unnecesary copy of licenses into packages. The patch validates if LICENSE exists in package LICENSES in order to don't copy unneeded licenses. As result of this patch some packages will not contain licenses there are not into LICENSE variable. For example: acl contains GPLv2+ instead of GPLv2+ and LGPLv2.1+ libacl contains LGPLv2+ instead of GPLv2+ and LGPLv2.1+ This behaviour is declared on the acl recipe as: SUMMARY = "Utilities for managing POSIX Access Control Lists" HOMEPAGE = "http://savannah.nongnu.org/projects/acl/" SECTION = "libs" LICENSE = "LGPLv2.1+ & GPLv2+" LICENSE_${PN} = "GPLv2+" LICENSE_lib${BPN} = "LGPLv2.1+" [YOCTO #10325] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-01license.bbclass: Don't copy again LICENSE already handled as no-genericAníbal Limón
The NO_GENERIC_LICENSE mapping was added [1] to enable copy LICENSES from upstream source code into recipe licenses, previously that only common-licenses was processed. This result on copy twice the NO_GENERIC_LICENSE specified because there is a mapping between license in LIC_CHKSUM and NO_GENERIC_LICENSE. In order to avoid double copy one as generic_ and other as LICENSE. keep track of licenses already copied. For linux-firmware the result will be only generic_ licenses into common-licenses. [YOCTO #10325] [1] http://lists.openembedded.org/pipermail/openembedded-core/2015-April/104222.html Signed-off-by: Aníbal Limón <anibal.limon@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/license: Respect beginline and endlineJoshua Watt
Recipes have the option of specifying a 'beginline' and 'endline' options in LIC_FILES_CHKSUM which will cause the license bbclass to only extract those specific lines from the license file when generating the license database. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-06meta/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). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-06classes/license: copy licenses even if there are no checksummed filesRoss Burton
Previously do_populate_lic would bail writing the license files (such as the MIT license text) to deploy/licenses/${PN}/ if there were no files listed in LIC_FILES_CHKSUM. In general this isn't a problem since LIC_FILES_CHKSUM was effectively a required field, and for packages which don't have traditional content was generally set to a separate license such as ${COREBASE}/meta/COPYING.MIT. However LIC_FILES_CHKSUM is now only required if there are sources in SRC_URI, so oe-core b18fa5f removed these now redundant values. The unexpected side effect of this is that that recipes that generate their content (such as os-release) or are otherwise "interesting" (such as perf) don't have their license files copied over, resulting in warnings from do_rootfs. Resolve this by not returning early if LIC_FILES_CHKSUM is empty, and always copy the references license files. Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-11-06classes/license: fix handling of symlinks pointed to in LIC_FILES_CHKSUMPaul Eggleton
If you set LIC_FILES_CHKSUM to point to a relative symlink then you'll get "Could not copy license file" warnings in copy_license_files() since the symlink won't be valid after it's copied. If the source is a symlink then we need to dereference it first. I encountered this when I used recipetool on the sources for capnproto, where the c++ directory contains a LICENSE.txt symlink to the LICENSE file in the parent directory, and this symlink ends up being pointed to in LIC_FILES_CHKSUM. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-10-03license.bbclass: Use bb.fatal() instead of raising FuncFailedUlf Magnusson
This sets a good example and avoids unnecessarily contributing to perceived complexity and cargo culting. Motivating quote below: < kergoth> the *original* intent was for the function/task to error via whatever appropriate means, bb.fatal, whatever, and funcfailed was what you'd catch if you were calling exec_func/exec_task. that is, it's what those functions raise, not what metadata functions should be raising < kergoth> it didn't end up being used that way < kergoth> but there's really never a reason to raise it yourself FuncFailed.__init__ takes a 'name' argument rather than a 'msg' argument, which also shows that the original purpose got lost. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-25license.bbclass: do not process LICENSE_pn variablesMarkus Lehtonen
The loop iterating over LICENSE_pn variables has never worked. In addition, the LICENSE variable is supposed to contain all licenses defined in LICENSE_pn variables. Thus, it is simpler just to use LICENSE as the data we get is essentially the same. [YOCTO #9499] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-08-10license: improve handling of license files with identical basenamesMarkus Lehtonen
Previously, find_license_files() in license.bbclass just blindly assumed that all different licenses specified in LIC_FILES_CHKSUM have unique filenames. As a consequence, only the last one of these similarly named license files was copied and the rest were "lost". This patch changes the behavior so that all license files get copied. However, if multiple identically named files are found, they are renamed to <file>.0, <file>.1 etc. The patch also changes the handling of NO_GENERIC_LICENSE slightly. Previously, only basenames of NO_GENERIC_LICENSE and LIC_FILES_CHKSUM were compared when searching for the correct license file. After this patch NO_GENERIC_LICENSE must have the full path, matching what is specified in LIC_FILES_CHKSUM. This is required in order to be able to handle identical filenames (basenames) consistently. For example, if you have: LICENSE = "my-custom-license" LIC_FILES_CHKSUM = "file://src/LICENCE;md5=d41d8cd98f00b204e9800998ecf8427e" you must specify: NO_GENERIC_LICENSE[my-custom-license] = "src/LICENCE" [YOCTO #9663] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-07-20classes/license.bbclass: don't set [dirs] and [cleandirs]Ross Burton
There's no need to set these as the restore from sstate will create the directories as required. Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-15classes/license: handle EXDEV if hard link to license failsManuel Huber
Hard links can still fail even if st_dev is the same for source and destination. In case of EXDEV error, fall back to copying. Signed-off-by: Manuel Huber <manuel.h87@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>