Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kirkstone patch provided by Baxter #12

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions classes/fossa.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ do_fossa_archive[rdeptask] += "do_patch"
# This task runs after the `do_patch` task.
#
# The `do_patch` task is executed for each package in the build; in this way
# `do_fossa_archive` is able to save the package information and source code
# `do_fossa_archive` is able to save the package information and source code
# for every package that goes into the build.
#
# The temporary files containing this metadata are then combined into a
Expand Down Expand Up @@ -84,22 +84,27 @@ python do_fossa_pkg() {
python do_fossa() {
if not is_fossa_enabled(d):
bb.debug(1, "Since FOSSA_ENABLED is 0, skipping: creating fossa-deps.json")
return
return

import errno
import os
import json
import glob

metadata_dir = d.getVar('FOSSA_METADATA_RECIPES')
pkg_metadata = all_pkg_metadata(d, metadata_dir)

installed_pkgs = []
for pkg in pkg_metadata:

for ignored_suffix in (d.getVar("SPECIAL_PKGSUFFIX") or "").split():
if pkg.endswith(ignored_suffix):
pass

try:
installed_pkgs.append(mk_user_dependencies(pkg_metadata[pkg]))
except Exception as err:
bb.error(f'failed to retrieve pkg metadata for {pkg} because: {err}')
except Exception:
pass

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

with open(fossa_deps_path, 'w+') as fd:
json.dump(fossa_deps_dict, fd, indent=4, sort_keys=False)

with open(fossa_deps_raw, 'w+') as fr:
json.dump(pkg_metadata, fr, indent=4, sort_keys=False)

bb.debug(1, "Wrote fossa-deps at: {fossa_deps_path}")
}

Expand Down
12 changes: 7 additions & 5 deletions classes/fossa_upload.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ inherit fossa_utils
addtask do_fossa_analyze before do_build after do_rootfs
do_fossa_analyze[doc] = "Analyze via fossa-cli"
do_fossa_analyze[nostamp] = "1"
do_fossa_analyze[depends] = "fossa-cli:do_populate_sysroot"
do_fossa_analyze[network] = "1"
do_fossa_analyze[depends] = "fossa-cli-native:do_populate_sysroot"

addtask do_fossa_test before do_build after do_fossa_analyze
do_fossa_test[doc] = "Test via fossa-cli"
do_fossa_test[nostamp] = "1"
do_fossa_test[deptask] += "fossa-cli:do_populate_sysroot"
do_fossa_test[network] = "1"
do_fossa_test[deptask] += "fossa-cli-native:do_populate_sysroot"

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

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

out = subprocess.run(cmds, cwd=d.getVar("FOSSA_STAGING_DIR"), capture_output=True, text=True, shell=False)
Expand Down
2 changes: 2 additions & 0 deletions recipes-extended/fossa/fossa-cli.bb
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ do_install() {
}

INSANE_SKIP_${PN}:append = "already-stripped"

BBCLASSEXTEND = "native"
Loading