mirror of
https://github.com/thead-yocto-mirror/meta-external-toolchain
synced 2026-09-04 06:54:36 +02:00
common-license.bbclass will set LIC_FILES_CHKSUM to a common license file based on LICENSE, which is appropriate for a case where we have no sources to refer to. external-toolchain.bbclass, among other things, handles extraction of files in the external toolchain sysroot, based on patterns in the FILES variables, checking alternate locations to better support any arbitrary toolchain, and has basic mirror handling for checking multiple paths within the sysroots. Under normal circumstances, I'd want this to use highly granular commits, but this branch has been extremely long lived (>1yr) and is such an invasive refactoring that attempting to break it down now would be of limited usefulness. Signed-off-by: Christopher Larson <chris_larson@mentor.com>
44 lines
2.0 KiB
Plaintext
44 lines
2.0 KiB
Plaintext
# Handle automatically pointing LIC_FILES_CHKSUM to a common license outside
|
|
# the recipe's source tree, based on the value of LICENSE.
|
|
LIC_FILES_CHKSUM ?= "${COMMON_LIC_CHKSUM}"
|
|
|
|
COMMON_LIC_CHKSUM = ""
|
|
COMMON_LIC_CHKSUM_CLOSED = ""
|
|
COMMON_LIC_CHKSUM_GPL-2.0 = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
|
COMMON_LIC_CHKSUM_GPL-3.0 = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891"
|
|
COMMON_LIC_CHKSUM_LGPL-2.1 = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"
|
|
|
|
|
|
python () {
|
|
import oe.license
|
|
|
|
#; Set LIC_FILES_CHKSUM to a common license if it's unset and LICENSE is set
|
|
licensestr = d.getVar('LICENSE', True)
|
|
licenses = oe.license.flattened_licenses(licensestr, lambda a, b: a + b)
|
|
checksums = []
|
|
for license in licenses:
|
|
if license != 'CLOSED' and d.getVar('LIC_FILES_CHKSUM', False) == '${COMMON_LIC_CHKSUM}':
|
|
license = mapped_license(license, d)
|
|
|
|
ext_chksum_var = 'COMMON_LIC_CHKSUM_{0}'.format(license)
|
|
if d.getVar(ext_chksum_var, True):
|
|
checksums.append('${%s}' % ext_chksum_var)
|
|
else:
|
|
lic_file_name = '${COREBASE}/meta/files/common-licenses/%s' % license
|
|
lic_file = d.expand(lic_file_name)
|
|
if os.path.exists(lic_file):
|
|
md5 = bb.utils.md5_file(lic_file)
|
|
chksum = 'file://{0};md5={1}'.format(lic_file_name, md5)
|
|
bb.fatal('{0}: No available license checksum info for this license. Either set LIC_FILES_CHKSUM, or define:\n {1} = "{2}"'.format(d.getVar('PF', True), ext_chksum_var, chksum))
|
|
d.setVar('COMMON_LIC_CHKSUM', ' '.join(checksums))
|
|
}
|
|
|
|
def mapped_license(license, d):
|
|
if license.endswith('+'):
|
|
license = license[:-1]
|
|
|
|
mapped = d.getVarFlag('SPDXLICENSEMAP', license)
|
|
if mapped:
|
|
license = mapped
|
|
return license
|