[oe-commits] [openembedded-core] 31/31: recipetool: create: fix falling back to declared license for npm packages
git at git.openembedded.org
git at git.openembedded.org
Fri Apr 29 08:24:38 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit b157149f0855ccb2cd042e689699acedbf428b92
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu Apr 28 01:06:19 2016 +1200
recipetool: create: fix falling back to declared license for npm packages
Fix two problems falling back to the "license" field from package.json
when no license file is present:
1) The function that was supposed to return the license field value was
always explicitly returning None, and this was never noticed (because
the test cases never exercised the fallback as they provided license
files for each module).
2) Fix the main package not falling back because it had a default of an
empty list, which evaluates to '' instead of 'Unknown'.
Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/recipetool/create.py | 2 +-
scripts/lib/recipetool/create_npm.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index bb9fb9b..aade40b 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -854,7 +854,7 @@ def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn
pkglicenses[pn].append(license)
outlicenses = {}
for pkgname in packages:
- license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown']))))
+ license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown'])))) or 'Unknown'
if license == 'Unknown' and pkgname in fallback_licenses:
license = fallback_licenses[pkgname]
outlines.append('LICENSE_%s = "%s"' % (pkgname, license))
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index b3ffcdb..cc4fb42 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -45,7 +45,7 @@ class NpmRecipeHandler(RecipeHandler):
license = data['license']
if isinstance(license, dict):
license = license.get('type', None)
- return None
+ return license
def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before):
try:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list