diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2013-01-17 12:49:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-28 12:29:29 +0000 |
commit | 15aa7134826bcdd54f548454991d531d9db3b3b3 (patch) | |
tree | f0153071c9f7a5632212e52f337597de12cb4f34 /meta | |
parent | 2daab0b3a233f8e322e024338b158e0b0a16967f (diff) | |
download | poky-15aa7134826bcdd54f548454991d531d9db3b3b3.tar.gz |
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>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/license.bbclass | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 8688bd1e94..d4ebb26d2b 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -6,6 +6,11 @@ | |||
6 | LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses" | 6 | LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses" |
7 | LICSSTATEDIR = "${WORKDIR}/license-destdir/" | 7 | LICSSTATEDIR = "${WORKDIR}/license-destdir/" |
8 | 8 | ||
9 | # Create extra package with license texts and add it to RRECOMMENDS_${PN} | ||
10 | LICENSE_CREATE_PACKAGE ??= "0" | ||
11 | LICENSE_PACKAGE_SUFFIX ??= "-lic" | ||
12 | LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/" | ||
13 | |||
9 | addtask populate_lic after do_patch before do_build | 14 | addtask populate_lic after do_patch before do_build |
10 | do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}" | 15 | do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}" |
11 | do_populate_lic[cleandirs] = "${LICSSTATEDIR}" | 16 | do_populate_lic[cleandirs] = "${LICSSTATEDIR}" |
@@ -95,6 +100,35 @@ python do_populate_lic() { | |||
95 | copy_license_files(lic_files_paths, destdir) | 100 | copy_license_files(lic_files_paths, destdir) |
96 | } | 101 | } |
97 | 102 | ||
103 | # it would be better to copy them in do_install_append, but find_license_filesa is python | ||
104 | python perform_packagecopy_prepend () { | ||
105 | enabled = d.getVar('LICENSE_CREATE_PACKAGE', True) | ||
106 | if d.getVar('CLASSOVERRIDE', True) == 'class-target' and enabled: | ||
107 | lic_files_paths = find_license_files(d) | ||
108 | |||
109 | # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY | ||
110 | destdir = d.getVar('D', True) + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY', True), d.getVar('PN', True)) | ||
111 | copy_license_files(lic_files_paths, destdir) | ||
112 | add_package_and_files(d) | ||
113 | } | ||
114 | |||
115 | def add_package_and_files(d): | ||
116 | packages = d.getVar('PACKAGES', True) | ||
117 | files = d.getVar('LICENSE_FILES_DIRECTORY', True) | ||
118 | pn = d.getVar('PN', True) | ||
119 | pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX')) | ||
120 | if pn_lic in packages: | ||
121 | bb.warn("%s package already existed in %s." % (pn_lic, pn)) | ||
122 | else: | ||
123 | # first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY | ||
124 | d.setVar('PACKAGES', "%s %s" % (pn_lic, packages)) | ||
125 | d.setVar('FILES_' + pn_lic, files) | ||
126 | rrecommends_pn = d.getVar('RRECOMMENDS_' + pn, True) | ||
127 | if rrecommends_pn: | ||
128 | d.setVar('RRECOMMENDS_' + pn, "%s %s" % (pn_lic, rrecommends_pn)) | ||
129 | else: | ||
130 | d.setVar('RRECOMMENDS_' + pn, "%s" % (pn_lic)) | ||
131 | |||
98 | def copy_license_files(lic_files_paths, destdir): | 132 | def copy_license_files(lic_files_paths, destdir): |
99 | bb.mkdirhier(destdir) | 133 | bb.mkdirhier(destdir) |
100 | for (basename, path) in lic_files_paths: | 134 | for (basename, path) in lic_files_paths: |