summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/license.py
AgeCommit message (Collapse)Author
2022-08-12lib: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also add license identifiers as MIT if there isn't one. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-02license/insane: Show warning for obsolete license usageRichard Purdie
We want to use SPDX identifiers in LICENSE variables. There is now a conversion script to make most of the translations. Add a list of strings which have been replaced so we can show warnings to users if they're still used anywhere. Add checks to the package as insane check. This is currently a warning by default but can be turned off or made an error as per the other standard checks. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-02base/license: Rework INCOMPATIBLE_LICENSE variable handlingSaul Wold
This re-writes the INCOMPATIBLE_LICENSE checking code to replace the WHITELIST_<lic> with INCOMPATIBLE_LICENSE_EXCEPTIONS = '<pkg>:<lic> <pkg>:<lic> ...' This initial change leaves most of the code structure in place, but the code in base.bbclass needs to be re-written to make the check more consistent around packages (PKGS) and not recipe names (PN). This also is taking into account the changes for SPDX licenses. The aim is to provide a mode consistent variable where the variable name is known and can easily be queried. Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-27license.py: Correct a commentPeter Kjellerstedt
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25licenses: Fix logic error introduced in renameRichard Purdie
The previous commit introduced a small logic error. Fix the renaming issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25license.py: rename variablesSaul Wold
Update the comment to reflect new variable names Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-14oe/license: 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-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>
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>
2017-10-06license.py: Correct selection of licenses in is_included()Peter Kjellerstedt
When faced with multiple sets of licenses combined with | (OR), it was possible for oe.license.is_included() to choose a set of licenses with a blacklisted license and then report failure, even if choosing another set of licenses would have resulted in a successful result. This happened when the chosen set still contained more whitelisted licenses than the other set. This change makes sure a set with any blacklisted license is always considered with a lower weight than a set with only whitelisted licenses. Example: Faced with the license string "GPL-3.0 & GPL-2.0 & LGPL-2.1 | Proprietary" and with "GPL-3.0" being blacklisted, the old code would report a failure since "GPL-3.0 & GPL-2.0 & LGPL-2.1" still contains more whitelisted licenses than "Proprietary" does. This change also adds a unit test for oe.license.is_included(). Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-08-25license: simple verification of LICENSE_<pkg> valuesMarkus Lehtonen
LICENSE should be a superset of all LICENSE_<pkg> values. That is, LICENSE should contain all licenses and LICENSE_<pkg> can be used to "filter" this on a per-package basis. LICENSE_<pkg> shouldn't contain anything that isn't specified in LICENSE. This patch implements simple checking of LICENSE_<pkg> values. It does do not do advanced parsing/matching of license expressions, but, checks that all licenses mentioned in LICENSE_<pkg> are also specified in LICENSE. A warning is printed if problems are found. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-02classes/lib: Update to explictly create lists where neededRichard Purdie
Iterators now return views, not lists in python3. Where we need lists, handle this explicitly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-09license: Add support for handle INCOMPATIBLE_LICENSE in manifest creationAníbal Limón
When INCOMPATIBLE_LICENSE's is specified it need to be removed from license.manifest and also avoid copy to target image. Add ManifestVisitor that walk the license string searching for INCOMPATIBLE_LICENSE's if found remove it. [YOCTO #6765] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-09license: Split visit_string in LicenseVisitorAníbal Limón
Create get_elements and visit_elements in LicenseVisitor based on visit_string this allow to do modifications on elements before parsing with AST. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-09license_class: Generalize license_ok functionAníbal Limón
Add dont_want_licenses as parameter to license_ok function and move it to oe.license module in order to use in other modules. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-07classes/license: tweak license format messagesPaul Eggleton
Strictly speaking not all of these characters are operators, so reword the message to describe them as separators. Also use the standard "recipename: message" format. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2013-05-09meta/lib/oe: Replace StandardError with ExceptionRichard Purdie
StandardError is removed in python3, replace with Exception class instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-04license.py: fix behaviour of copyleft_complianceEric Bénard
actually if a package has a license in its LICENSE variable which is not in the whitelist nor in the blacklist and even if an other license in this variable is in the whitelist, the package gets excluded and is not taken in account in the copyleft_compliance. This patch solves this by excluding a recipe _only_ if the LICENSE variable includes a pattern from the blacklist and including a recipe only if it includes a variable from the whitelist _and_ none from the blacklist. Example in busybox which has LICENSE="GPLv2 & BSD-4-Clause", with the actual behaviour (where he blacklist contains only CLOSED Proprietary) we get : DEBUG: copyleft: busybox-1.19.4 is excluded: recipe has excluded licenses: BSD-4-Clause which is not sane because busybox is covered by a copyleft license which is GPLv2 and should match the default whitelist which is GPL* LGPL*. Signed-off-by: Eric Bénard <eric@eukrea.com>
2012-01-17oe.license: avoid the need to catch SyntaxErrorChristopher Larson
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
2012-01-17oe.license: add is_included convenience functionChristopher Larson
Given a license string and whitelist and blacklist, determine if the license string matches the whitelist and does not match the blacklist. When encountering an OR, it prefers the side with the highest weight (more included licenses). It then checks the inclusion of the flattened list of licenses from there. Returns a tuple holding the boolean state and a list of the applicable licenses which were excluded (or None, if the state is True) Examples: is_included, excluded = oe.license.is_included(licensestr, ['GPL*', 'LGPL*']) is_included, excluded = oe.license.is_included(licensestr, blacklist=['Proprietary', 'CLOSED']) Signed-off-by: Christopher Larson <chris_larson@mentor.com>
2011-12-08oe.license: add license flattening codeChristopher Larson
This flattens a license tree by selecting one side of each OR operation (chosen via the user supplied function). Signed-off-by: Christopher Larson <kergoth@gmail.com>
2011-12-08license: split license parsing into oe.licenseChristopher Larson
In addition to moving this functionality to oe.license, makes the string preparation more picky before passing it off to the ast compilation. This ensures that LICENSE entries like 'GPL/BSD' are seen as invalid (due to the presence of the unsupported '/'). Signed-off-by: Christopher Larson <kergoth@gmail.com>