[OE-core] [PATCH 1/3] license.bbclass: allow copying license not in common licenses

jackie.huang at windriver.com jackie.huang at windriver.com
Thu Apr 23 09:38:15 UTC 2015


From: Jackie Huang <jackie.huang at windriver.com>

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_LIC is added to allow copying license
not in common licenses, it should be used in the recipe as:

NO_GENERIC_LIC[<license_name>] = "<license file in fetched source>"

e.g.
NO_GENERIC_LIC[Firmware-Abilis] = "LICENCE.Abilis.txt"

Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
---
 meta/classes/license.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 73a0e97..990f704 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_LIC 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,14 @@ 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)))
+
+        elif d.getVarFlag('NO_GENERIC_LIC', license_type):
+            # if NO_GENERIC_LIC 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_LIC', 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))
-- 
1.9.1




More information about the Openembedded-core mailing list