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

opam lint: Add support for the full SPDX license expression when checking the license #4768

Merged
merged 2 commits into from
Aug 10, 2021

Conversation

kit-ty-kate
Copy link
Member

@kit-ty-kate kit-ty-kate commented Jul 26, 2021

Fixes #4598 and #4747

Implementation details at https://github.com/kit-ty-kate/spdx_licenses

Currently during linting, opam checks that the license field is a valid SPDX license. However:

The best one can do is to use the list format to say un implicit AND/OR (e.g. license: ["MIT" "ISC"]) and simply ignore the warning when the license isn't supported.

This PR fixes all of those issues by allowing the complete SPDX license syntax: https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/
The syntax supports:

  • custom licenses (e.g. LicenseRef-custom-name)
  • AND, OR, parenthesis
  • ...

Compared to the current state, apart from the new feature added, this changes:

@rjbou rjbou added this to PR in progress in Opam 2.2.0 via automation Jul 26, 2021
@rjbou rjbou added this to the 2.2.0~alpha milestone Jul 26, 2021
@kit-ty-kate kit-ty-kate changed the title [DRAFT] Add a proper SPDX license parser to opam Add a proper SPDX license parser to opam Jul 27, 2021
@kit-ty-kate
Copy link
Member Author

kit-ty-kate commented Jul 27, 2021

This PR requires #4770 to be merged first. I've updated the description for a summary of the changes. This is ready to review.

Current checklist for merging this includes:

@rjbou rjbou added the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Jul 27, 2021
@kit-ty-kate kit-ty-kate moved this from PR in progress to PR to review in Opam 2.2.0 Jul 27, 2021
@kit-ty-kate kit-ty-kate marked this pull request as ready for review July 29, 2021 11:58
@kit-ty-kate kit-ty-kate removed the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Jul 29, 2021
@kit-ty-kate kit-ty-kate linked an issue Jul 29, 2021 that may be closed by this pull request
@kit-ty-kate kit-ty-kate changed the title Add a proper SPDX license parser to opam opam lint: Add support of the full SPDX license expression when checking the license Jul 29, 2021
@kit-ty-kate kit-ty-kate changed the title opam lint: Add support of the full SPDX license expression when checking the license opam lint: Add support for the full SPDX license expression when checking the license Jul 29, 2021
Copy link
Member

@AltGr AltGr left a comment

Choose a reason for hiding this comment

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

This is great, thanks !

Opam 2.2.0 automation moved this from PR to review to PR finalised Aug 10, 2021
@kit-ty-kate kit-ty-kate merged commit c8f8f74 into ocaml:master Aug 10, 2021
Opam 2.2.0 automation moved this from PR finalised to Done Aug 10, 2021
@kit-ty-kate kit-ty-kate deleted the spdx branch August 10, 2021 17:22
mooreryan added a commit to mooreryan/bio_io that referenced this pull request Mar 12, 2022
The current opam release cannot handle full SPDX license parsing.  Work around it for now by specifying licenses in a list.  See ocaml/opam#4768 for more info.
yawaramin added a commit to yawaramin/ocaml-decimal that referenced this pull request Jul 29, 2023
As opam<2.2.0 doesn't support PSF-2.0 license and only 2.1.5 is released
as non-alpha at the time of writing. Per
ocaml/opam#4768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.2.0
  
Done
3 participants