Skip to content

Commit

Permalink
Add extra GHCComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Jul 20, 2024
1 parent 126e17b commit 9087fcb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion code/hsec-core/src/Security/Advisories/Core/Advisory.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,34 @@ data ComponentIdentifier = Hackage Text | GHC GHCComponent
deriving stock (Show, Eq)

-- Keep this list in sync with the 'ghcComponentFromText' below
data GHCComponent = GHCCompiler | GHCi | GHCRTS
data GHCComponent = GHCCompiler | GHCi | GHCRTS | GHCPkg | RunGHC | IServ | HP2PS | HPC | HSC2HS | Haddock
deriving stock (Show, Eq, Enum, Bounded)

ghcComponentToText :: GHCComponent -> Text
ghcComponentToText c = case c of
GHCCompiler -> "compiler"
GHCi -> "ghci"
GHCRTS -> "rts"
GHCPkg -> "ghc-pkg"
RunGHC -> "runghc"
IServ -> "iserv"
HP2PS -> "hp2ps"
HPC -> "hpc"
HSC2HS -> "hsc2hs"
Haddock -> "haddock"

ghcComponentFromText :: Text -> Maybe GHCComponent
ghcComponentFromText c = case c of
"compiler" -> Just GHCCompiler
"ghci" -> Just GHCi
"rts" -> Just GHCRTS
"ghc-pkg" -> Just GHCPkg
"runghc" -> Just RunGHC
"iserv" -> Just IServ
"hp2ps" -> Just HP2PS
"hpc" -> Just HPC
"hsc2hs" -> Just HSC2HS
"haddock" -> Just Haddock
_ -> Nothing

-- | An affected package (or package component). An 'Advisory' must
Expand Down

0 comments on commit 9087fcb

Please sign in to comment.