aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-10-28 15:47:40 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-10-31 16:57:35 +1300
commitdaa1ccf7c131f983aa98b7dd64676251a9f0cf6b (patch)
tree4a9b82c1048cd6cdd2dfaffb4d6c8dfa32a238e3
parent299bdc10f6f62885565d15669097dae33cc60081 (diff)
downloadopenembedded-core-contrib-daa1ccf7c131f983aa98b7dd64676251a9f0cf6b.tar.gz
recipetool: create: separate LICENSE items with & by default
recipetool sets the LICENSE value based on licenses detected from the source tree. If there are multiple licenses then they were being separated by spaces, but this isn't actually legal formatting and if you're using "devtool add" you get a warning printed when devtool parses the recipe internally. Earlier I had made a conscious decision to do it this way since it's up to the user to figure out whether the multiple licenses should all apply (in which case they'd be separated with &) or if there is a choice of license (in which case | is the correct separator). However, I've come to the conclusion that we can just default to & and then the ugly warning goes away, and it's the safest alternative of the two (and most likely to be correct, since it's more common to have a codebase which is made up of code with different licenses, i.e. all of them apply to the combined work). I've tweaked the comment that we add to the recipe to explicitly state that we've used & and that the user needs to change that if that's not accurate. Fixes [YOCTO #10413]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--meta/lib/oeqa/selftest/devtool.py5
-rw-r--r--scripts/lib/recipetool/create.py12
2 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index e992dcf771..713f2c5d63 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -46,7 +46,10 @@ class DevtoolBase(oeSelfTest):
if needvalue is None:
self.fail('Variable %s should not appear in recipe')
if isinstance(needvalue, set):
- value = set(value.split())
+ if var == 'LICENSE':
+ value = set(value.split(' & '))
+ else:
+ value = set(value.split())
self.assertEqual(value, needvalue, 'values for %s do not match' % var)
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index c1819b6c66..cb1c80434c 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -787,10 +787,12 @@ def handle_license_vars(srctree, lines_before, handled, extravalues, d):
lines_before.append('# your responsibility to verify that the values are complete and correct.')
if len(licvalues) > 1:
lines_before.append('#')
- lines_before.append('# NOTE: multiple licenses have been detected; if that is correct you should separate')
- lines_before.append('# these in the LICENSE value using & if the multiple licenses all apply, or | if there')
- lines_before.append('# is a choice between the multiple licenses. If in doubt, check the accompanying')
- lines_before.append('# documentation to determine which situation is applicable.')
+ lines_before.append('# NOTE: multiple licenses have been detected; they have been separated with &')
+ lines_before.append('# in the LICENSE value for now since it is a reasonable assumption that all')
+ lines_before.append('# of the licenses apply. If instead there is a choice between the multiple')
+ lines_before.append('# licenses then you should change the value to separate the licenses with |')
+ lines_before.append('# instead of &. If there is any doubt, check the accompanying documentation')
+ lines_before.append('# to determine which situation is applicable.')
if lic_unknown:
lines_before.append('#')
lines_before.append('# The following license files were not able to be identified and are')
@@ -814,7 +816,7 @@ def handle_license_vars(srctree, lines_before, handled, extravalues, d):
licenses = [pkg_license]
else:
lines_before.append('# NOTE: Original package metadata indicates license is: %s' % pkg_license)
- lines_before.append('LICENSE = "%s"' % ' '.join(licenses))
+ lines_before.append('LICENSE = "%s"' % ' & '.join(licenses))
lines_before.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum))
lines_before.append('')
handled.append(('license', licvalues))