summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-03 12:33:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-03 12:33:18 +0000
commit9b2fd4b0fe103f1a626e079ade20bbc19d21ebf3 (patch)
tree842b60448d470026ec9ec79d393a9f2cc1cd6916 /meta/classes
parent1a559cbcca083d835447ad99ce85c683e49272f6 (diff)
downloadpoky-9b2fd4b0fe103f1a626e079ade20bbc19d21ebf3.tar.gz
license.bbclass: Add coverage by sstate code (also use cleandirs and dirs task attribures for directory handling)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/license.bbclass29
-rw-r--r--meta/classes/sstate.bbclass1
2 files changed, 17 insertions, 13 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index b5021f2b58..97d4e4e41e 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -9,8 +9,11 @@
9# differences and that should be corrected. 9# differences and that should be corrected.
10 10
11LICENSE_DIRECTORY ??= "${DEPLOY_DIR_IMAGE}/licenses" 11LICENSE_DIRECTORY ??= "${DEPLOY_DIR_IMAGE}/licenses"
12LICSSTATEDIR = "${WORKDIR}/license-destdir/"
12 13
13addtask populate_lic after do_patch before do_package 14addtask populate_lic after do_patch before do_package
15do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
16do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
14python do_populate_lic() { 17python do_populate_lic() {
15 """ 18 """
16 Populate LICENSE_DIRECTORY with licenses. 19 Populate LICENSE_DIRECTORY with licenses.
@@ -25,7 +28,7 @@ python do_populate_lic() {
25 lic_files = bb.data.getVar('LIC_FILES_CHKSUM', d, True) 28 lic_files = bb.data.getVar('LIC_FILES_CHKSUM', d, True)
26 pn = bb.data.getVar('PN', d, True) 29 pn = bb.data.getVar('PN', d, True)
27 # The base directory we wrangle licenses to 30 # The base directory we wrangle licenses to
28 destdir = os.path.join(bb.data.getVar('LICENSE_DIRECTORY', d, True), pn) 31 destdir = os.path.join(bb.data.getVar('LICSSTATEDIR', d, True), pn)
29 # The license files are located in S/LIC_FILE_CHECKSUM. 32 # The license files are located in S/LIC_FILE_CHECKSUM.
30 srcdir = bb.data.getVar('S', d, True) 33 srcdir = bb.data.getVar('S', d, True)
31 # Directory we store the generic licenses as set in poky.conf 34 # Directory we store the generic licenses as set in poky.conf
@@ -33,18 +36,6 @@ python do_populate_lic() {
33 if not generic_directory: 36 if not generic_directory:
34 raise bb.build.FuncFailed("COMMON_LICENSE_DIR is unset. Please set this in your distro config") 37 raise bb.build.FuncFailed("COMMON_LICENSE_DIR is unset. Please set this in your distro config")
35 38
36 try:
37 # Let's try to clean up the packages license directory
38 shutil.rmtree(destdir)
39 except:
40 pass
41
42 try:
43 # Create the package license directory structure.
44 bb.mkdirhier(destdir)
45 except:
46 pass
47
48 if not lic_files: 39 if not lic_files:
49 # No recipe should have an invalid license file. This is checked else 40 # No recipe should have an invalid license file. This is checked else
50 # where, but let's be pedantic 41 # where, but let's be pedantic
@@ -98,3 +89,15 @@ python do_populate_lic() {
98 bb.warn("This could be either because we do not have a generic for this license or the LICENSE field is incorrect") 89 bb.warn("This could be either because we do not have a generic for this license or the LICENSE field is incorrect")
99 pass 90 pass
100} 91}
92
93SSTATETASKS += "do_populate_lic"
94do_populate_lic[sstate-name] = "populate-lic"
95do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
96do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
97
98python do_populate_lic_setscene () {
99 sstate_setscene(d)
100}
101addtask do_populate_lic_setscene
102
103
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 4435abc347..a754821c08 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -415,6 +415,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
415 # This needs to go away, FIXME 415 # This needs to go away, FIXME
416 mapping = { 416 mapping = {
417 "do_populate_sysroot" : "populate-sysroot", 417 "do_populate_sysroot" : "populate-sysroot",
418 "do_populate_lic" : "populate-lic",
418 "do_package_write_ipk" : "deploy-ipk", 419 "do_package_write_ipk" : "deploy-ipk",
419 "do_package_write_deb" : "deploy-deb", 420 "do_package_write_deb" : "deploy-deb",
420 "do_package_write_rpm" : "deploy-rpm", 421 "do_package_write_rpm" : "deploy-rpm",