Skip to content

[Bug] - [gen-build-spec command raises an error when the build tool is not supported] #1302

@behnazh-w

Description

@behnazh-w

Description

When attempting to generate a build spec with Macaron and the provided purl type does not correspond to a supported build tool, Macaron raises an exception instead of gracefully handling the unsupported tool.

Steps to Reproduce

run_macaron.sh analyze -purl pkg:maven/org.jetbrains.kotlin/kotlin-stdlib@1.9.25
run_macaron.sh gen-build-spec -purl pkg:maven/org.jetbrains.kotlin/kotlin-stdlib@1.9.25 --database output/macaron.db

Expected Behavior

Exit gracefully when build tool is not supported.

Actual Behavior

The resulting error traceback is as follows:

  File "/.venv/lib64/python3.12/site-packages/macaron/build_spec_generator/common_spec/core.py", line 384, in gen_generic_build_spec
    ECOSYSTEMS[purl.type.upper()].value(base_build_spec_dict).resolve_fields(purl)
  File "/.venv/lib64/python3.12/site-packages/macaron/build_spec_generator/common_spec/maven_spec.py", line 122, in resolve_fields
    patched_build_commands = patch_commands(
                             ^^^^^^^^^^^^^^^
  File "/.venv/lib64/python3.12/site-packages/macaron/build_spec_generator/build_command_patcher.py", line 164, in patch_commands
    patch_cli_commands = _patch_commands(
                         ^^^^^^^^^^^^^^^^
  File "/.venv/lib64/python3.12/site-packages/macaron/build_spec_generator/build_command_patcher.py", line 89, in _patch_commands
    if cli_parser.is_build_tool(cmds[0]):

Debug Information

Macaron 0.20.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbuild_spec_generationRelated to the build spec generation feature.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions