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 23:18:18 +0000 |
commit | 1da740ef3264e8f926a85127304d3b76a030ad83 (patch) | |
tree | ee72dc63d2beead3f2e0c811d11f3e372cf846eb /scripts/lib | |
parent | 837d89b47bdf9a253952b2752ce2794fe6f90eca (diff) | |
download | poky-1da740ef3264e8f926a85127304d3b76a030ad83.tar.gz |
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.
(From OE-Core rev: c0cfd9b1d54b05ad048f444d6fe248aa0500159e)
Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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): | |||
46 | if isinstance(license, dict): | 46 | if isinstance(license, dict): |
47 | license = license.get('type', None) | 47 | license = license.get('type', None) |
48 | if license: | 48 | if license: |
49 | if 'OR' in license: | ||
50 | license = license.replace('OR', '|') | ||
51 | license = license.replace('AND', '&') | ||
52 | license = license.replace(' ', '_') | ||
53 | if not license[0] == '(': | ||
54 | license = '(' + license + ')' | ||
55 | print('LICENSE: {}'.format(license)) | ||
56 | else: | ||
57 | license = license.replace('AND', '&') | ||
58 | if license[0] == '(': | ||
59 | license = license[1:] | ||
60 | if license[-1] == ')': | ||
61 | license = license[:-1] | ||
49 | license = license.replace('MIT/X11', 'MIT') | 62 | license = license.replace('MIT/X11', 'MIT') |
50 | license = license.replace('SEE LICENSE IN EULA', | 63 | license = license.replace('SEE LICENSE IN EULA', |
51 | 'SEE-LICENSE-IN-EULA') | 64 | 'SEE-LICENSE-IN-EULA') |
@@ -220,7 +233,8 @@ class NpmRecipeHandler(RecipeHandler): | |||
220 | packages = OrderedDict((x,y[0]) for x,y in npmpackages.items()) | 233 | packages = OrderedDict((x,y[0]) for x,y in npmpackages.items()) |
221 | packages['${PN}'] = '' | 234 | packages['${PN}'] = '' |
222 | pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses) | 235 | pkglicenses = split_pkg_licenses(licvalues, packages, lines_after, licenses) |
223 | all_licenses = list(set([item for pkglicense in pkglicenses.values() for item in pkglicense])) | 236 | all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) |
237 | all_licenses.remove('&') | ||
224 | # Go back and update the LICENSE value since we have a bit more | 238 | # Go back and update the LICENSE value since we have a bit more |
225 | # information than when that was written out (and we know all apply | 239 | # information than when that was written out (and we know all apply |
226 | # vs. there being a choice, so we can join them with &) | 240 | # vs. there being a choice, so we can join them with &) |