Skip to content

Commit

Permalink
Add SPDX List v3.16 to LicenseListVersion and the file format changel…
Browse files Browse the repository at this point in the history
…og (#8135)
  • Loading branch information
Kleidukos authored May 19, 2022
1 parent 9bf9b55 commit a530988
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) $
Expand All @@ -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 =
Expand Down
144 changes: 143 additions & 1 deletion Cabal-syntax/src/Distribution/SPDX/LicenseId.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)) $
Expand All @@ -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 =
Expand Down
2 changes: 2 additions & 0 deletions Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/file-format-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
----------------------

Expand Down
8 changes: 8 additions & 0 deletions templates/SPDX.LicenseExceptionId.template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) $
Expand All @@ -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 =
Expand Down
10 changes: 9 additions & 1 deletion templates/SPDX.LicenseId.template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand All @@ -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)) $
Expand All @@ -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 =
Expand Down

0 comments on commit a530988

Please sign in to comment.