diff options
-rw-r--r-- | meta/classes/license.bbclass | 17 |
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)) |