diff options
Diffstat (limited to 'classes/spdx-common.bbclass')
-rw-r--r-- | classes/spdx-common.bbclass | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/classes/spdx-common.bbclass b/classes/spdx-common.bbclass index c074da4..9fe40f6 100644 --- a/classes/spdx-common.bbclass +++ b/classes/spdx-common.bbclass @@ -15,8 +15,13 @@ SPDXEPENDENCY += " tar-native:do_populate_sysroot" SPDX_DEPLOY_DIR ??= "${DEPLOY_DIR}/spdx" SPDX_TOPDIR ?= "${WORKDIR}/spdx_sstate_dir" -SPDX_OUTDIR = "${SPDX_TOPDIR}/${TARGET_SYS}/${PF}/" -SPDX_WORKDIR = "${WORKDIR}/spdx_temp/" +SPDX_OUTDIR ?= "${SPDX_TOPDIR}/${TARGET_SYS}/${PF}/" +SPDX_WORKDIR ?= "${WORKDIR}/spdx_temp/" + +SPDX_EXCLUDE_NATIVE ??= "1" +SPDX_EXCLUDE_SDK ??= "1" +SPDX_EXCLUDE_PACKAGES ??= "" + do_spdx[dirs] = "${WORKDIR}" @@ -28,6 +33,38 @@ SPDX_S ?= "${S}" addtask do_spdx before do_configure after do_patch +# Exclude package based on variables. +# SPDX_EXCLUDE_NATIVE ??= "1" +# SPDX_EXCLUDE_SDK ??= "1" +# SPDX_EXCLUDE_PACKAGES ??= "" +def excluded_package(d, pn): + assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split() + if pn in assume_provided: + for p in d.getVar("PROVIDES").split(): + if p != pn: + pn = p + break + if d.getVar('BPN') in ['gcc', 'libgcc']: + #bb.debug(1, 'spdx: There is a bug in the scan of %s, skip it.' % pn) + return True + # The following: do_fetch, do_unpack and do_patch tasks have been deleted, + # so avoid archiving do_spdx here. + # -native is for the host aka during the build + if pn.endswith('-native') and d.getVar("SPDX_EXCLUDE_NATIVE") == "1": + return True + # nativesdk- is for the developer SDK + if pn.startswith('nativesdk-') and d.getVar("SPDX_EXCLUDE_SDK") == "1": + return True + # packagegroups have no files to scan + if pn.startswith('packagegroup'): + return True + if pn.startswith('glibc-locale'): + return True + for p in d.getVar("SPDX_EXCLUDE_PACKAGES").split(): + if p in pn: + return True + return False + def exclude_useless_paths(tarinfo): if tarinfo.isdir(): if tarinfo.name.endswith('/temp') or tarinfo.name.endswith('/patches') or tarinfo.name.endswith('/.pc'): |