summaryrefslogtreecommitdiffstats
path: root/meta/classes/license.bbclass
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:04:16 +0100
commit9c2e9616c26d511fb90ff4af11d064151c29792f (patch)
tree45c492d8282f50cc6763ef36810222e1d7ceda75 /meta/classes/license.bbclass
parent462a873cd3fe9fce5a30f48abf0d5192fe94b6d9 (diff)
downloadpoky-9c2e9616c26d511fb90ff4af11d064151c29792f.tar.gz
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" (From OE-Core rev: 56930227128d55dab22f79138152b29cf040ceff) Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-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):
222 pass 222 pass
223 spdx_generic = None 223 spdx_generic = None
224 license_source = None 224 license_source = None
225 # If the generic does not exist we need to check to see if there is an SPDX mapping to it 225 # If the generic does not exist we need to check to see if there is an SPDX mapping to it,
226 # unless NO_GENERIC_LICENSE is set.
227
226 for lic_dir in license_source_dirs: 228 for lic_dir in license_source_dirs:
227 if not os.path.isfile(os.path.join(lic_dir, license_type)): 229 if not os.path.isfile(os.path.join(lic_dir, license_type)):
228 if d.getVarFlag('SPDXLICENSEMAP', license_type) != None: 230 if d.getVarFlag('SPDXLICENSEMAP', license_type) != None:
@@ -241,6 +243,19 @@ def find_license_files(d):
241 # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes) 243 # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes)
242 244
243 lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic))) 245 lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic)))
246
247 # The user may attempt to use NO_GENERIC_LICENSE for a generic license which doesn't make sense
248 # and should not be allowed, warn the user in this case.
249 if d.getVarFlag('NO_GENERIC_LICENSE', license_type):
250 bb.warn("%s: %s is a generic license, please don't use NO_GENERIC_LICENSE for it." % (pn, license_type))
251
252 elif d.getVarFlag('NO_GENERIC_LICENSE', license_type):
253 # if NO_GENERIC_LICENSE is set, we copy the license files from the fetched source
254 # of the package rather than the license_source_dirs.
255 for (basename, path) in lic_files_paths:
256 if d.getVarFlag('NO_GENERIC_LICENSE', license_type) == basename:
257 lic_files_paths.append(("generic_" + license_type, path))
258 break
244 else: 259 else:
245 # And here is where we warn people that their licenses are lousy 260 # And here is where we warn people that their licenses are lousy
246 bb.warn("%s: No generic license file exists for: %s in any provider" % (pn, license_type)) 261 bb.warn("%s: No generic license file exists for: %s in any provider" % (pn, license_type))