Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 134 additions & 54 deletions Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs

Large diffs are not rendered by default.

1,121 changes: 789 additions & 332 deletions Cabal-syntax/src/Distribution/SPDX/LicenseId.hs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ data LicenseListVersion
LicenseListVersion_3_25
| -- | @since 3.16.0.0
LicenseListVersion_3_26
| -- | @since 3.18.0.0
LicenseListVersion_3_28
deriving (Eq, Ord, Show, Enum, Bounded)

cabalSpecVersionToSPDXListVersion :: CabalSpecVersion -> LicenseListVersion
cabalSpecVersionToSPDXListVersion CabalSpecV3_18 = LicenseListVersion_3_28
cabalSpecVersionToSPDXListVersion CabalSpecV3_16 = LicenseListVersion_3_26
cabalSpecVersionToSPDXListVersion CabalSpecV3_14 = LicenseListVersion_3_25
cabalSpecVersionToSPDXListVersion CabalSpecV3_12 = LicenseListVersion_3_23
Expand Down
6 changes: 3 additions & 3 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tests = testGroup "Distribution.Utils.Structured"
[ testCase "VersionRange" $
md5Check (Proxy :: Proxy VersionRange) 0x39396fc4f2d751aaa1f94e6d843f03bd
, testCase "SPDX.License" $
md5Check (Proxy :: Proxy License) 0xf90ab6c2e4ffbc71b2e8c12531e50356
md5Check (Proxy :: Proxy License) 0x2804cd5d2137508059c16ac2449741d2
-- The difference is in encoding of newtypes
, testCase "GenericPackageDescription" $ md5CheckGenericPackageDescription (Proxy :: Proxy GenericPackageDescription)
, testCase "LocalBuildInfo" $ md5CheckLocalBuildInfo (Proxy :: Proxy LocalBuildInfo)
Expand All @@ -29,8 +29,8 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int

md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion
md5CheckGenericPackageDescription proxy = md5Check proxy
0xfd3ceefd3ccba5b23fa3688aefb363a9
0xfbca1c1f2a700fb3a174ec5346e86cbb

md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion
md5CheckLocalBuildInfo proxy = md5Check proxy
0x1bc2c98e507f9818275835dcf4dd2f12
0x3bf7bf1420847ce5fdaf6e36e33aecb2
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ SPDX_EXCEPTION_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs
.PHONY: spdx
spdx : $(SPDX_LICENSE_HS) $(SPDX_EXCEPTION_HS)

SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23 3.25 3.26
SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23 3.25 3.26 3.28

$(SPDX_LICENSE_HS) : templates/SPDX.LicenseId.template.hs cabal-dev-scripts/src/GenUtils.hs cabal-dev-scripts/src/GenSPDX.hs license-list-data/licenses-3.0.json license-list-data/licenses-3.2.json
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-spdx -- templates/SPDX.LicenseId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/licenses-%.json) $(SPDX_LICENSE_HS)
Expand Down
1 change: 1 addition & 0 deletions cabal-dev-scripts/src/GenSPDX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ main = generate =<< O.execParser opts where
<*> licenses "3.23"
<*> licenses "3.25"
<*> licenses "3.26"
<*> licenses "3.28"

