Change license :: License to Either SPDX.License License
commitffbfafd6a0b5ee2558914bb792a9b6e5baf0aaba
authorOleg Grenrus <oleg.grenrus@iki.fi>
Sat, 16 Dec 2017 09:16:30 +0000 (16 11:16 +0200)
committerOleg Grenrus <oleg.grenrus@iki.fi>
Fri, 19 Jan 2018 23:47:58 +0000 (20 01:47 +0200)
tree4847c6824c2f0cc3528bea90f763e2ccd7c0afea
parent6e10c7d9b0ae96b3a1ffb1368773e0774598bdc3
Change license :: License to Either SPDX.License License

Resolves #2547

I introduce SimpleLicenseExpression to make "OrAnyLater LicenseRef"
unrepresentable. That also simplifies types.

license field is parsed as old `License` when cabal-version <2.2,
and as SPDX expression otherwise. `NONE` is recognised.

There are best-effort functions to convert between `License` and
`SPDX.License`.

There are also IPI changes: parser accepts both `License` and
`SPDX.License`, as both can occur in package database. Cabal will
`register` a SDPX expression as `license` for GHC >= 8.4, and legacy
`License` for other (we are smart when converting `PackageDescription` +
LBI and other data to `InstalledPackageInfo`)

Also add NFData InstalledPackageInfo
56 files changed:
Cabal/Distribution/License.hs
Cabal/Distribution/PackageDescription.hs
Cabal/Distribution/PackageDescription/Check.hs
Cabal/Distribution/PackageDescription/FieldGrammar.hs
Cabal/Distribution/PackageDescription/Parse.hs
Cabal/Distribution/Parsec/Newtypes.hs
Cabal/Distribution/SPDX.hs
Cabal/Distribution/SPDX/License.hs
Cabal/Distribution/SPDX/LicenseExpression.hs
Cabal/Distribution/SPDX/LicenseReference.hs
Cabal/Distribution/Simple/GHC/IPIConvert.hs
Cabal/Distribution/Simple/Register.hs
Cabal/Distribution/Types/AbiDependency.hs
Cabal/Distribution/Types/AbiHash.hs
Cabal/Distribution/Types/ExposedModule.hs
Cabal/Distribution/Types/InstalledPackageInfo.hs
Cabal/Distribution/Types/InstalledPackageInfo/FieldGrammar.hs
Cabal/Distribution/Types/InstalledPackageInfo/Lens.hs
Cabal/Distribution/Types/PackageDescription.hs
Cabal/Distribution/Types/PackageDescription/Lens.hs
Cabal/tests/Instances/TreeDiff.hs
Cabal/tests/Instances/TreeDiff/SPDX.hs
Cabal/tests/ParserHackageTests.hs
Cabal/tests/ParserTests.hs
Cabal/tests/ParserTests/ipi/Includes2.expr
Cabal/tests/ParserTests/ipi/internal-preprocessor-test.expr
Cabal/tests/ParserTests/ipi/issue-2276-ghc-9885.expr
Cabal/tests/ParserTests/ipi/transformers.expr
Cabal/tests/ParserTests/regressions/Octree-0.5.expr
Cabal/tests/ParserTests/regressions/common.expr
Cabal/tests/ParserTests/regressions/common2.expr
Cabal/tests/ParserTests/regressions/elif.expr
Cabal/tests/ParserTests/regressions/elif2.expr
Cabal/tests/ParserTests/regressions/encoding-0.8.expr
Cabal/tests/ParserTests/regressions/generics-sop.expr
Cabal/tests/ParserTests/regressions/issue-774.check
Cabal/tests/ParserTests/regressions/issue-774.expr
Cabal/tests/ParserTests/regressions/leading-comma.expr
Cabal/tests/ParserTests/regressions/nothing-unicode.check
Cabal/tests/ParserTests/regressions/nothing-unicode.expr
Cabal/tests/ParserTests/regressions/shake.expr
Cabal/tests/ParserTests/regressions/th-lift-instances.expr
Cabal/tests/ParserTests/regressions/wl-pprint-indef.expr
Cabal/tests/UnitTests/Distribution/SPDX.hs
cabal-install/Distribution/Client/List.hs
cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs
cabal-testsuite/PackageTests/COnlyMain/my.cabal
cabal-testsuite/PackageTests/SPDX/M.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/Setup.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/cabal-old-build.cabal.out [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/cabal-old-build.out [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/cabal-old-build.test.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/cabal.project [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/cabal.test.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/SPDX/my.cabal [new file with mode: 0644]
cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs