diff options
author | Anders Darander <anders@chargestorm.se> | 2017-03-01 18:20:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-04 10:42:32 +0000 |
commit | c0cfd9b1d54b05ad048f444d6fe248aa0500159e (patch) | |
tree | 4900be21b05912f088fa959f4027c0ff0b4fa303 /scripts/lib | |
parent | 39127702cee80c972ee9a447ef4006751f47475e (diff) | |
download | openembedded-core-c0cfd9b1d54b05ad048f444d6fe248aa0500159e.tar.gz openembedded-core-c0cfd9b1d54b05ad048f444d6fe248aa0500159e.tar.bz2 openembedded-core-c0cfd9b1d54b05ad048f444d6fe248aa0500159e.zip |
scripts/lib/create_npm: handle AND and OR in licenses
Handle npm packages with multiple licenses (AND and OR).
Prior to this, AND and OR were treated as licensed in their
own.
Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/recipetool/create_npm.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py index 3a88592b73..72ceb953e2 100644 --- a/scripts/lib/recipetool/create_npm.py +++ b/scripts/lib/recipetool/create_npm.py @@ -46,6 +46,19 @@ class NpmRecipeHandler(RecipeHandler): if isinstance(license, dict): license = license.get('type', None) if license: + if 'OR' in license: + license = license.replace('OR', '|') + license = license.replace('AND', '&') + license = license.replace(' ', '_') + if not license[0] == '(': + license = '(' + license + ')' + print('LICENSE: {}'.format(license)) + else: + license = license.replace('AND', '&') + if license[0] == '(': + license = license[1:] + if license[-1] == ')': + license = license[:-1] license = license.replace('MIT/X11', 'MIT') license = license.replace('SEE LICENSE IN EULA', 'SEE-LICENSE-IN-EULA') @@ -220,7 +233,8 @@ class NpmRecipeHandler(RecipeHandler): packages = OrderedDict((x,y[0]) for x,y in npmpackages.items()) packages['${PN}'] = '' pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses) - all_licenses = list(set([item for pkglicense in pkglicenses.values() for item in pkglicense])) + all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) + all_licenses.remove('&') # Go back and update the LICENSE value since we have a bit more # information than when that was written out (and we know all apply # vs. there being a choice, so we can join them with &) |