Remove URLSource from Settings
This commit is contained in:
parent
f5a2db6719
commit
8a1bd45ffe
@ -161,7 +161,7 @@ validateTarballs dls = do
|
|||||||
|
|
||||||
where
|
where
|
||||||
downloadAll dli = do
|
downloadAll dli = do
|
||||||
let settings = Settings True GHCupURL False
|
let settings = Settings True False
|
||||||
let runLogger = myLoggerT LoggerConfig { lcPrintDebug = True
|
let runLogger = myLoggerT LoggerConfig { lcPrintDebug = True
|
||||||
, colorOutter = B.hPut stderr
|
, colorOutter = B.hPut stderr
|
||||||
, rawOutter = (\_ -> pure ())
|
, rawOutter = (\_ -> pure ())
|
||||||
|
@ -454,9 +454,8 @@ platformParser s' = case MP.parse (platformP <* MP.eof) "" (T.pack s') of
|
|||||||
|
|
||||||
toSettings :: Options -> Settings
|
toSettings :: Options -> Settings
|
||||||
toSettings Options {..} =
|
toSettings Options {..} =
|
||||||
let cache = optCache
|
let cache = optCache
|
||||||
urlSource = maybe GHCupURL OwnSource optUrlSource
|
noVerify = optNoVerify
|
||||||
noVerify = optNoVerify
|
|
||||||
in Settings { .. }
|
in Settings { .. }
|
||||||
|
|
||||||
|
|
||||||
@ -592,7 +591,8 @@ main = do
|
|||||||
( runLogger
|
( runLogger
|
||||||
. flip runReaderT settings
|
. flip runReaderT settings
|
||||||
. runE @'[JSONError , DownloadFailed]
|
. runE @'[JSONError , DownloadFailed]
|
||||||
$ liftE getDownloads
|
$ liftE
|
||||||
|
$ getDownloads (maybe GHCupURL OwnSource optUrlSource)
|
||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight r -> pure r
|
VRight r -> pure r
|
||||||
@ -607,7 +607,7 @@ main = do
|
|||||||
void
|
void
|
||||||
$ (runInstTool $ do
|
$ (runInstTool $ do
|
||||||
v <- liftE $ fromVersion dls instVer GHC
|
v <- liftE $ fromVersion dls instVer GHC
|
||||||
liftE $ installGHCBin dls v Nothing
|
liftE $ installGHCBin dls v optPlatform
|
||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight _ -> runLogger
|
VRight _ -> runLogger
|
||||||
@ -630,7 +630,7 @@ Check the logs at ~/ghcup/logs and the build directory #{tmpdir} for more clues.
|
|||||||
void
|
void
|
||||||
$ (runInstTool $ do
|
$ (runInstTool $ do
|
||||||
v <- liftE $ fromVersion dls instVer Cabal
|
v <- liftE $ fromVersion dls instVer Cabal
|
||||||
liftE $ installCabalBin dls v Nothing
|
liftE $ installCabalBin dls v optPlatform
|
||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight _ -> runLogger
|
VRight _ -> runLogger
|
||||||
|
15
lib/GHCup.hs
15
lib/GHCup.hs
@ -404,19 +404,18 @@ rmGHCVer ver = do
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
||||||
getDebugInfo :: (MonadLogger m, MonadCatch m, MonadReader Settings m, MonadIO m)
|
getDebugInfo :: (MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
=> Excepts
|
=> Excepts
|
||||||
'[NoCompatiblePlatform , NoCompatibleArch , DistroNotFound]
|
'[NoCompatiblePlatform , NoCompatibleArch , DistroNotFound]
|
||||||
m
|
m
|
||||||
DebugInfo
|
DebugInfo
|
||||||
getDebugInfo = do
|
getDebugInfo = do
|
||||||
diBaseDir <- liftIO $ ghcupBaseDir
|
diBaseDir <- liftIO $ ghcupBaseDir
|
||||||
diBinDir <- liftIO $ ghcupBinDir
|
diBinDir <- liftIO $ ghcupBinDir
|
||||||
diGHCDir <- liftIO $ ghcupGHCBaseDir
|
diGHCDir <- liftIO $ ghcupGHCBaseDir
|
||||||
diCacheDir <- liftIO $ ghcupCacheDir
|
diCacheDir <- liftIO $ ghcupCacheDir
|
||||||
diURLSource <- lift $ getUrlSource
|
diArch <- lE getArchitecture
|
||||||
diArch <- lE getArchitecture
|
diPlatform <- liftE $ getPlatform
|
||||||
diPlatform <- liftE $ getPlatform
|
|
||||||
pure $ DebugInfo { .. }
|
pure $ DebugInfo { .. }
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,14 +93,13 @@ getDownloads :: ( FromJSONKey Tool
|
|||||||
, FromJSON VersionInfo
|
, FromJSON VersionInfo
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadReader Settings m
|
|
||||||
, MonadLogger m
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
)
|
)
|
||||||
=> Excepts '[JSONError , DownloadFailed] m GHCupDownloads
|
=> URLSource
|
||||||
getDownloads = do
|
-> Excepts '[JSONError , DownloadFailed] m GHCupDownloads
|
||||||
urlSource <- lift getUrlSource
|
getDownloads urlSource = do
|
||||||
lift $ $(logDebug) [i|Receiving download info from: #{urlSource}|]
|
lift $ $(logDebug) [i|Receiving download info from: #{urlSource}|]
|
||||||
case urlSource of
|
case urlSource of
|
||||||
GHCupURL -> do
|
GHCupURL -> do
|
||||||
@ -122,18 +121,18 @@ getDownloads = do
|
|||||||
--
|
--
|
||||||
-- Always save the local file with the mod time of the remote file.
|
-- Always save the local file with the mod time of the remote file.
|
||||||
smartDl :: forall m1
|
smartDl :: forall m1
|
||||||
. (MonadCatch m1, MonadIO m1, MonadFail m1, MonadLogger m1)
|
. (MonadCatch m1, MonadIO m1, MonadFail m1, MonadLogger m1)
|
||||||
=> URI
|
=> URI
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[ FileDoesNotExistError
|
'[ FileDoesNotExistError
|
||||||
, HTTPStatusError
|
, HTTPStatusError
|
||||||
, URIParseError
|
, URIParseError
|
||||||
, UnsupportedScheme
|
, UnsupportedScheme
|
||||||
, NoLocationHeader
|
, NoLocationHeader
|
||||||
, TooManyRedirs
|
, TooManyRedirs
|
||||||
]
|
]
|
||||||
m1
|
m1
|
||||||
L.ByteString
|
L.ByteString
|
||||||
smartDl uri' = do
|
smartDl uri' = do
|
||||||
let path = view pathL' uri'
|
let path = view pathL' uri'
|
||||||
json_file <- (liftIO $ ghcupCacheDir)
|
json_file <- (liftIO $ ghcupCacheDir)
|
||||||
@ -204,11 +203,7 @@ getDownloads = do
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
getDownloadInfo :: ( MonadLogger m
|
getDownloadInfo :: (MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
, MonadCatch m
|
|
||||||
, MonadIO m
|
|
||||||
, MonadReader Settings m
|
|
||||||
)
|
|
||||||
=> GHCupDownloads
|
=> GHCupDownloads
|
||||||
-> Tool
|
-> Tool
|
||||||
-> Version
|
-> Version
|
||||||
|
@ -104,21 +104,19 @@ data URLSource = GHCupURL
|
|||||||
|
|
||||||
|
|
||||||
data Settings = Settings
|
data Settings = Settings
|
||||||
{ cache :: Bool
|
{ cache :: Bool
|
||||||
, urlSource :: URLSource
|
, noVerify :: Bool
|
||||||
, noVerify :: Bool
|
|
||||||
}
|
}
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
|
||||||
data DebugInfo = DebugInfo
|
data DebugInfo = DebugInfo
|
||||||
{ diBaseDir :: Path Abs
|
{ diBaseDir :: Path Abs
|
||||||
, diBinDir :: Path Abs
|
, diBinDir :: Path Abs
|
||||||
, diGHCDir :: Path Abs
|
, diGHCDir :: Path Abs
|
||||||
, diCacheDir :: Path Abs
|
, diCacheDir :: Path Abs
|
||||||
, diURLSource :: URLSource
|
, diArch :: Architecture
|
||||||
, diArch :: Architecture
|
, diPlatform :: PlatformResult
|
||||||
, diPlatform :: PlatformResult
|
|
||||||
}
|
}
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
@ -141,4 +139,3 @@ data PlatformRequest = PlatformRequest
|
|||||||
, _rVersion :: Maybe Versioning
|
, _rVersion :: Maybe Versioning
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
@ -277,9 +277,6 @@ getRecommended av tool = headOf folded $ getTagged av tool Recommended
|
|||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
||||||
getUrlSource :: MonadReader Settings m => m URLSource
|
|
||||||
getUrlSource = ask <&> urlSource
|
|
||||||
|
|
||||||
getCache :: MonadReader Settings m => m Bool
|
getCache :: MonadReader Settings m => m Bool
|
||||||
getCache = ask <&> cache
|
getCache = ask <&> cache
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user