summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2022-08-10 13:58:04 -0300
committerGitHub <noreply@github.com>2022-08-10 13:58:04 -0300
commit1d8ac870da885b0b2872d2448eec627edaf014fa (patch)
tree6da01c464f762756d44cbc3ae1be6dcc9d0e4b5d
parent06e1cf4099caa53da33c10e1884064f73dc184dd (diff)
parent84a85837603eb891fb44d6fbd88cd56b83d8811c (diff)
downloadmeta-freescale-1d8ac870da885b0b2872d2448eec627edaf014fa.tar.gz
Merge pull request #1170 from Freescale/backport-1169-to-kirkstone
[Backport kirkstone] Rework fsl-eula-unpack.bbclass for reuse
-rw-r--r--classes/fsl-eula-unpack.bbclass73
1 files changed, 39 insertions, 34 deletions
diff --git a/classes/fsl-eula-unpack.bbclass b/classes/fsl-eula-unpack.bbclass
index 5fd18c2f..d66acc5a 100644
--- a/classes/fsl-eula-unpack.bbclass
+++ b/classes/fsl-eula-unpack.bbclass
@@ -104,6 +104,28 @@ do_fetch:prepend() {
104 bb.fatal("The recipe LICENSE should include Proprietary but is " + d.getVar("LICENSE") + ".") 104 bb.fatal("The recipe LICENSE should include Proprietary but is " + d.getVar("LICENSE") + ".")
105} 105}
106 106
107do_unpack[vardepsexclude] += "FSL_EULA_FILE"
108python do_unpack() {
109 eula = d.getVar('ACCEPT_FSL_EULA')
110 eula_file = d.getVar('FSL_EULA_FILE')
111 pkg = d.getVar('PN')
112 if eula == None:
113 bb.fatal("To use '%s' you need to accept the Freescale EULA at '%s'. "
114 "Please read it and in case you accept it, write: "
115 "ACCEPT_FSL_EULA = \"1\" in your local.conf." % (pkg, eula_file))
116 elif eula == '0':
117 bb.fatal("To use '%s' you need to accept the Freescale EULA." % pkg)
118 else:
119 bb.note("Freescale EULA has been accepted for '%s'" % pkg)
120
121 try:
122 bb.build.exec_func('base_do_unpack', d)
123 except:
124 raise
125
126 bb.build.exec_func('fsl_bin_do_unpack', d)
127}
128
107python fsl_bin_do_unpack() { 129python fsl_bin_do_unpack() {
108 src_uri = (d.getVar('SRC_URI') or "").split() 130 src_uri = (d.getVar('SRC_URI') or "").split()
109 if len(src_uri) == 0: 131 if len(src_uri) == 0:
@@ -128,16 +150,28 @@ python fsl_bin_do_unpack() {
128 bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename) 150 bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename)
129 cmd = "sh %s --auto-accept --force" % (url.localpath) 151 cmd = "sh %s --auto-accept --force" % (url.localpath)
130 bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir) 152 bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir)
153 if not found:
154 bb.fatal("The recipe inherits 'fsl-eula-unpack.bbclass' but does not mark any URL in SRC_URI with the option 'fsl-eula=true'")
131 155
132 # Check for two EULAs, one from the layer and one from the package 156 # Check for two EULAs, one from the layer and one from the package
133 bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...") 157 bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...")
134 if found > 1: 158 if found > 1:
135 bb.warn("The package contains multiple Freescale EULA-licensed archives. The consistency logic may not be able to detect a EULA problem.") 159 bb.warn("The package contains multiple Freescale EULA-licensed archives. The consistency logic may not be able to detect a EULA problem.")
160 (layer_license, licenses, md5sums, found_layer_licenses, found_package_licenses) = find_nxp_eula_licenses(d)
161 if not found_layer_licenses:
162 bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'."
163 % (layer_license, licenses))
164 if not found_package_licenses:
165 bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'."
166 % (md5sums.split(), licenses))
167}
168
169def find_nxp_eula_licenses(d):
136 layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER') 170 layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER')
137 licenses = d.getVar('LIC_FILES_CHKSUM') or "" 171 licenses = d.getVar('LIC_FILES_CHKSUM') or ""
138 md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or "" 172 md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or ""
139 found_layer_license = False 173 found_layer_licenses = ""
140 found_package_license = False 174 found_package_licenses = ""
141 for license in licenses.split(): 175 for license in licenses.split():
142 try: 176 try:
143 (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license) 177 (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license)
@@ -147,37 +181,8 @@ python fsl_bin_do_unpack() {
147 bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), license)) 181 bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), license))
148 if license == layer_license: 182 if license == layer_license:
149 bb.note("Found Freescale EULA for the layer %s." % license) 183 bb.note("Found Freescale EULA for the layer %s." % license)
150 found_layer_license = True 184 found_layer_licenses += license
151 elif parm.get('md5') in md5sums: 185 elif parm.get('md5') in md5sums:
152 bb.note("Found Freescale EULA for the package %s." % license) 186 bb.note("Found Freescale EULA for the package %s." % license)
153 found_package_license = True 187 found_package_licenses += license
154 if not found_layer_license: 188 return (layer_license, licenses, md5sums, found_layer_licenses, found_package_licenses)
155 bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'."
156 % (layer_license, licenses))
157 if not found_package_license:
158 bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'."
159 % (md5sums.split(), licenses))
160}
161
162python do_unpack() {
163 eula = d.getVar('ACCEPT_FSL_EULA')
164 eula_file = d.getVar('FSL_EULA_FILE')
165 pkg = d.getVar('PN')
166 if eula == None:
167 bb.fatal("To use '%s' you need to accept the Freescale EULA at '%s'. "
168 "Please read it and in case you accept it, write: "
169 "ACCEPT_FSL_EULA = \"1\" in your local.conf." % (pkg, eula_file))
170 elif eula == '0':
171 bb.fatal("To use '%s' you need to accept the Freescale EULA." % pkg)
172 else:
173 bb.note("Freescale EULA has been accepted for '%s'" % pkg)
174
175 try:
176 bb.build.exec_func('base_do_unpack', d)
177 except:
178 raise
179
180 bb.build.exec_func('fsl_bin_do_unpack', d)
181}
182
183do_unpack[vardepsexclude] += "FSL_EULA_FILE"