Skip to content

Commit

Permalink
Merge pull request #6663 from phadej/cabalspec-3.4
Browse files Browse the repository at this point in the history
Cabalspec 3.4
  • Loading branch information
phadej authored Apr 7, 2020
2 parents d4ebb69 + 7494da9 commit 95a6ee3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Cabal/Distribution/CabalSpecVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ data CabalSpecVersion
| CabalSpecV2_2
| CabalSpecV2_4
| CabalSpecV3_0
-- ^ we need this value for solver
-- to represent GPDs which it should skip
--
-- We could filter the files already in package reading phase,
-- but then files would be silently omitted.
-- 3.2: no changes
| CabalSpecV3_4
deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic)

instance Binary CabalSpecVersion
Expand All @@ -41,6 +38,7 @@ instance NFData CabalSpecVersion where rnf = genericRnf
--
-- @since 3.0.0.0
showCabalSpecVersion :: CabalSpecVersion -> String
showCabalSpecVersion CabalSpecV3_4 = "3.4"
showCabalSpecVersion CabalSpecV3_0 = "3.0"
showCabalSpecVersion CabalSpecV2_4 = "2.4"
showCabalSpecVersion CabalSpecV2_2 = "2.2"
Expand All @@ -58,14 +56,15 @@ showCabalSpecVersion CabalSpecV1_2 = "1.2"
showCabalSpecVersion CabalSpecV1_0 = "1.0"

cabalSpecLatest :: CabalSpecVersion
cabalSpecLatest = CabalSpecV3_0
cabalSpecLatest = CabalSpecV3_4

-- | Parse 'CabalSpecVersion' from version digits.
--
-- It may fail if for recent versions the version is not exact.
--
cabalSpecFromVersionDigits :: [Int] -> Maybe CabalSpecVersion
cabalSpecFromVersionDigits v
| v == [3,4] = Just CabalSpecV3_4
| v == [3,0] = Just CabalSpecV3_0
| v >= [3] = Nothing
| v >= [2,3] = Just CabalSpecV2_4
Expand All @@ -85,6 +84,7 @@ cabalSpecFromVersionDigits v

-- | @since 3.4.0.0
cabalSpecToVersionDigits :: CabalSpecVersion -> [Int]
cabalSpecToVersionDigits CabalSpecV3_4 = [3,4]
cabalSpecToVersionDigits CabalSpecV3_0 = [3,0]
cabalSpecToVersionDigits CabalSpecV2_4 = [2,4]
cabalSpecToVersionDigits CabalSpecV2_2 = [2,2]
Expand Down
1 change: 1 addition & 0 deletions Cabal/Distribution/SPDX/LicenseListVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data LicenseListVersion
deriving (Eq, Ord, Show, Enum, Bounded)

cabalSpecVersionToSPDXListVersion :: CabalSpecVersion -> LicenseListVersion
cabalSpecVersionToSPDXListVersion CabalSpecV3_4 = LicenseListVersion_3_8
cabalSpecVersionToSPDXListVersion CabalSpecV3_0 = LicenseListVersion_3_6
cabalSpecVersionToSPDXListVersion CabalSpecV2_4 = LicenseListVersion_3_2
cabalSpecVersionToSPDXListVersion _ = LicenseListVersion_3_0
6 changes: 6 additions & 0 deletions Cabal/doc/file-format-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ relative to the respective preceding *published* version.
versions of the ``Cabal`` library denote unreleased development
branches which have no stability guarantee.

``cabal-version: 3.4``
----------------------

* License fields use identifiers from SPDX License List version
``3.8 2020-02-09``

``cabal-version: 3.0``
----------------------

Expand Down
2 changes: 1 addition & 1 deletion Cabal/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ tests = testGroup "Distribution.Utils.Structured"
, testCase "SPDX.License" $ structureHash (Proxy :: Proxy License) @?= Fingerprint 0xd3d4a09f517f9f75 0xbc3d16370d5a853a
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
, testCase "LocalBuildInfo" $ structureHash (Proxy :: Proxy LocalBuildInfo) @?= Fingerprint 0xe0f5a6119058a02c 0x703cb61a72aa4564
, testCase "LocalBuildInfo" $ structureHash (Proxy :: Proxy LocalBuildInfo) @?= Fingerprint 0xe426ef7c5c6e25e8 0x79b156f0f3c58f79
#endif
]

0 comments on commit 95a6ee3

Please sign in to comment.