summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hochstein <tom.hochstein@nxp.com>2020-03-18 15:01:07 -0500
committerOtavio Salvador <otavio@ossystems.com.br>2020-03-27 10:13:39 -0300
commit49291d13e6c0a555e10fcfb12f550fbf6eba3e19 (patch)
tree4f306d17346f92a355c8772ba64207a740ea4678
parentdef2b2d00f57768674f2ffcbdcad006dda922a35 (diff)
downloadmeta-freescale-49291d13e6c0a555e10fcfb12f550fbf6eba3e19.tar.gz
fsl-eula-unpack.bbclass: Enhance EULA model
Each new version of the EULA is meant to be a click through that includes any existing packages with an older EULA. The latest EULA is also copied in the layer. Capture this model in the class by listing the known EULAs and checking that any package has a known EULA. The new model also allows extensibility, so new EULAs can be introduced separately. Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> (cherry picked from commit d24d046766e8b6ebcde17c9243f8527125f1115d)
-rw-r--r--classes/fsl-eula-unpack.bbclass43
1 files changed, 42 insertions, 1 deletions
diff --git a/classes/fsl-eula-unpack.bbclass b/classes/fsl-eula-unpack.bbclass
index 9b8f2af6..d5e31c4a 100644
--- a/classes/fsl-eula-unpack.bbclass
+++ b/classes/fsl-eula-unpack.bbclass
@@ -6,7 +6,16 @@
6# 6#
7# SRC_URI = "${FSL_MIRROR}/firmware-imx-${PV};fsl-eula=true" 7# SRC_URI = "${FSL_MIRROR}/firmware-imx-${PV};fsl-eula=true"
8 8
9LIC_FILES_CHKSUM_append = " file://${FSL_EULA_FILE};md5=ab61cab9599935bfe9f700405ef00f28" 9FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V24 = "ab61cab9599935bfe9f700405ef00f28"
10FSL_EULA_FILE_MD5SUMS = \
11 "${FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V24}"
12
13# The checksum for the EULA in the layer
14FSL_EULA_FILE_MD5SUM ?= \
15 "${FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V24}"
16
17LIC_FILES_CHKSUM_LAYER ?= "file://${FSL_EULA_FILE};md5=${FSL_EULA_FILE_MD5SUM}"
18LIC_FILES_CHKSUM_append = " ${LIC_FILES_CHKSUM_LAYER}"
10 19
11LIC_FILES_CHKSUM[vardepsexclude] += "FSL_EULA_FILE" 20LIC_FILES_CHKSUM[vardepsexclude] += "FSL_EULA_FILE"
12 21
@@ -21,6 +30,7 @@ python fsl_bin_do_unpack() {
21 rootdir = localdata.getVar('WORKDIR', True) 30 rootdir = localdata.getVar('WORKDIR', True)
22 fetcher = bb.fetch2.Fetch(src_uri, localdata) 31 fetcher = bb.fetch2.Fetch(src_uri, localdata)
23 32
33 found = 0
24 for url in fetcher.ud.values(): 34 for url in fetcher.ud.values():
25 # Skip this fetcher if it's not under EULA or if the fetcher type is not supported 35 # Skip this fetcher if it's not under EULA or if the fetcher type is not supported
26 if not url.parm.get('fsl-eula', False) or url.type not in ['http', 'https', 'ftp', 'file']: 36 if not url.parm.get('fsl-eula', False) or url.type not in ['http', 'https', 'ftp', 'file']:
@@ -29,9 +39,40 @@ python fsl_bin_do_unpack() {
29 if not os.path.exists(url.localpath): 39 if not os.path.exists(url.localpath):
30 bb.debug(1, "Exiting as '%s' cannot be found" % url.basename) 40 bb.debug(1, "Exiting as '%s' cannot be found" % url.basename)
31 return 41 return
42 found += 1
32 bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename) 43 bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename)
33 cmd = "sh %s --auto-accept --force" % (url.localpath) 44 cmd = "sh %s --auto-accept --force" % (url.localpath)
34 bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir) 45 bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir)
46
47 # Check for two EULAs, one from the layer and one from the package
48 bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...")
49 if found > 1:
50 bb.warn("The package contains multiple Freescale EULA-licensed archives. The consistency logic may not be able to detect a EULA problem.")
51 layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER')
52 licenses = d.getVar('LIC_FILES_CHKSUM') or ""
53 md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or ""
54 found_layer_license = False
55 found_package_license = False
56 for license in licenses.split():
57 if license == layer_license:
58 bb.note("Found Freescale EULA for the layer %s." % license)
59 found_layer_license = True
60 continue
61 try:
62 (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license)
63 if method != "file" or not path:
64 raise bb.fetch.MalformedUrl()
65 except bb.fetch.MalformedUrl:
66 bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), license))
67 if parm.get('md5') in md5sums:
68 bb.note("Found Freescale EULA for the package %s." % license)
69 found_package_license = True
70 if not found_layer_license:
71 bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'."
72 % (layer_license, licenses))
73 if not found_package_license:
74 bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'."
75 % (md5sums.split(), licenses))
35} 76}
36 77
37python do_unpack() { 78python do_unpack() {