From a5309888fc0a33e511504c105907e8603a572143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9cate=20Moonlight?= Date: Thu, 19 May 2022 18:11:03 +0200 Subject: [PATCH] Add SPDX List v3.16 to LicenseListVersion and the file format changelog (#8135) --- .../Distribution/SPDX/LicenseExceptionId.hs | 22 +++ .../src/Distribution/SPDX/LicenseId.hs | 144 +++++++++++++++++- .../Distribution/SPDX/LicenseListVersion.hs | 2 + doc/file-format-changelog.rst | 3 + templates/SPDX.LicenseExceptionId.template.hs | 8 + templates/SPDX.LicenseId.template.hs | 10 +- 6 files changed, 187 insertions(+), 2 deletions(-) diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs index 1ed0c6443e9..d12fe05e615 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs @@ -255,6 +255,23 @@ licenseExceptionIdList LicenseListVersion_3_10 = , Universal_FOSS_exception_1_0 ] ++ bulkOfLicenses +licenseExceptionIdList LicenseListVersion_3_16 = + [ GPL_3_0_linking_exception + , GPL_3_0_linking_source_exception + , GPL_CC_1_0 + , LGPL_3_0_linking_exception + , LLVM_exception + , OCaml_LGPL_linking_exception + , OpenJDK_assembly_exception_1_0 + , PS_or_PDF_font_exception_20170817 + , Qt_GPL_exception_1_0 + , Qt_LGPL_exception_1_1 + , SHL_2_0 + , SHL_2_1 + , Swift_exception + , Universal_FOSS_exception_1_0 + ] + ++ bulkOfLicenses -- | Create a 'LicenseExceptionId' from a 'String'. mkLicenseExceptionId :: LicenseListVersion -> String -> Maybe LicenseExceptionId @@ -263,6 +280,7 @@ mkLicenseExceptionId LicenseListVersion_3_2 s = Map.lookup s stringLookup_3_2 mkLicenseExceptionId LicenseListVersion_3_6 s = Map.lookup s stringLookup_3_6 mkLicenseExceptionId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseExceptionId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 +mkLicenseExceptionId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 stringLookup_3_0 :: Map String LicenseExceptionId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ @@ -284,6 +302,10 @@ stringLookup_3_10 :: Map String LicenseExceptionId stringLookup_3_10 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ licenseExceptionIdList LicenseListVersion_3_10 +stringLookup_3_16 :: Map String LicenseExceptionId +stringLookup_3_16 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ + licenseExceptionIdList LicenseListVersion_3_16 + -- | License exceptions in all SPDX License lists bulkOfLicenses :: [LicenseExceptionId] bulkOfLicenses = diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs index 0bd678e6d49..6773f416bb0 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs @@ -1864,11 +1864,14 @@ licenseIdList LicenseListVersion_3_10 = , AGPL_1_0_or_later , Blessing , BlueOak_1_0_0 - , BSD_2_Clause_FreeBSD + , BSD_2_Clause_Views , BSD_3_Clause_Open_MPI , Bzip2_1_0_5 , CAL_1_0_Combined_Work_Exception , CAL_1_0 + , CC_BY_3_0_AT + , CC_BY_NC_ND_3_0_IGO + , CC_BY_SA_3_0_AT , CC_PDDC , CERN_OHL_1_1 , CERN_OHL_1_2 @@ -1877,7 +1880,21 @@ licenseIdList LicenseListVersion_3_10 = , CERN_OHL_W_2_0 , Copyleft_next_0_3_0 , Copyleft_next_0_3_1 + , EPICS , Etalab_2_0 + , GFDL_1_1_invariants_only + , GFDL_1_1_invariants_or_later + , GFDL_1_1_no_invariants_only + , GFDL_1_1_no_invariants_or_later + , GFDL_1_2_invariants_only + , GFDL_1_2_invariants_or_later + , GFDL_1_2_no_invariants_only + , GFDL_1_2_no_invariants_or_later + , GFDL_1_3_invariants_only + , GFDL_1_3_invariants_or_later + , GFDL_1_3_no_invariants_only + , GFDL_1_3_no_invariants_or_later + , GLWTPL , Hippocratic_2_1 , HPND_sell_variant , JPNIC @@ -1888,6 +1905,8 @@ licenseIdList LicenseListVersion_3_10 = , MulanPSL_1_0 , MulanPSL_2_0 , NCGL_UK_2_0 + , NIST_PD_fallback + , NIST_PD , NTP_0 , O_UDA_1_0 , ODC_By_1_0 @@ -1917,6 +1936,124 @@ licenseIdList LicenseListVersion_3_10 = , UCL_1_0 ] ++ bulkOfLicenses +licenseIdList LicenseListVersion_3_16 = + [ AGPL_1_0_only + , AGPL_1_0_or_later + , ANTLR_PD_fallback + , App_s2p + , Blessing + , BlueOak_1_0_0 + , BSD_2_Clause_Views + , BSD_3_Clause_Modification + , BSD_3_Clause_No_Military_License + , BSD_3_Clause_Open_MPI + , BSD_4_Clause_Shortened + , BUSL_1_1 + , C_UDA_1_0 + , CAL_1_0_Combined_Work_Exception + , CAL_1_0 + , CC_BY_2_5_AU + , CC_BY_3_0_AT + , CC_BY_3_0_DE + , CC_BY_3_0_NL + , CC_BY_3_0_US + , CC_BY_NC_3_0_DE + , CC_BY_NC_ND_3_0_DE + , CC_BY_NC_ND_3_0_IGO + , CC_BY_NC_SA_2_0_FR + , CC_BY_NC_SA_2_0_UK + , CC_BY_NC_SA_3_0_DE + , CC_BY_NC_SA_3_0_IGO + , CC_BY_ND_3_0_DE + , CC_BY_SA_2_0_UK + , CC_BY_SA_2_1_JP + , CC_BY_SA_3_0_AT + , CC_BY_SA_3_0_DE + , CC_PDDC + , CDL_1_0 + , CDLA_Permissive_2_0 + , CERN_OHL_1_1 + , CERN_OHL_1_2 + , CERN_OHL_P_2_0 + , CERN_OHL_S_2_0 + , CERN_OHL_W_2_0 + , COIL_1_0 + , Community_Spec_1_0 + , Copyleft_next_0_3_0 + , Copyleft_next_0_3_1 + , DL_DE_BY_2_0 + , DRL_1_0 + , Elastic_2_0 + , EPICS + , Etalab_2_0 + , FDK_AAC + , FreeBSD_DOC + , GD + , GFDL_1_1_invariants_only + , GFDL_1_1_invariants_or_later + , GFDL_1_1_no_invariants_only + , GFDL_1_1_no_invariants_or_later + , GFDL_1_2_invariants_only + , GFDL_1_2_invariants_or_later + , GFDL_1_2_no_invariants_only + , GFDL_1_2_no_invariants_or_later + , GFDL_1_3_invariants_only + , GFDL_1_3_invariants_or_later + , GFDL_1_3_no_invariants_only + , GFDL_1_3_no_invariants_or_later + , GLWTPL + , Hippocratic_2_1 + , HPND_sell_variant + , HTMLTIDY + , Jam + , JPNIC + , Libpng_2_0 + , Libselinux_1_0 + , Linux_man_pages_copyleft + , Linux_OpenIB + , MIT_0 + , MIT_Modern_Variant + , MIT_open_group + , MulanPSL_1_0 + , MulanPSL_2_0 + , NAIST_2003 + , NCGL_UK_2_0 + , NIST_PD_fallback + , NIST_PD + , NLOD_2_0 + , NTP_0 + , O_UDA_1_0 + , ODC_By_1_0 + , OFL_1_0_no_RFN + , OFL_1_0_RFN + , OFL_1_1_no_RFN + , OFL_1_1_RFN + , OGC_1_0 + , OGDL_Taiwan_1_0 + , OGL_Canada_2_0 + , OGL_UK_1_0 + , OGL_UK_2_0 + , OGL_UK_3_0 + , OPUBL_1_0 + , Parity_6_0_0 + , Parity_7_0_0 + , PolyForm_Noncommercial_1_0_0 + , PolyForm_Small_Business_1_0_0 + , PSF_2_0 + , SchemeReport + , Sendmail_8_23 + , SHL_0_51 + , SHL_0_5 + , SSH_OpenSSH + , SSH_short + , SSPL_1_0 + , TAPR_OHL_1_0 + , TU_Berlin_1_0 + , TU_Berlin_2_0 + , UCL_1_0 + , X11_distribute_modifications_variant + ] + ++ bulkOfLicenses -- | Create a 'LicenseId' from a 'String'. mkLicenseId :: LicenseListVersion -> String -> Maybe LicenseId @@ -1925,6 +2062,7 @@ mkLicenseId LicenseListVersion_3_2 s = Map.lookup s stringLookup_3_2 mkLicenseId LicenseListVersion_3_6 s = Map.lookup s stringLookup_3_6 mkLicenseId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 +mkLicenseId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 stringLookup_3_0 :: Map String LicenseId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseId i, i)) $ @@ -1946,6 +2084,10 @@ stringLookup_3_10 :: Map String LicenseId stringLookup_3_10 = Map.fromList $ map (\i -> (licenseId i, i)) $ licenseIdList LicenseListVersion_3_10 +stringLookup_3_16 :: Map String LicenseId +stringLookup_3_16 = Map.fromList $ map (\i -> (licenseId i, i)) $ + licenseIdList LicenseListVersion_3_16 + -- | Licenses in all SPDX License lists bulkOfLicenses :: [LicenseId] bulkOfLicenses = diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs index 0645a83d395..467405a0b59 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs @@ -12,9 +12,11 @@ data LicenseListVersion | LicenseListVersion_3_6 | LicenseListVersion_3_9 | LicenseListVersion_3_10 + | LicenseListVersion_3_16 deriving (Eq, Ord, Show, Enum, Bounded) cabalSpecVersionToSPDXListVersion :: CabalSpecVersion -> LicenseListVersion +cabalSpecVersionToSPDXListVersion CabalSpecV3_8 = LicenseListVersion_3_16 cabalSpecVersionToSPDXListVersion CabalSpecV3_6 = LicenseListVersion_3_10 cabalSpecVersionToSPDXListVersion CabalSpecV3_4 = LicenseListVersion_3_9 cabalSpecVersionToSPDXListVersion CabalSpecV3_0 = LicenseListVersion_3_6 diff --git a/doc/file-format-changelog.rst b/doc/file-format-changelog.rst index f1bb178a7f1..eee4eed32f7 100644 --- a/doc/file-format-changelog.rst +++ b/doc/file-format-changelog.rst @@ -52,6 +52,9 @@ relative to the respective preceding *published* version. * Allow the omission of the `type` field in `test-suite` and `benchmark` stanzas when the type can be inferred by the presence of `main-is` or `test-module`. +* License fields use identifiers from SPDX License List version + ``3.16 2022-02-06`` + ``cabal-version: 3.6`` ---------------------- diff --git a/templates/SPDX.LicenseExceptionId.template.hs b/templates/SPDX.LicenseExceptionId.template.hs index 62035444e33..78b2e277f8e 100644 --- a/templates/SPDX.LicenseExceptionId.template.hs +++ b/templates/SPDX.LicenseExceptionId.template.hs @@ -94,6 +94,9 @@ licenseExceptionIdList LicenseListVersion_3_9 = licenseExceptionIdList LicenseListVersion_3_10 = {{licenseList_perv.v_3_10}} ++ bulkOfLicenses +licenseExceptionIdList LicenseListVersion_3_16 = +{{licenseList_perv.v_3_16}} + ++ bulkOfLicenses -- | Create a 'LicenseExceptionId' from a 'String'. mkLicenseExceptionId :: LicenseListVersion -> String -> Maybe LicenseExceptionId @@ -102,6 +105,7 @@ mkLicenseExceptionId LicenseListVersion_3_2 s = Map.lookup s stringLookup_3_2 mkLicenseExceptionId LicenseListVersion_3_6 s = Map.lookup s stringLookup_3_6 mkLicenseExceptionId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseExceptionId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 +mkLicenseExceptionId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 stringLookup_3_0 :: Map String LicenseExceptionId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ @@ -123,6 +127,10 @@ stringLookup_3_10 :: Map String LicenseExceptionId stringLookup_3_10 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ licenseExceptionIdList LicenseListVersion_3_10 +stringLookup_3_16 :: Map String LicenseExceptionId +stringLookup_3_16 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ + licenseExceptionIdList LicenseListVersion_3_16 + -- | License exceptions in all SPDX License lists bulkOfLicenses :: [LicenseExceptionId] bulkOfLicenses = diff --git a/templates/SPDX.LicenseId.template.hs b/templates/SPDX.LicenseId.template.hs index e3980e9aa97..8185cc6d0ee 100644 --- a/templates/SPDX.LicenseId.template.hs +++ b/templates/SPDX.LicenseId.template.hs @@ -169,7 +169,10 @@ licenseIdList LicenseListVersion_3_9 = {{licenseList_perv.v_3_9}} ++ bulkOfLicenses licenseIdList LicenseListVersion_3_10 = -{{licenseList_perv.v_3_9}} +{{licenseList_perv.v_3_10}} + ++ bulkOfLicenses +licenseIdList LicenseListVersion_3_16 = +{{licenseList_perv.v_3_16}} ++ bulkOfLicenses -- | Create a 'LicenseId' from a 'String'. @@ -179,6 +182,7 @@ mkLicenseId LicenseListVersion_3_2 s = Map.lookup s stringLookup_3_2 mkLicenseId LicenseListVersion_3_6 s = Map.lookup s stringLookup_3_6 mkLicenseId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 +mkLicenseId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 stringLookup_3_0 :: Map String LicenseId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseId i, i)) $ @@ -200,6 +204,10 @@ stringLookup_3_10 :: Map String LicenseId stringLookup_3_10 = Map.fromList $ map (\i -> (licenseId i, i)) $ licenseIdList LicenseListVersion_3_10 +stringLookup_3_16 :: Map String LicenseId +stringLookup_3_16 = Map.fromList $ map (\i -> (licenseId i, i)) $ + licenseIdList LicenseListVersion_3_16 + -- | Licenses in all SPDX License lists bulkOfLicenses :: [LicenseId] bulkOfLicenses =