diff options
| -rw-r--r-- | meta/classes/spdx-common.bbclass | 9 | ||||
| -rw-r--r-- | meta/lib/oe/spdx_common.py | 41 |
2 files changed, 24 insertions, 26 deletions
diff --git a/meta/classes/spdx-common.bbclass b/meta/classes/spdx-common.bbclass index ad02da5cd6..d3cdc8b6ce 100644 --- a/meta/classes/spdx-common.bbclass +++ b/meta/classes/spdx-common.bbclass | |||
| @@ -57,6 +57,15 @@ def create_spdx_source_deps(d): | |||
| 57 | if oe.spdx_common.has_task(d, "do_shared_workdir"): | 57 | if oe.spdx_common.has_task(d, "do_shared_workdir"): |
| 58 | deps.append("%s:do_shared_workdir" % pn) | 58 | deps.append("%s:do_shared_workdir" % pn) |
| 59 | 59 | ||
| 60 | # For gcc-source-${PV} source code | ||
| 61 | if oe.spdx_common.has_task(d, "do_preconfigure"): | ||
| 62 | deps.append("%s:do_preconfigure" % pn) | ||
| 63 | elif oe.spdx_common.has_task(d, "do_patch"): | ||
| 64 | deps.append("%s:do_patch" % pn) | ||
| 65 | # For gcc-cross-x86_64 source code | ||
| 66 | elif oe.spdx_common.has_task(d, "do_configure"): | ||
| 67 | deps.append("%s:do_configure" % pn) | ||
| 68 | |||
| 60 | return " ".join(deps) | 69 | return " ".join(deps) |
| 61 | 70 | ||
| 62 | 71 | ||
diff --git a/meta/lib/oe/spdx_common.py b/meta/lib/oe/spdx_common.py index 7a85579f64..ff18d91780 100644 --- a/meta/lib/oe/spdx_common.py +++ b/meta/lib/oe/spdx_common.py | |||
| @@ -38,7 +38,7 @@ def extract_licenses(filename): | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | def is_work_shared_spdx(d): | 40 | def is_work_shared_spdx(d): |
| 41 | return bb.data.inherits_class("kernel", d) or ("work-shared" in d.getVar("WORKDIR")) | 41 | return '/work-shared/' in d.getVar('S') |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | def load_spdx_license_data(d): | 44 | def load_spdx_license_data(d): |
| @@ -74,11 +74,6 @@ def process_sources(d): | |||
| 74 | if d.getVar("PN") == "shadow-sysroot": | 74 | if d.getVar("PN") == "shadow-sysroot": |
| 75 | return False | 75 | return False |
| 76 | 76 | ||
| 77 | # We just archive gcc-source for all the gcc related recipes | ||
| 78 | if d.getVar("BPN") in ["gcc", "libgcc"]: | ||
| 79 | bb.debug(1, "spdx: There is bug in scan of %s is, do nothing" % pn) | ||
| 80 | return False | ||
| 81 | |||
| 82 | return True | 77 | return True |
| 83 | 78 | ||
| 84 | 79 | ||
| @@ -190,34 +185,28 @@ def get_patched_src(d): | |||
| 190 | bb.utils.mkdirhier(d.getVar("B")) | 185 | bb.utils.mkdirhier(d.getVar("B")) |
| 191 | 186 | ||
| 192 | bb.build.exec_func("do_unpack", d) | 187 | bb.build.exec_func("do_unpack", d) |
| 193 | # Copy source of kernel to spdx_workdir | 188 | |
| 189 | if d.getVar("SRC_URI") != "": | ||
| 190 | bb.build.exec_func("do_patch", d) | ||
| 191 | |||
| 192 | # Copy source from work-share to spdx_workdir | ||
| 194 | if is_work_shared_spdx(d): | 193 | if is_work_shared_spdx(d): |
| 195 | share_src = d.getVar("WORKDIR") | 194 | share_src = d.getVar('S') |
| 196 | d.setVar("WORKDIR", spdx_workdir) | 195 | d.setVar("WORKDIR", spdx_workdir) |
| 197 | d.setVar("STAGING_DIR_NATIVE", spdx_sysroot_native) | 196 | d.setVar("STAGING_DIR_NATIVE", spdx_sysroot_native) |
| 197 | # Copy source to ${SPDXWORK}, same basename dir of ${S}; | ||
| 198 | src_dir = ( | 198 | src_dir = ( |
| 199 | spdx_workdir | 199 | spdx_workdir |
| 200 | + "/" | 200 | + "/" |
| 201 | + d.getVar("PN") | 201 | + os.path.basename(share_src) |
| 202 | + "-" | ||
| 203 | + d.getVar("PV") | ||
| 204 | + "-" | ||
| 205 | + d.getVar("PR") | ||
| 206 | ) | 202 | ) |
| 207 | bb.utils.mkdirhier(src_dir) | 203 | # For kernel souce, rename suffix dir 'kernel-source' |
| 204 | # to ${BP} (${BPN}-${PV}) | ||
| 208 | if bb.data.inherits_class("kernel", d): | 205 | if bb.data.inherits_class("kernel", d): |
| 209 | share_src = d.getVar("STAGING_KERNEL_DIR") | 206 | src_dir = spdx_workdir + "/" + d.getVar('BP') |
| 210 | cmd_copy_share = "cp -rf " + share_src + "/* " + src_dir + "/" | 207 | |
| 211 | cmd_copy_shared_res = os.popen(cmd_copy_share).read() | 208 | bb.note(f"copyhardlinktree {share_src} to {src_dir}") |
| 212 | bb.note("cmd_copy_shared_result = " + cmd_copy_shared_res) | 209 | oe.path.copyhardlinktree(share_src, src_dir) |
| 213 | |||
| 214 | git_path = src_dir + "/.git" | ||
| 215 | if os.path.exists(git_path): | ||
| 216 | shutils.rmtree(git_path) | ||
| 217 | |||
| 218 | # Make sure gcc and kernel sources are patched only once | ||
| 219 | if not (d.getVar("SRC_URI") == "" or is_work_shared_spdx(d)): | ||
| 220 | bb.build.exec_func("do_patch", d) | ||
| 221 | 210 | ||
| 222 | # Some userland has no source. | 211 | # Some userland has no source. |
| 223 | if not os.path.exists(spdx_workdir): | 212 | if not os.path.exists(spdx_workdir): |
