Compare commits

...

13 Commits

Author SHA1 Message Date
f9251589cd Add some architectures 2020-06-27 19:00:13 +02:00
cbf076740a Merge branch 'hadrian' 2020-06-20 18:59:01 +02:00
86c144b285 Merge remote-tracking branch 'remotes/origin/merge-requests/12' into hadrian 2020-06-20 14:40:47 +02:00
7ec6e8604c Slight style changes 2020-06-20 14:37:38 +02:00
de70f4820f Merge remote-tracking branch 'origin/merge-requests/13' into hadrian 2020-06-20 12:39:21 +02:00
Brian McKenna
febe6fcb35 Fix behaviour of non-Hadrian builds
getFileStatus will resolve symbolic links. getSymbolicLinkStatus doesn't.
2020-06-20 03:38:41 +00:00
Brian McKenna
3055529d4c Update GHCupDownloads with ghcup-0.0.2.json content 2020-06-19 23:17:34 +00:00
Brian McKenna
d276bfb3ec Extract Hadrian logic to isHadrian function with comment 2020-06-19 23:06:46 +00:00
9db0664465 Add hie.yaml 2020-06-19 19:44:30 +02:00
e9c727647a Update .gitigore 2020-06-19 19:42:55 +02:00
55eef8a3d3 Merge branch 'redhat' 2020-06-19 19:22:56 +02:00
Brian McKenna
a186b07763 Support Hadrian provided bindists
Fixes #31
2020-06-18 14:03:51 +00:00
puffnfresh
1ca628aba1 Fix dlSubdir of ghc-8.10.1-x86_64-unknown-linux for Linux_Alpine 2020-06-18 07:52:34 -04:00
8 changed files with 54 additions and 17 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
.ghci
.vim
codex.tags
dist-newstyle/ dist-newstyle/
cabal.project.local cabal.project.local
.stack-work/ .stack-work/

View File

@@ -1425,6 +1425,13 @@ Version: #{describe_result}|]
prettyArch :: Architecture -> String prettyArch :: Architecture -> String
prettyArch A_64 = "amd64" prettyArch A_64 = "amd64"
prettyArch A_32 = "i386" prettyArch A_32 = "i386"
prettyArch A_PowerPC = "PowerPC"
prettyArch A_PowerPC64 = "PowerPC64"
prettyArch A_Sparc = "Sparc"
prettyArch A_Sparc64 = "Sparc64"
prettyArch A_ARM = "ARM"
prettyArch A_ARM64 = "ARM64"
prettyPlatform :: PlatformResult -> String prettyPlatform :: PlatformResult -> String
prettyPlatform PlatformResult { _platform = plat, _distroVersion = Just v' } prettyPlatform PlatformResult { _platform = plat, _distroVersion = Just v' }
= show plat <> ", " <> show v' = show plat <> ", " <> show v'

View File

@@ -694,7 +694,7 @@
"Linux_Alpine": { "Linux_Alpine": {
"unknown_versioning": { "unknown_versioning": {
"dlHash": "cb13b645d103e2fba2eb8dfcc4e5f2fbd9550c00c4df42f342b4210436dcb8a8", "dlHash": "cb13b645d103e2fba2eb8dfcc4e5f2fbd9550c00c4df42f342b4210436dcb8a8",
"dlSubdir": "ghc-8.10.1", "dlSubdir": "ghc-8.10.1-x86_64-unknown-linux",
"dlUri": "https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-alpine3.10-linux-integer-simple.tar.xz" "dlUri": "https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-alpine3.10-linux-integer-simple.tar.xz"
} }
}, },

4
hie.yaml Normal file
View File

@@ -0,0 +1,4 @@
cradle:
cabal:
- path: "."
component: "ghcup:lib:ghcup"

View File

@@ -883,7 +883,7 @@ ghc_8101_64_darwin = DownloadInfo
ghc_8101_64_alpine :: DownloadInfo ghc_8101_64_alpine :: DownloadInfo
ghc_8101_64_alpine = DownloadInfo ghc_8101_64_alpine = DownloadInfo
[uri|https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-alpine3.10-linux-integer-simple.tar.xz|] [uri|https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-alpine3.10-linux-integer-simple.tar.xz|]
(Just [rel|ghc-8.10.1|]) (Just [rel|ghc-8.10.1-x86_64-unknown-linux|])
"cb13b645d103e2fba2eb8dfcc4e5f2fbd9550c00c4df42f342b4210436dcb8a8" "cb13b645d103e2fba2eb8dfcc4e5f2fbd9550c00c4df42f342b4210436dcb8a8"

