Skip to content

Commit 1378669

Browse files
pdgendtkartben
authored andcommitted
scripts: west_command: spdx: Exit with non-zero code on failure
If the init or the generation fails, the resulting exit code should be non-zero. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 4e201f2 commit 1378669

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/west_commands/spdx.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ def do_run_init(self, args):
7474
if query_ready:
7575
self.inf("initialized; run `west build` then run `west spdx`")
7676
else:
77-
self.err("Couldn't create CMake file-based API query directory")
78-
self.err("You can manually create an empty file at $BUILDDIR/.cmake/api/v1/query/codemodel-v2")
77+
self.die("Couldn't create CMake file-based API query directory\n"
78+
"You can manually create an empty file at "
79+
"$BUILDDIR/.cmake/api/v1/query/codemodel-v2")
7980

8081
def do_run_spdx(self, args):
8182
if not args.build_dir:
@@ -110,4 +111,5 @@ def do_run_spdx(self, args):
110111
# create the directory
111112
os.makedirs(cfg.spdxDir, exist_ok=False)
112113

113-
makeSPDX(cfg)
114+
if not makeSPDX(cfg):
115+
self.die("Failed to create SPDX output")

0 commit comments

Comments
 (0)