diff options
Diffstat (limited to 'classes/fsl-eula-unpack.bbclass')
-rw-r--r-- | classes/fsl-eula-unpack.bbclass | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/classes/fsl-eula-unpack.bbclass b/classes/fsl-eula-unpack.bbclass index ee571f52..51ef1085 100644 --- a/classes/fsl-eula-unpack.bbclass +++ b/classes/fsl-eula-unpack.bbclass | |||
@@ -6,7 +6,18 @@ | |||
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 | ||
9 | LIC_FILES_CHKSUM_append = " file://${FSL_EULA_FILE};md5=6c12031a11b81db21cdfe0be88cac4b3" | 9 | FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V24 = "ab61cab9599935bfe9f700405ef00f28" |
10 | FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V9 = "6c12031a11b81db21cdfe0be88cac4b3" | ||
11 | FSL_EULA_FILE_MD5SUMS = \ | ||
12 | "${FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V24} \ | ||
13 | ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V9}" | ||
14 | |||
15 | # The checksum for the EULA in the layer | ||
16 | FSL_EULA_FILE_MD5SUM ?= \ | ||
17 | "${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V9}" | ||
18 | |||
19 | LIC_FILES_CHKSUM_LAYER ?= "file://${FSL_EULA_FILE};md5=${FSL_EULA_FILE_MD5SUM}" | ||
20 | LIC_FILES_CHKSUM_append = " ${LIC_FILES_CHKSUM_LAYER}" | ||
10 | 21 | ||
11 | LIC_FILES_CHKSUM[vardepsexclude] += "FSL_EULA_FILE" | 22 | LIC_FILES_CHKSUM[vardepsexclude] += "FSL_EULA_FILE" |
12 | 23 | ||
@@ -26,6 +37,7 @@ python fsl_bin_do_unpack() { | |||
26 | rootdir = localdata.getVar('WORKDIR', True) | 37 | rootdir = localdata.getVar('WORKDIR', True) |
27 | fetcher = bb.fetch2.Fetch(src_uri, localdata) | 38 | fetcher = bb.fetch2.Fetch(src_uri, localdata) |
28 | 39 | ||
40 | found = 0 | ||
29 | for url in fetcher.ud.values(): | 41 | for url in fetcher.ud.values(): |
30 | # Skip this fetcher if it's not under EULA or if the fetcher type is not supported | 42 | # Skip this fetcher if it's not under EULA or if the fetcher type is not supported |
31 | if not url.parm.get('fsl-eula', False) or url.type not in ['http', 'https', 'ftp', 'file']: | 43 | if not url.parm.get('fsl-eula', False) or url.type not in ['http', 'https', 'ftp', 'file']: |
@@ -34,9 +46,40 @@ python fsl_bin_do_unpack() { | |||
34 | if not os.path.exists(url.localpath): | 46 | if not os.path.exists(url.localpath): |
35 | bb.debug(1, "Exiting as '%s' cannot be found" % url.basename) | 47 | bb.debug(1, "Exiting as '%s' cannot be found" % url.basename) |
36 | return | 48 | return |
49 | found += 1 | ||
37 | bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename) | 50 | bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename) |
38 | cmd = "sh %s --auto-accept --force" % (url.localpath) | 51 | cmd = "sh %s --auto-accept --force" % (url.localpath) |
39 | bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir) | 52 | bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir) |
53 | |||
54 | # Check for two EULAs, one from the layer and one from the package | ||
55 | bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...") | ||
56 | if found > 1: | ||
57 | bb.warn("The package contains multiple Freescale EULA-licensed archives. The consistency logic may not be able to detect a EULA problem.") | ||
58 | layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER') | ||
59 | licenses = d.getVar('LIC_FILES_CHKSUM') or "" | ||
60 | md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or "" | ||
61 | found_layer_license = False | ||
62 | found_package_license = False | ||
63 | for license in licenses.split(): | ||
64 | if license == layer_license: | ||
65 | bb.note("Found Freescale EULA for the layer %s." % license) | ||
66 | found_layer_license = True | ||
67 | continue | ||
68 | try: | ||
69 | (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license) | ||
70 | if method != "file" or not path: | ||
71 | raise bb.fetch.MalformedUrl() | ||
72 | except bb.fetch.MalformedUrl: | ||
73 | bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), license)) | ||
74 | if parm.get('md5') in md5sums: | ||
75 | bb.note("Found Freescale EULA for the package %s." % license) | ||
76 | found_package_license = True | ||
77 | if not found_layer_license: | ||
78 | bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'." | ||
79 | % (layer_license, licenses)) | ||
80 | if not found_package_license: | ||
81 | bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'." | ||
82 | % (md5sums.split(), licenses)) | ||
40 | } | 83 | } |
41 | 84 | ||
42 | python do_unpack() { | 85 | python do_unpack() { |