diff options
| author | Tom Hochstein <tom.hochstein@nxp.com> | 2022-08-09 16:58:25 -0500 |
|---|---|---|
| committer | Tom Hochstein <tom.hochstein@nxp.com> | 2022-08-10 10:59:34 -0500 |
| commit | 98275f8772806d6f67934b5dc0a1704eab2cebd0 (patch) | |
| tree | 8f2ab8d4ed80afa403ac69e494b38cfe5ab99555 | |
| parent | 42458b25860986422bfc4cf80d3e5bf13dec55a2 (diff) | |
| download | meta-freescale-98275f8772806d6f67934b5dc0a1704eab2cebd0.tar.gz | |
fsl-eula-unpack.bbclass: Expose a function for reuse
Expose find_nxp_eula_licenses for others to use.
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
| -rw-r--r-- | classes/fsl-eula-unpack.bbclass | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/classes/fsl-eula-unpack.bbclass b/classes/fsl-eula-unpack.bbclass index a0a7bc5ef..d66acc5a4 100644 --- a/classes/fsl-eula-unpack.bbclass +++ b/classes/fsl-eula-unpack.bbclass | |||
| @@ -157,11 +157,21 @@ python fsl_bin_do_unpack() { | |||
| 157 | bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...") | 157 | bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...") |
| 158 | if found > 1: | 158 | if found > 1: |
| 159 | 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 | |||
| 169 | def find_nxp_eula_licenses(d): | ||
| 160 | layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER') | 170 | layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER') |
| 161 | licenses = d.getVar('LIC_FILES_CHKSUM') or "" | 171 | licenses = d.getVar('LIC_FILES_CHKSUM') or "" |
| 162 | md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or "" | 172 | md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or "" |
| 163 | found_layer_license = False | 173 | found_layer_licenses = "" |
| 164 | found_package_license = False | 174 | found_package_licenses = "" |
| 165 | for license in licenses.split(): | 175 | for license in licenses.split(): |
| 166 | try: | 176 | try: |
| 167 | (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license) | 177 | (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license) |
| @@ -171,14 +181,8 @@ python fsl_bin_do_unpack() { | |||
| 171 | 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)) |
| 172 | if license == layer_license: | 182 | if license == layer_license: |
| 173 | bb.note("Found Freescale EULA for the layer %s." % license) | 183 | bb.note("Found Freescale EULA for the layer %s." % license) |
| 174 | found_layer_license = True | 184 | found_layer_licenses += license |
| 175 | elif parm.get('md5') in md5sums: | 185 | elif parm.get('md5') in md5sums: |
| 176 | bb.note("Found Freescale EULA for the package %s." % license) | 186 | bb.note("Found Freescale EULA for the package %s." % license) |
| 177 | found_package_license = True | 187 | found_package_licenses += license |
| 178 | if not found_layer_license: | 188 | return (layer_license, licenses, md5sums, found_layer_licenses, found_package_licenses) |
| 179 | bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'." | ||
| 180 | % (layer_license, licenses)) | ||
| 181 | if not found_package_license: | ||
| 182 | bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'." | ||
| 183 | % (md5sums.split(), licenses)) | ||
| 184 | } | ||
