summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-04-28 01:06:19 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-29 19:35:56 +0100
commit720c9262714436188a5826a81e84235926fd73a6 (patch)
treebb5596bd29605874d5ced85e91adb91f1ff0937e /scripts
parente89f4e531f9b837d4296f3292f1a4d8f8de9530a (diff)
downloadpoky-720c9262714436188a5826a81e84235926fd73a6.tar.gz
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'. (From OE-Core rev: 59381a9450949ce6b4b03adb717e950b999830f3) (From OE-Core rev: 2d96460f2dcac4263f43ebcb7556722ce55c9918) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster@mvista.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/recipetool/create.py2
-rw-r--r--scripts/lib/recipetool/create_npm.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index bb9fb9b049..aade40b5a8 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
854 pkglicenses[pn].append(license) 854 pkglicenses[pn].append(license)
855 outlicenses = {} 855 outlicenses = {}
856 for pkgname in packages: 856 for pkgname in packages:
857 license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown'])))) 857 license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown'])))) or 'Unknown'
858 if license == 'Unknown' and pkgname in fallback_licenses: 858 if license == 'Unknown' and pkgname in fallback_licenses:
859 license = fallback_licenses[pkgname] 859 license = fallback_licenses[pkgname]
860 outlines.append('LICENSE_%s = "%s"' % (pkgname, license)) 860 outlines.append('LICENSE_%s = "%s"' % (pkgname, license))
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index b3ffcdbc5b..cc4fb42684 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -45,7 +45,7 @@ class NpmRecipeHandler(RecipeHandler):
45 license = data['license'] 45 license = data['license']
46 if isinstance(license, dict): 46 if isinstance(license, dict):
47 license = license.get('type', None) 47 license = license.get('type', None)
48 return None 48 return license
49 49
50 def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before): 50 def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before):
51 try: 51 try: