Skip to content

Comments

Fix invalid SPDX expressions for license exceptions to use WITH operator#4762

Open
dikshaa2909 wants to merge 1 commit intoaboutcode-org:developfrom
dikshaa2909:fix-spdx-exception-expressions-4623
Open

Fix invalid SPDX expressions for license exceptions to use WITH operator#4762
dikshaa2909 wants to merge 1 commit intoaboutcode-org:developfrom
dikshaa2909:fix-spdx-exception-expressions-4623

Conversation

@dikshaa2909
Copy link

Fixes #4623

Description

ScanCode was generating invalid SPDX license expressions when combining licenses with their exceptions. According to SPDX specification, exceptions must be combined with licenses using the WITH operator, not AND.

Before:

"detected_license_expression_spdx": "GPL-3.0-only AND GCC-exception-3.1"

After:

"detected_license_expression_spdx": "GPL-3.0-only WITH GCC-exception-3.1"

Changes

  • Added combine_expressions_with_exception_handling() function to detect when a license is paired with an exception and combine them using WITH instead of AND
  • Modified get_detected_license_expression() to use the new function
  • Added test case test_gpl_with_gcc_exception_uses_with_operator() to verify the fix

Testing

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue above
  • Tests pass
  • Commits are in uniquely-named feature branch and has no merge conflicts
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Fixes aboutcode-org#4623

Signed-off-by: dikshaa2909 <dikshadeware@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid SPDX expressions for license exceptions

1 participant