summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
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 = {}