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

fix: properly declare licenses from environment #417

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

jkowalleck
Copy link
Member

@jkowalleck jkowalleck commented Sep 16, 2022

current implementation uses SPDX license expressions for everything, instead of using license with name or wth spdx ids
this caused broken results.

better: use license with name for everything, as this cannot cause any malformed result.
Here is the fix.

closes #410

@jkowalleck jkowalleck added the bug Something isn't working label Sep 16, 2022
@jkowalleck jkowalleck requested a review from a team as a code owner September 16, 2022 17:26
if str(classifier).startswith('License :: OSI Approved :: '):
c.licenses.add(
LicenseChoice(
license_expression=str(classifier).replace('License :: OSI Approved :: ', '').strip()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a SPDX license expression like Mozilla Public License 1.0 (MPL) was NEVER valid.

@jkowalleck jkowalleck marked this pull request as draft September 16, 2022 17:34
@jkowalleck jkowalleck marked this pull request as ready for review September 16, 2022 17:49
@jkowalleck
Copy link
Member Author

@Jonas-vdb this should fix your issue, right?

@Jonas-vdb
Copy link

@jkowalleck Great to see this issue being picked up! Thanks.

If all the licenses are indeed named, it will be shown in Dependency track. Will be great improvement!

Small question: Looking at the code, it seems we now always use named licenses and never SPDX IDs? Some licenses will probably match a SPDX (e.g. MIT)?

@jkowalleck
Copy link
Member Author

jkowalleck commented Sep 19, 2022

Small question: Looking at the code, it seems we now always use named licenses and never SPDX IDs? Some licenses will probably match a SPDX (e.g. MIT)?
That is true.

Tried to come with the least invasive fix possible for an actual error (wrong use of expression).

A wholesome solution could be to use the new features from CycloneDX/cyclonedx-python-lib#305
which will be an entire new feature.
Feel free to open a new PR to introduce the feature.

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants