Skip to content

Commit 2d0b0c9

Browse files
author
ryan link
committed
Applied kirkstone patch for FOSSA integration
1 parent 1ec388f commit 2d0b0c9

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

classes/fossa.bbclass

+6-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ python do_fossa_pkg() {
8282
# this way it is able to capture the output of `do_fossa_pkg` for every
8383
# package that was processed.
8484
python do_fossa() {
85+
from oe.rootfs import image_list_installed_packages
86+
8587
if not is_fossa_enabled(d):
8688
bb.debug(1, "Since FOSSA_ENABLED is 0, skipping: creating fossa-deps.json")
8789
return
@@ -93,13 +95,14 @@ python do_fossa() {
9395

9496
metadata_dir = d.getVar('FOSSA_METADATA_RECIPES')
9597
pkg_metadata = all_pkg_metadata(d, metadata_dir)
98+
pkgs = image_list_installed_packages(d)
9699

97100
installed_pkgs = []
98-
for pkg in pkg_metadata:
101+
for pkg in pkgs:
99102
try:
100103
installed_pkgs.append(mk_user_dependencies(pkg_metadata[pkg]))
101-
except Exception as err:
102-
bb.error(f'failed to retrieve pkg metadata for {pkg} because: {err}')
104+
except Exception:
105+
pass
103106

104107
# Ensure path exists
105108
fossa_deps_dir = d.getVar("FOSSA_STAGING_DIR")

classes/fossa_upload.bbclass

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ inherit fossa_utils
66
addtask do_fossa_analyze before do_build after do_rootfs
77
do_fossa_analyze[doc] = "Analyze via fossa-cli"
88
do_fossa_analyze[nostamp] = "1"
9-
do_fossa_analyze[depends] = "fossa-cli:do_populate_sysroot"
109
do_fossa_analyze[network] = "1"
10+
do_fossa_analyze[depends] = "fossa-cli-native:do_populate_sysroot"
1111

1212
addtask do_fossa_test before do_build after do_fossa_analyze
1313
do_fossa_test[doc] = "Test via fossa-cli"
1414
do_fossa_test[nostamp] = "1"
15-
do_fossa_test[deptask] += "fossa-cli:do_populate_sysroot"
1615
do_fossa_test[network] = "1"
16+
do_fossa_test[deptask] += "fossa-cli-native:do_populate_sysroot"
1717

18-
# This task runs `fossa-cli` against the `fossa-deps` file generated by `fossa:do_fossa`,
18+
# This task runs `fossa-cli-native` against the `fossa-deps` file generated by `fossa:do_fossa`,
1919
# analyzing the file and storing its results in the FOSSA backend.
2020
#
2121
# This task is run after `do_rootfs` is finalized (`fossa:do_fossa` runs as a post-processing
@@ -56,8 +56,10 @@ def run_fossa_cli(d, cli_args):
5656
BINDIR = d.getVar("bindir")
5757
WORKDIR = d.getVar("WORKDIR")
5858

59-
cli_path = (f"{WORKDIR}/recipe-sysroot{BINDIR}/fossa")
60-
cmds = [cli_path] + cli_args
59+
# We don't need to specify the whole path here. The sysroot-native
60+
# directory is already in our PATH.
61+
fossa_cli = ("fossa")
62+
cmds = [fossa_cli] + cli_args
6163
bb.plain(f"running: {' '.join(cmds)}")
6264

6365
out = subprocess.run(cmds, cwd=d.getVar("FOSSA_STAGING_DIR"), capture_output=True, text=True, shell=False)

recipes-extended/fossa/fossa-cli.bb

+2
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ do_install() {
3838
}
3939

4040
INSANE_SKIP_${PN}:append = "already-stripped"
41+
42+
BBCLASSEXTEND = "native"

0 commit comments

Comments
 (0)