From 3c26a4805c35fac97adfc45b85eff051ca7d3312 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 4 Jun 2026 22:08:24 +0200 Subject: sbom: T8542: bugfix shadowing cmd() function with cmd variable name Commit 75a495b237 ("sbom: T8542: create during ISO assembly") will shadow any subsequent calls to vyos.utils.process.cmd() as cmd has be redefined as variable to hold the CLI command strings for SBOM generation using the syft binary. This has been fixed by replacing the cmd variable with another name syft_cmd. --- scripts/image-build/build-vyos-image | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/image-build/build-vyos-image b/scripts/image-build/build-vyos-image index 79431eb1..b181a6e4 100755 --- a/scripts/image-build/build-vyos-image +++ b/scripts/image-build/build-vyos-image @@ -730,16 +730,16 @@ Pin-Priority: 600 syft_target_dir = 'chroot' syft_base_path = os.getcwd() + f'/{syft_target_dir}' base_filename = iso_file.rstrip('.iso') - cmd = [['syft', syft_target_dir, - '--source-name', 'VyOS', '--source-version', version, - '-o', f'cyclonedx-json={base_filename}.cdx.json', - '-o', f'spdx-json={base_filename}.spdx.json']] + syft_cmd = [['syft', syft_target_dir, + '--source-name', 'VyOS', '--source-version', version, + '-o', f'cyclonedx-json={base_filename}.cdx.json', + '-o', f'spdx-json={base_filename}.spdx.json']] # syft bug for CycloneDX https://github.com/anchore/syft/issues/4592#issuecomment-4567247328 - cmd.append(['sed', '-i', '-e', f's@{syft_base_path}@@g', f'{base_filename}.cdx.json']) - cmd.append(['sed', '-i', '-e', f's@{syft_base_path}@//@g', f'{base_filename}.spdx.json']) + syft_cmd.append(['sed', '-i', '-e', f's@{syft_base_path}@@g', f'{base_filename}.cdx.json']) + syft_cmd.append(['sed', '-i', '-e', f's@{syft_base_path}@//@g', f'{base_filename}.spdx.json']) - for c in cmd: + for c in syft_cmd: with subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1) as p: for line in p.stdout: -- cgit v1.2.3