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

the license in *.cabal is not parsed correctly by cabal for some servant packages #1497

Closed
teto opened this issue Dec 21, 2021 · 3 comments · Fixed by #1498
Closed

the license in *.cabal is not parsed correctly by cabal for some servant packages #1497

teto opened this issue Dec 21, 2021 · 3 comments · Fixed by #1498
Assignees

Comments

@teto
Copy link
Contributor

teto commented Dec 21, 2021

while running cabal2nix on servant (to be able to reference the master version from nix), I hit the following issue:

cabal2nix: Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown licenseUnknownLicense "BSD-3"
Choose one of: GPL, GPL-2, GPL-3, LGPL, LGPL-2.1, LGPL-3, AGPL, AGPL-3, BSD2, BSD3, MIT, ISC, MPL-2.0, Apache, Apache-2.0, PublicDomain, AllRightsReserved, OtherLicense
CallStack (from HasCallStack):
  error, called at src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs:46:62 in cabal2nix-2.18.0-inplace:Distribution.Nixpkgs.Haskell.FromCabal.License

I first thought this was a cabal2nix issue but a few debug statements later, I think it's servant that incorrectly specifies its license. Cabal supports two types of licenses, native and SPDX, which can be seen here https://hackage.haskell.org/package/Cabal-3.6.2.0/docs/Distribution-Types-PackageDescription.html#v:licenseRaw

Several packages use BSD-3-Clause as a license, in conjonction with cabal-version: >=1.10 which cabal parses as Right (UnknownLicense "BSD-3").
If I change teh cabal-version to cabal-version: 2.2 , cabal correctly identifdies the license License (ELicense (ELicenseId BSD_3_Clause)).

Remediation:

  • either update cabal-version from >= 1.1. to 2.2
  • or change BSD-3-Clause to BSD3

My preference goes to the first solution (because SPDX is good) but the second doesn't need a bump in cabal-version.

I can provide a PR once a consensus is reached.

@tchoutri
Copy link
Contributor

@teto Hi, and thank for reporting this!
As a co-maintainer, my opinion is to specify 2.2 as the minimum version for Cabal files, but I'll ask the other @haskell-servant/maintainers for their opinion.

@alpmestan
Copy link
Contributor

I think it's reasonable.

@tchoutri
Copy link
Contributor

Fantastic.
@teto You may proceed with a PR, thank you very much for having noticed this.

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 a pull request may close this issue.

3 participants