aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2015-04-23 00:05:04 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-30 23:01:29 +0100
commit56930227128d55dab22f79138152b29cf040ceff (patch)
treee6544d1b9fd49919b9e015384da2cdc706033a34 /meta/classes
parent055a5bbfc7686c8eec3aad2bcbcf90c40031cc34 (diff)
downloadopenembedded-core-56930227128d55dab22f79138152b29cf040ceff.tar.gz
openembedded-core-56930227128d55dab22f79138152b29cf040ceff.tar.bz2
openembedded-core-56930227128d55dab22f79138152b29cf040ceff.zip
license.bbclass: allow copying license not in common licenses
Some package like linux-firmware has many licenses that aren't in any way common, and new ones will be added from time to time, in order to avoid adding bunch of such common license files that are only applicable to a specific package, NO_GENERIC_LICENSE is added to allow copying license not in common licenses, it should be used in the recipe as: NO_GENERIC_LICENSE[<license_name>] = "<license file in fetched source>" e.g. NO_GENERIC_LICENSE[Firmware-Abilis] = "LICENCE.Abilis.txt" Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/license.bbclass17
1 files changed, 16 insertions, 1 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 73a0e9727e..d9409a90ba 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -222,7 +222,9 @@ def find_license_files(d):
pass
spdx_generic = None
license_source = None
- # If the generic does not exist we need to check to see if there is an SPDX mapping to it
+ # If the generic does not exist we need to check to see if there is an SPDX mapping to it,
+ # unless NO_GENERIC_LICENSE is set.
+
for lic_dir in license_source_dirs:
if not os.path.isfile(os.path.join(lic_dir, license_type)):
if d.getVarFlag('SPDXLICENSEMAP', license_type) != None:
@@ -241,6 +243,19 @@ def find_license_files(d):
# audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes)
lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic)))
+
+ # The user may attempt to use NO_GENERIC_LICENSE for a generic license which doesn't make sense
+ # and should not be allowed, warn the user in this case.
+ if d.getVarFlag('NO_GENERIC_LICENSE', license_type):
+ bb.warn("%s: %s is a generic license, please don't use NO_GENERIC_LICENSE for it." % (pn, license_type))
+
+ elif d.getVarFlag('NO_GENERIC_LICENSE', license_type):
+ # if NO_GENERIC_LICENSE is set, we copy the license files from the fetched source
+ # of the package rather than the license_source_dirs.
+ for (basename, path) in lic_files_paths:
+ if d.getVarFlag('NO_GENERIC_LICENSE', license_type) == basename:
+ lic_files_paths.append(("generic_" + license_type, path))
+ break
else:
# And here is where we warn people that their licenses are lousy
bb.warn("%s: No generic license file exists for: %s in any provider" % (pn, license_type))