View File

@@ -48,10 +48,7 @@ import qualified Data.Text as T
-- | Get the full platform request, consisting of architecture, distro, ... -- | Get the full platform request, consisting of architecture, distro, ...
platformRequest :: (MonadLogger m, MonadCatch m, MonadIO m) platformRequest :: (MonadLogger m, MonadCatch m, MonadIO m)
=> Excepts => Excepts
'[ NoCompatiblePlatform '[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound]
, NoCompatibleArch
, DistroNotFound
]
m m
PlatformRequest PlatformRequest
platformRequest = do platformRequest = do
@@ -62,15 +59,21 @@ platformRequest = do
getArchitecture :: Either NoCompatibleArch Architecture getArchitecture :: Either NoCompatibleArch Architecture
getArchitecture = case arch of getArchitecture = case arch of
"x86_64" -> Right A_64 "x86_64" -> Right A_64
"i386" -> Right A_32 "i386" -> Right A_32
what -> Left (NoCompatibleArch what) "powerpc" -> Right A_PowerPC
"powerpc64" -> Right A_PowerPC64
"powerpc64le" -> Right A_PowerPC64
"sparc" -> Right A_Sparc
"sparc64" -> Right A_Sparc64
"arm" -> Right A_ARM
"aarch64" -> Right A_ARM64
what -> Left (NoCompatibleArch what)
getPlatform :: (MonadLogger m, MonadCatch m, MonadIO m) getPlatform :: (MonadLogger m, MonadCatch m, MonadIO m)
=> Excepts => Excepts
'[NoCompatiblePlatform , DistroNotFound] '[NoCompatiblePlatform, DistroNotFound]
m m
PlatformResult PlatformResult
getPlatform = do getPlatform = do
@@ -82,6 +85,7 @@ getPlatform = do
ver <- ver <-
( either (const Nothing) Just ( either (const Nothing) Just
. versioning . versioning
-- TODO: maybe do this somewhere else
. getMajorVersion . getMajorVersion
. decUTF8Safe . decUTF8Safe
) )

View File

@@ -90,6 +90,12 @@ data Tag = Latest
data Architecture = A_64 data Architecture = A_64
| A_32 | A_32
| A_PowerPC
| A_PowerPC64
| A_Sparc
| A_Sparc64
| A_ARM
| A_ARM64
deriving (Eq, GHC.Generic, Ord, Show) deriving (Eq, GHC.Generic, Ord, Show)

View File

@@ -417,13 +417,26 @@ ghcToolFiles ver = do
([s|^([a-zA-Z0-9_-]*[a-zA-Z0-9_]-)?ghc$|] :: ByteString) ([s|^([a-zA-Z0-9_-]*[a-zA-Z0-9_]-)?ghc$|] :: ByteString)
) )
(Just symver) <- let ghcbinPath = bindir </> ghcbin
(B.stripPrefix (toFilePath ghcbin <> "-") . takeFileName) ghcIsHadrian <- liftIO $ isHadrian ghcbinPath
<$> (liftIO $ readSymbolicLink $ toFilePath (bindir </> ghcbin)) onlyUnversioned <- if ghcIsHadrian
when (B.null symver) then pure id
(throwIO $ userError $ "Fatal: ghc symlink target is broken") else do
(Just symver) <-
(B.stripPrefix (toFilePath ghcbin <> "-") . takeFileName)
<$> (liftIO $ readSymbolicLink $ toFilePath ghcbinPath)
when (B.null symver)
(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) $ 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 :: Path Abs -- ^ ghcbin path
-> IO Bool
isHadrian = fmap (/= SymbolicLink) . getFileType
-- | This file, when residing in ~/.ghcup/ghc/<ver>/ signals that -- | This file, when residing in ~/.ghcup/ghc/<ver>/ signals that