summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-09 17:48:52 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-09 17:00:29 +0000
commit91455005b65db1b6caededbcac0f08a0cfb660f3 (patch)
tree5b7e917a5560985f743d99475b722bc726f00660 /scripts/lib/recipetool/create.py
parentd46827cfd322554b57c3fc774b4d914f6e449d75 (diff)
downloadpoky-91455005b65db1b6caededbcac0f08a0cfb660f3.tar.gz
recipetool: create: split npm module dependencies into packages
Rather than rolling all of an npm module's dependencies into the same package, split them into one module per package, setting the SUMMARY and PKGV values from the package.json file for each package. Additionally, mark each package with the appropriate license using the license scanning we already do, falling back to the license stated in the package.json file for the module if unknown. All of this is mostly in aid of ensuring all modules and their licenses now show up in the manifests for the image. Additionally we set the main LICENSE value more concretely once we've calculated the per-package licenses, since we have more information at that point. (From OE-Core rev: 8226805f83d21e7c1d2ba21969f3e8ee4b137496) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 718f2aaf5b..43c07848c2 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -544,6 +544,7 @@ def create_recipe(args):
544 544
545 # Apply the handlers 545 # Apply the handlers
546 handled = [] 546 handled = []
547 handled.append(('license', licvalues))
547 548
548 if args.binary: 549 if args.binary:
549 classes.append('bin_package') 550 classes.append('bin_package')
@@ -815,6 +816,33 @@ def guess_license(srctree):
815 816
816 return licenses 817 return licenses
817 818
819def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn='${PN}'):
820 """
821 Given a list of (license, path, md5sum) as returned by guess_license(),
822 a dict of package name to path mappings, write out a set of
823 package-specific LICENSE values.
824 """
825 pkglicenses = {pn: []}
826 for license, licpath, _ in licvalues:
827 for pkgname, pkgpath in packages.iteritems():
828 if licpath.startswith(pkgpath + '/'):
829 if pkgname in pkglicenses:
830 pkglicenses[pkgname].append(license)
831 else:
832 pkglicenses[pkgname] = [license]
833 break
834 else:
835 # Accumulate on the main package
836 pkglicenses[pn].append(license)
837 outlicenses = {}
838 for pkgname in packages:
839 license = ' '.join(list(set(pkglicenses.get(pkgname, ['Unknown']))))
840 if license == 'Unknown' and pkgname in fallback_licenses:
841 license = fallback_licenses[pkgname]
842 outlines.append('LICENSE_%s = "%s"' % (pkgname, license))
843 outlicenses[pkgname] = license.split()
844 return outlicenses
845
818def read_pkgconfig_provides(d): 846def read_pkgconfig_provides(d):
819 pkgdatadir = d.getVar('PKGDATA_DIR', True) 847 pkgdatadir = d.getVar('PKGDATA_DIR', True)
820 pkgmap = {} 848 pkgmap = {}