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

Cabal complains about "unexpected Unknown SPDX license identifier" #176

Open
sjakobi opened this issue Jul 17, 2019 · 6 comments
Open

Cabal complains about "unexpected Unknown SPDX license identifier" #176

sjakobi opened this issue Jul 17, 2019 · 6 comments

Comments

@sjakobi
Copy link
Contributor

sjakobi commented Jul 17, 2019

Given

let GitHub-project =
      https://raw.githubusercontent.com/ocharles/dhall-to-cabal/1.3.4.0/dhall/utils/GitHub-project.dhall

let types =
      https://raw.githubusercontent.com/ocharles/dhall-to-cabal/1.3.4.0/dhall/types.dhall

let prelude =
      https://raw.githubusercontent.com/ocharles/dhall-to-cabal/1.3.4.0/dhall/prelude.dhall

in    GitHub-project { owner = "sjakobi", repo = "repro" }
    ⫽ { license = types.License.BSD3, version = prelude.v "0" }

dhall-to-cabal-1.3.4.0 produces a cabal file, about which cabal complains:

$ cabal check
Warning: repro.cabal:13:14:
unexpected Unknown SPDX license identifier: 'BSD3' Do you mean BSD-3-Clause?
Errors encountered when parsing cabal file ./repro.cabal:

repro.cabal:13:14: error:
unexpected Unknown SPDX license identifier: 'BSD3' Do you mean BSD-3-Clause?

   12 | version: 0
   13 | license: BSD3
      |              ^
cabal: parse error
@sjakobi
Copy link
Contributor Author

sjakobi commented Jul 17, 2019

Ah, apparently the licence identifier syntax depends on the Cabal version: haskell/cabal#5109.

@ocharles
Copy link
Member

ocharles commented Jul 17, 2019

Which Cabal version do you have? I'm surprised cabal didn't reject it based on cabal-version.

@sjakobi
Copy link
Contributor Author

sjakobi commented Jul 17, 2019

I think I tried both with cabal-2.4 and a recentish master.

@sjakobi
Copy link
Contributor Author

sjakobi commented Jul 17, 2019

Ah, apparently the licence identifier syntax depends on the Cabal version: haskell/cabal#5109.

So these combinations are ok:

cabal-version: 2.0
license: BSD3
cabal-version: 2.2
license: BSD-3-Clause

This one isn't:

cabal-version: 2.2
licence: BSD3

This one does parse, but the license isn't recognized:

cabal-version: 2.0
licence: BSD-3-Clause

@quasicomputational
Copy link
Collaborator

Yeah, this is a genuine wart; #100 was prompted by the same issue.

It comes down to that we can create a GenericPackageDescription that Cabal actually considers to be somehow invalid; we can maybe do better by offering Package_v2_2 and Package_v2_0 as separate branches of a sum, the former only accepting SPDX and the latter not. I'm not sure it's worth the complexity.

@sjakobi
Copy link
Contributor Author

sjakobi commented Jul 18, 2019

Is compatibility with Cabal < 2.2 an important concern for this project? Maybe it would be easier to just remove the legacy licence types.

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

No branches or pull requests

3 participants