Skip to content

Commit

Permalink
Update SPDX license list to version 3.25 (#10341)
Browse files Browse the repository at this point in the history
* Handle 3D Slicer licence

* Update SPDX license list to version 3.25

* Remove changelog entry

We don't need it, changes have been manually
incorporated in 3.14 release notes (#10338)

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ffaf1 and mergify[bot] authored Sep 16, 2024
1 parent 66d401b commit 55c61aa
Show file tree
Hide file tree
Showing 12 changed files with 10,014 additions and 324 deletions.
150 changes: 109 additions & 41 deletions Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs

Large diffs are not rendered by default.

941 changes: 670 additions & 271 deletions Cabal-syntax/src/Distribution/SPDX/LicenseId.hs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ data LicenseListVersion
| LicenseListVersion_3_10
| LicenseListVersion_3_16
| LicenseListVersion_3_23
| LicenseListVersion_3_25
deriving (Eq, Ord, Show, Enum, Bounded)

cabalSpecVersionToSPDXListVersion :: CabalSpecVersion -> LicenseListVersion
cabalSpecVersionToSPDXListVersion CabalSpecV3_14 = LicenseListVersion_3_23
cabalSpecVersionToSPDXListVersion CabalSpecV3_14 = LicenseListVersion_3_25
cabalSpecVersionToSPDXListVersion CabalSpecV3_12 = LicenseListVersion_3_23
cabalSpecVersionToSPDXListVersion CabalSpecV3_8 = LicenseListVersion_3_16
cabalSpecVersionToSPDXListVersion CabalSpecV3_6 = LicenseListVersion_3_10
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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
SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23 3.25

$(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 @@ -36,6 +36,7 @@ main = generate =<< O.execParser opts where
<*> licenses "3.10"
<*> licenses "3.16"
<*> licenses "3.23"
<*> licenses "3.25"

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 @@ -35,6 +35,7 @@ main = generate =<< O.execParser opts where
<*> licenses "3.10"
<*> licenses "3.16"
<*> licenses "3.23"
<*> licenses "3.25"

template = O.strArgument $ mconcat
[ O.metavar "SPDX.LicenseExceptionId.template.hs"
Expand Down
22 changes: 14 additions & 8 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_10
| SPDXLicenseListVersion_3_16
| SPDXLicenseListVersion_3_23
| SPDXLicenseListVersion_3_25
deriving (Eq, Ord, Show, Enum, Bounded)

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

prettyVer :: SPDXLicenseListVersion -> Text
prettyVer SPDXLicenseListVersion_3_25 = "SPDX License List 3.25"
prettyVer SPDXLicenseListVersion_3_23 = "SPDX License List 3.23"
prettyVer SPDXLicenseListVersion_3_16 = "SPDX License List 3.16"
prettyVer SPDXLicenseListVersion_3_10 = "SPDX License List 3.10"
Expand All @@ -48,6 +50,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_25 = "_3_25"
suffixVer SPDXLicenseListVersion_3_23 = "_3_23"
suffixVer SPDXLicenseListVersion_3_16 = "_3_16"
suffixVer SPDXLicenseListVersion_3_10 = "_3_10"
Expand All @@ -60,21 +63,22 @@ suffixVer SPDXLicenseListVersion_3_0 = "_3_0"
-- Per version
-------------------------------------------------------------------------------

data PerV a = PerV a a a a a a a
data PerV a = PerV 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_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

tabulate f = PerV
(f SPDXLicenseListVersion_3_0)
Expand All @@ -84,6 +88,7 @@ instance Representable SPDXLicenseListVersion PerV where
(f SPDXLicenseListVersion_3_10)
(f SPDXLicenseListVersion_3_16)
(f SPDXLicenseListVersion_3_23)
(f SPDXLicenseListVersion_3_25)

-------------------------------------------------------------------------------
-- Sorting
Expand Down Expand Up @@ -162,6 +167,7 @@ toConstructorName t = t
special :: Text -> Text
special "0BSD" = "NullBSD"
special "389_exception" = "DS389_exception"
special "3D_Slicer_1_0" = "X3D_Slicer_1_0"
special u = u

mkList :: [Text] -> Text
Expand Down
2 changes: 2 additions & 0 deletions doc/file-format-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ relative to the respective preceding *published* version.
* Added field ``extra-files`` for specifying extra files to be included in
``sdist`` without adding any other semantics (cf. ``extra-source-files``
is tracked by ``cabal build``).
* License fields use identifiers from SPDX License List version
``3.25 2024-08-19``.

``cabal-version: 3.12``
-----------------------
Expand Down
Loading

0 comments on commit 55c61aa

Please sign in to comment.