Extract Hadrian logic to isHadrian function with comment
This commit is contained in:
parent
a186b07763
commit
d276bfb3ec
@ -418,19 +418,23 @@ ghcToolFiles ver = do
|
|||||||
)
|
)
|
||||||
|
|
||||||
let ghcbinPath = toFilePath (bindir </> ghcbin)
|
let ghcbinPath = toFilePath (bindir </> ghcbin)
|
||||||
ghcIsLink <- isSymbolicLink <$> (liftIO $ getFileStatus ghcbinPath)
|
ghcIsHadrian <- liftIO $ isHadrian ghcbinPath
|
||||||
onlyUnversioned <- if ghcIsLink
|
onlyUnversioned <- if ghcIsHadrian
|
||||||
then do
|
then pure id
|
||||||
|
else do
|
||||||
(Just symver) <-
|
(Just symver) <-
|
||||||
(B.stripPrefix (toFilePath ghcbin <> "-") . takeFileName)
|
(B.stripPrefix (toFilePath ghcbin <> "-") . takeFileName)
|
||||||
<$> (liftIO $ readSymbolicLink ghcbinPath)
|
<$> (liftIO $ readSymbolicLink ghcbinPath)
|
||||||
when (B.null symver)
|
when (B.null symver)
|
||||||
(throwIO $ userError $ "Fatal: ghc symlink target is broken")
|
(throwIO $ userError $ "Fatal: ghc symlink target is broken")
|
||||||
pure $ filter (\x -> not $ symver `B.isSuffixOf` toFilePath x)
|
pure $ filter (\x -> not $ symver `B.isSuffixOf` toFilePath x)
|
||||||
else
|
|
||||||
pure id
|
|
||||||
|
|
||||||
pure $ onlyUnversioned files
|
pure $ onlyUnversioned files
|
||||||
|
where
|
||||||
|
-- GHC is moving some builds to Hadrian for bindists, which doesn't create versioned binaries
|
||||||
|
-- https://gitlab.haskell.org/haskell/ghcup-hs/issues/31
|
||||||
|
isHadrian :: ByteString -> IO Bool
|
||||||
|
isHadrian = (not . isSymbolicLink <$>) . getFileStatus
|
||||||
|
|
||||||
|
|
||||||
-- | This file, when residing in ~/.ghcup/ghc/<ver>/ signals that
|
-- | This file, when residing in ~/.ghcup/ghc/<ver>/ signals that
|
||||||
|
Loading…
Reference in New Issue
Block a user