mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 05:09:24 +00:00
license.bbclass: package license texts to PN-lic when LICENSE_CREATE_PACKAGE is enabled
[YOCTO #3743] (From OE-Core rev: dc78ef91a2bf01efb8028c9afbe69e506e016265) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
2daab0b3a2
commit
15aa713482
@@ -6,6 +6,11 @@
|
||||
LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses"
|
||||
LICSSTATEDIR = "${WORKDIR}/license-destdir/"
|
||||
|
||||
# Create extra package with license texts and add it to RRECOMMENDS_${PN}
|
||||
LICENSE_CREATE_PACKAGE ??= "0"
|
||||
LICENSE_PACKAGE_SUFFIX ??= "-lic"
|
||||
LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/"
|
||||
|
||||
addtask populate_lic after do_patch before do_build
|
||||
do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
|
||||
do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
|
||||
@@ -95,6 +100,35 @@ python do_populate_lic() {
|
||||
copy_license_files(lic_files_paths, destdir)
|
||||
}
|
||||
|
||||
# it would be better to copy them in do_install_append, but find_license_filesa is python
|
||||
python perform_packagecopy_prepend () {
|
||||
enabled = d.getVar('LICENSE_CREATE_PACKAGE', True)
|
||||
if d.getVar('CLASSOVERRIDE', True) == 'class-target' and enabled:
|
||||
lic_files_paths = find_license_files(d)
|
||||
|
||||
# LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
|
||||
destdir = d.getVar('D', True) + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY', True), d.getVar('PN', True))
|
||||
copy_license_files(lic_files_paths, destdir)
|
||||
add_package_and_files(d)
|
||||
}
|
||||
|
||||
def add_package_and_files(d):
|
||||
packages = d.getVar('PACKAGES', True)
|
||||
files = d.getVar('LICENSE_FILES_DIRECTORY', True)
|
||||
pn = d.getVar('PN', True)
|
||||
pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX'))
|
||||
if pn_lic in packages:
|
||||
bb.warn("%s package already existed in %s." % (pn_lic, pn))
|
||||
else:
|
||||
# first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY
|
||||
d.setVar('PACKAGES', "%s %s" % (pn_lic, packages))
|
||||
d.setVar('FILES_' + pn_lic, files)
|
||||
rrecommends_pn = d.getVar('RRECOMMENDS_' + pn, True)
|
||||
if rrecommends_pn:
|
||||
d.setVar('RRECOMMENDS_' + pn, "%s %s" % (pn_lic, rrecommends_pn))
|
||||
else:
|
||||
d.setVar('RRECOMMENDS_' + pn, "%s" % (pn_lic))
|
||||
|
||||
def copy_license_files(lic_files_paths, destdir):
|
||||
bb.mkdirhier(destdir)
|
||||
for (basename, path) in lic_files_paths:
|
||||
|
||||
Reference in New Issue
Block a user