Fix hls-metadata for windows

This commit is contained in:
Julian Ospald 2022-03-13 00:28:34 +01:00
parent 4c23f6a49e
commit 9d2ebcb74d
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
5 changed files with 87 additions and 13 deletions

View File

@ -18,6 +18,8 @@ import GHCup.Utils
import Codec.Archive import Codec.Archive
import Control.DeepSeq
import Control.Exception ( evaluate )
import Control.Exception.Safe hiding ( handle ) import Control.Exception.Safe hiding ( handle )
import Control.Monad import Control.Monad
import Control.Monad.IO.Class import Control.Monad.IO.Class
@ -82,12 +84,14 @@ generateHLSGhc format output = do
, ArchiveResult , ArchiveResult
] $ do ] $ do
fp <- liftE $ downloadCached dli Nothing fp <- liftE $ downloadCached dli Nothing
files <- liftE $ getArchiveFiles fp filesL <- liftE $ getArchiveFiles fp
let regex = makeRegexOpts compExtended execBlank ([s|^haskell-language-server-([0-9]+\.)*([0-9]+)$|] :: ByteString) files <- liftIO $ evaluate $ force filesL
let regex = makeRegexOpts compExtended execBlank ([s|^haskell-language-server-([0-9]+\.)*([0-9]+)(\.exe)?$|] :: ByteString)
let ghcs = rights $ MP.parse version' "" let ghcs = rights $ MP.parse version' ""
. T.pack . T.pack
. fromJust . fromJust
. stripPrefix "haskell-language-server-" . stripPrefix "haskell-language-server-"
. stripExe
<$> filter (match regex) files <$> filter (match regex) files
pure ghcs pure ghcs
pure r pure r
@ -98,7 +102,11 @@ generateHLSGhc format output = do
StdOut -> liftIO $ BSL.putStr w StdOut -> liftIO $ BSL.putStr w
FileOutput f -> liftIO $ BSL.writeFile f w FileOutput f -> liftIO $ BSL.writeFile f w
pure ExitSuccess pure ExitSuccess
where
stripExe :: String -> String
stripExe f = case reverse f of
('e':'x':'e':'.':r) -> reverse r
_ -> f
generateTable :: ( MonadFail m generateTable :: ( MonadFail m
, MonadMask m , MonadMask m

View File

@ -170,7 +170,7 @@ main = do
, fancyColors = not no_color , fancyColors = not no_color
} }
dirs <- liftIO getAllDirs dirs <- liftIO getAllDirs
let leanAppstate = LeanAppState (Settings True 0 False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings loggerConfig let leanAppstate = LeanAppState (Settings True 0 False Never Curl True GHCupURL False GPGNone True) dirs defaultKeyBindings loggerConfig
pfreq <- ( pfreq <- (
flip runReaderT leanAppstate . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ platformRequest flip runReaderT leanAppstate . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ platformRequest
@ -180,7 +180,7 @@ main = do
flip runReaderT leanAppstate $ logError $ T.pack $ prettyShow e flip runReaderT leanAppstate $ logError $ T.pack $ prettyShow e
liftIO $ exitWith (ExitFailure 2) liftIO $ exitWith (ExitFailure 2)
let appstate = AppState (Settings True 0 False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig let appstate = AppState (Settings True 0 False Never Curl True GHCupURL False GPGNone True) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig
let withValidateYamlOpts vopts f = case vopts of let withValidateYamlOpts vopts f = case vopts of
ValidateYAMLOpts { vInput = Nothing } -> ValidateYAMLOpts { vInput = Nothing } ->

View File

@ -49,6 +49,7 @@ executable ghcup-gen
, base >=4.13 && <5 , base >=4.13 && <5
, bytestring ^>=0.10 , bytestring ^>=0.10
, containers ^>=0.6 , containers ^>=0.6
, deepseq ^>=1.4
, filepath ^>=1.4.2.1 , filepath ^>=1.4.2.1
, ghcup ^>=0.1.17.3 , ghcup ^>=0.1.17.3
, haskus-utils-variant ^>=3.2 , haskus-utils-variant ^>=3.2

View File

@ -31,7 +31,14 @@
"8.8.3", "8.8.3",
"8.8.4" "8.8.4"
], ],
"Windows": [] "Windows": [
"8.6.4",
"8.6.5",
"8.8.4",
"8.10.2",
"8.10.3",
"8.10.4"
]
} }
}, },
"1.2.0": { "1.2.0": {
@ -69,7 +76,15 @@
"8.8.3", "8.8.3",
"8.8.4" "8.8.4"
], ],
"Windows": [] "Windows": [
"8.10.2",
"8.10.3",
"8.10.4",
"8.10.5",
"8.6.4",
"8.6.5",
"8.8.4"
]
} }
}, },
"1.3.0": { "1.3.0": {
@ -107,7 +122,16 @@
"8.8.4", "8.8.4",
"9.0.1" "9.0.1"
], ],
"Windows": [] "Windows": [
"8.10.2",
"8.10.3",
"8.10.4",
"8.10.5",
"8.6.4",
"8.6.5",
"8.8.4",
"9.0.1"
]
} }
}, },
"1.4.0": { "1.4.0": {
@ -154,7 +178,18 @@
"8.8.4", "8.8.4",
"9.0.1" "9.0.1"
], ],
"Windows": [] "Windows": [
"8.10.2",
"8.10.3",
"8.10.4",
"8.10.5",
"8.10.6",
"8.10.7",
"8.6.4",
"8.6.5",
"8.8.4",
"9.0.1"
]
}, },
"A_ARM": { "A_ARM": {
"Linux_UnknownLinux": [ "Linux_UnknownLinux": [
@ -207,7 +242,14 @@
"8.8.4", "8.8.4",
"9.0.1" "9.0.1"
], ],
"Windows": [] "Windows": [
"8.10.5",
"8.10.6",
"8.10.7",
"8.6.5",
"8.8.4",
"9.0.1"
]
}, },
"A_ARM": { "A_ARM": {
"Linux_UnknownLinux": [ "Linux_UnknownLinux": [
@ -257,7 +299,14 @@
"8.8.4", "8.8.4",
"9.0.1" "9.0.1"
], ],
"Windows": [] "Windows": [
"8.10.5",
"8.10.6",
"8.10.7",
"8.6.5",
"8.8.4",
"9.0.1"
]
}, },
"A_ARM": { "A_ARM": {
"Linux_UnknownLinux": [ "Linux_UnknownLinux": [
@ -307,7 +356,15 @@
"9.0.2", "9.0.2",
"9.2.1" "9.2.1"
], ],
"Windows": [] "Windows": [
"8.10.6",
"8.10.7",
"8.6.5",
"8.8.4",
"9.0.1",
"9.0.2",
"9.2.1"
]
}, },
"A_ARM": { "A_ARM": {
"Linux_UnknownLinux": [ "Linux_UnknownLinux": [
@ -354,7 +411,15 @@
"9.0.2", "9.0.2",
"9.2.1" "9.2.1"
], ],
"Windows": [] "Windows": [
"8.10.6",
"8.10.7",
"8.6.5",
"8.8.4",
"9.0.1",
"9.0.2",
"9.2.1"
]
}, },
"A_ARM": { "A_ARM": {
"Linux_UnknownLinux": [ "Linux_UnknownLinux": [

Binary file not shown.