template = O.strArgument $ mconcat
[ O.metavar "SPDX.LicenseId.template.hs"
Expand Down
1 change: 1 addition & 0 deletions cabal-dev-scripts/src/GenSPDXExc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ main = generate =<< O.execParser opts where
<*> licenses "3.23"
<*> licenses "3.25"
<*> licenses "3.26"
<*> licenses "3.28"

template = O.strArgument $ mconcat
[ O.metavar "SPDX.LicenseExceptionId.template.hs"
Expand Down
25 changes: 15 additions & 10 deletions cabal-dev-scripts/src/GenUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ data SPDXLicenseListVersion
| SPDXLicenseListVersion_3_23
| SPDXLicenseListVersion_3_25
| SPDXLicenseListVersion_3_26
| SPDXLicenseListVersion_3_28
deriving (Eq, Ord, Show, Enum, Bounded)

allVers :: Set.Set SPDXLicenseListVersion
allVers = Set.fromList [minBound .. maxBound]

prettyVer :: SPDXLicenseListVersion -> Text
prettyVer SPDXLicenseListVersion_3_28 = "SPDX License List 3.28"
prettyVer SPDXLicenseListVersion_3_26 = "SPDX License List 3.26"
prettyVer SPDXLicenseListVersion_3_25 = "SPDX License List 3.25"
prettyVer SPDXLicenseListVersion_3_23 = "SPDX License List 3.23"
Expand All @@ -50,6 +52,7 @@ prettyVer SPDXLicenseListVersion_3_2 = "SPDX License List 3.2"
prettyVer SPDXLicenseListVersion_3_0 = "SPDX License List 3.0"

suffixVer :: SPDXLicenseListVersion -> String
suffixVer SPDXLicenseListVersion_3_28 = "_3_28"
suffixVer SPDXLicenseListVersion_3_26 = "_3_26"
suffixVer SPDXLicenseListVersion_3_25 = "_3_25"
suffixVer SPDXLicenseListVersion_3_23 = "_3_23"
Expand All @@ -64,23 +67,24 @@ suffixVer SPDXLicenseListVersion_3_0 = "_3_0"
-- Per version
-------------------------------------------------------------------------------

data PerV a = PerV a a a a a a a a a
data PerV a = PerV a a a a a a a a a a
deriving (Show, Functor, Foldable, Traversable)

class Functor f => Representable i f | f -> i where
index :: i -> f a -> a
tabulate :: (i -> a) -> f a

instance Representable SPDXLicenseListVersion PerV where
index SPDXLicenseListVersion_3_0 (PerV x _ _ _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_2 (PerV _ x _ _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_6 (PerV _ _ x _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_9 (PerV _ _ _ x _ _ _ _ _) = x
index SPDXLicenseListVersion_3_10 (PerV _ _ _ _ x _ _ _ _) = x
index SPDXLicenseListVersion_3_16 (PerV _ _ _ _ _ x _ _ _) = x
index SPDXLicenseListVersion_3_23 (PerV _ _ _ _ _ _ x _ _) = x
index SPDXLicenseListVersion_3_25 (PerV _ _ _ _ _ _ _ x _) = x
index SPDXLicenseListVersion_3_26 (PerV _ _ _ _ _ _ _ _ x) = x
index SPDXLicenseListVersion_3_0 (PerV x _ _ _ _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_2 (PerV _ x _ _ _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_6 (PerV _ _ x _ _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_9 (PerV _ _ _ x _ _ _ _ _ _) = x
index SPDXLicenseListVersion_3_10 (PerV _ _ _ _ x _ _ _ _ _) = x
index SPDXLicenseListVersion_3_16 (PerV _ _ _ _ _ x _ _ _ _) = x
index SPDXLicenseListVersion_3_23 (PerV _ _ _ _ _ _ x _ _ _) = x
index SPDXLicenseListVersion_3_25 (PerV _ _ _ _ _ _ _ x _ _) = x
index SPDXLicenseListVersion_3_26 (PerV _ _ _ _ _ _ _ _ x _) = x
index SPDXLicenseListVersion_3_28 (PerV _ _ _ _ _ _ _ _ _ x) = x

tabulate f = PerV
(f SPDXLicenseListVersion_3_0)
Expand All @@ -92,6 +96,7 @@ instance Representable SPDXLicenseListVersion PerV where
(f SPDXLicenseListVersion_3_23)
(f SPDXLicenseListVersion_3_25)
(f SPDXLicenseListVersion_3_26)
(f SPDXLicenseListVersion_3_28)

-------------------------------------------------------------------------------
-- Sorting
Expand Down
9 changes: 9 additions & 0 deletions changelog.d/pr-11978
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
synopsis: add SPDX license data version 3.28
packages: Cabal
prs: #11978

description: {

- Update SPDX license list to version 3.28.0 2026-02-20

}
12 changes: 12 additions & 0 deletions doc/file-format-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ relative to the respective preceding *published* version.
versions of the ``Cabal`` library denote unreleased development
branches which have no stability guarantee.

``cabal-version: 3.18``
-----------------------

* License fields use identifiers from SPDX License List version
``3.28 2026-02-20``.

``cabal-version: 3.16``
-----------------------

* License fields use identifiers from SPDX License List version
``3.26 2025-06-10``.

``cabal-version: 3.14``
-----------------------

Expand Down
Loading
Loading