aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/license.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-05-08 20:41:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-09 22:26:01 +0100
commit243fe3a4583a21ad6c0b2a26196ed18d41740f7a (patch)
tree267a10e8b69b252cc7d200ee9013269b84059a6d /meta/lib/oe/license.py
parenta7976cbae34dc1bd08395afb8d720d43c5f0062e (diff)
downloadopenembedded-core-243fe3a4583a21ad6c0b2a26196ed18d41740f7a.tar.gz
license_class: Generalize license_ok function
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>
Diffstat (limited to 'meta/lib/oe/license.py')
-rw-r--r--meta/lib/oe/license.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 31ca15b574..bc146a28c4 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -5,6 +5,20 @@ import ast
import re
from fnmatch import fnmatchcase as fnmatch
+def license_ok(license, dont_want_licenses):
+ """ Return False if License exist in dont_want_licenses else True """
+ for dwl in dont_want_licenses:
+ # If you want to exclude license named generically 'X', we
+ # surely want to exclude 'X+' as well. In consequence, we
+ # will exclude a trailing '+' character from LICENSE in
+ # case INCOMPATIBLE_LICENSE is not a 'X+' license.
+ lic = license
+ if not re.search('\+$', dwl):
+ lic = re.sub('\+', '', license)
+ if fnmatch(lic, dwl):
+ return False
+ return True
+
class LicenseError(Exception):
pass