Merge branch 'better-platform'
This commit is contained in:
commit
f4b6bfc594
@ -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'
|
||||||
|
@ -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
|
||||||
@ -64,13 +61,19 @@ 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
|
||||||
|
"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)
|
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
|
||||||
)
|
)
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user