Skip to content

Commit 2ffe673

Browse files
ryanlinkryan linkspatten
authored
Kirkstone patch provided by Baxter (#12)
* Applied kirkstone patch for FOSSA integration * Apply new patch to kirkstone-patch-new * remove duplicated line and unnecessary import --------- Co-authored-by: ryan link <[email protected]> Co-authored-by: spatten <[email protected]>
1 parent 1ec388f commit 2ffe673

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

classes/fossa.bbclass

+12-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ do_fossa_archive[rdeptask] += "do_patch"
1414
# This task runs after the `do_patch` task.
1515
#
1616
# The `do_patch` task is executed for each package in the build; in this way
17-
# `do_fossa_archive` is able to save the package information and source code
17+
# `do_fossa_archive` is able to save the package information and source code
1818
# for every package that goes into the build.
1919
#
2020
# The temporary files containing this metadata are then combined into a
@@ -84,22 +84,27 @@ python do_fossa_pkg() {
8484
python do_fossa() {
8585
if not is_fossa_enabled(d):
8686
bb.debug(1, "Since FOSSA_ENABLED is 0, skipping: creating fossa-deps.json")
87-
return
87+
return
8888

8989
import errno
9090
import os
9191
import json
9292
import glob
93-
93+
9494
metadata_dir = d.getVar('FOSSA_METADATA_RECIPES')
9595
pkg_metadata = all_pkg_metadata(d, metadata_dir)
9696

9797
installed_pkgs = []
9898
for pkg in pkg_metadata:
99+
100+
for ignored_suffix in (d.getVar("SPECIAL_PKGSUFFIX") or "").split():
101+
if pkg.endswith(ignored_suffix):
102+
pass
103+
99104
try:
100105
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}')
106+
except Exception:
107+
pass
103108

104109
# Ensure path exists
105110
fossa_deps_dir = d.getVar("FOSSA_STAGING_DIR")
@@ -114,10 +119,10 @@ python do_fossa() {
114119

115120
with open(fossa_deps_path, 'w+') as fd:
116121
json.dump(fossa_deps_dict, fd, indent=4, sort_keys=False)
117-
122+
118123
with open(fossa_deps_raw, 'w+') as fr:
119124
json.dump(pkg_metadata, fr, indent=4, sort_keys=False)
120-
125+
121126
bb.debug(1, "Wrote fossa-deps at: {fossa_deps_path}")
122127
}
123128

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)