Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
ghcup-hs
Commits
0623c7b1
Verified
Commit
0623c7b1
authored
5 years ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Improve error reporting
parent
62005f83
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/ghcup/Main.hs
+88
-70
88 additions, 70 deletions
app/ghcup/Main.hs
with
88 additions
and
70 deletions
app/ghcup/Main.hs
+
88
−
70
View file @
0623c7b1
...
@@ -664,136 +664,147 @@ main = do
...
@@ -664,136 +664,147 @@ main = do
)
)
>>=
\
case
>>=
\
case
VRight
r
->
pure
r
VRight
r
->
pure
r
VLeft
e
->
VLeft
e
->
do
runLogger
runLogger
(
$
(
logError
)
[
i
|
Error fetching download info: #{e}
|]
)
(
$
(
logError
)
[
i
|
Error fetching download info: #{e}
|]
)
>>
e
xitFailure
exitWith
(
E
xitFailure
2
)
runLogger
$
checkForUpdates
dls
runLogger
$
checkForUpdates
dls
case
optCommand
of
res
<-
case
optCommand
of
Install
(
InstallOptions
{
..
})
->
Install
(
InstallOptions
{
..
})
->
void
(
runInstTool
$
do
$
(
runInstTool
$
do
v
<-
liftE
$
fromVersion
dls
instVer
GHC
v
<-
liftE
$
fromVersion
dls
instVer
GHC
liftE
$
installGHCBin
dls
v
instPlatform
liftE
$
installGHCBin
dls
v
instPlatform
)
)
>>=
\
case
>>=
\
case
VRight
_
->
VRight
_
->
do
runLogger
$
$
(
logInfo
)
(
"GHC installation successful"
)
runLogger
$
$
(
logInfo
)
(
"GHC installation successful"
)
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
pure
ExitSuccess
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
do
runLogger
$
$
(
logWarn
)
runLogger
$
$
(
logWarn
)
[
i
|
GHC ver #{prettyVer v} already installed
|]
[
i
|
GHC ver #{prettyVer v} already installed
|]
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
pure
ExitSuccess
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
do
runLogger
runLogger
(
$
(
logError
)
[
i
|
Build failed with #{e}
(
$
(
logError
)
[
i
|
Build failed with #{e}
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
|]
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
|]
)
)
>>
e
xitFailure
pure
$
E
xitFailure
3
VLeft
e
->
do
VLeft
e
->
do
runLogger
$
do
runLogger
$
do
$
(
logError
)
[
i
|
#{e}
|]
$
(
logError
)
[
i
|
#{e}
|]
$
(
logError
)
[
i
|
Also check the logs in ~/.ghcup/logs
|]
$
(
logError
)
[
i
|
Also check the logs in ~/.ghcup/logs
|]
e
xitFailure
pure
$
E
xitFailure
3
InstallCabal
(
InstallOptions
{
..
})
->
InstallCabal
(
InstallOptions
{
..
})
->
void
(
runInstTool
$
do
$
(
runInstTool
$
do
v
<-
liftE
$
fromVersion
dls
instVer
Cabal
v
<-
liftE
$
fromVersion
dls
instVer
Cabal
liftE
$
installCabalBin
dls
v
instPlatform
liftE
$
installCabalBin
dls
v
instPlatform
)
)
>>=
\
case
>>=
\
case
VRight
_
->
VRight
_
->
do
runLogger
$
$
(
logInfo
)
(
"Cabal installation successful"
)
runLogger
$
$
(
logInfo
)
(
"Cabal installation successful"
)
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
pure
ExitSuccess
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
do
runLogger
$
$
(
logWarn
)
runLogger
$
$
(
logWarn
)
[
i
|
Cabal ver #{prettyVer v} already installed
|]
[
i
|
Cabal ver #{prettyVer v} already installed
|]
pure
ExitSuccess
VLeft
e
->
do
VLeft
e
->
do
runLogger
$
do
runLogger
$
do
$
(
logError
)
[
i
|
#{e}
|]
$
(
logError
)
[
i
|
#{e}
|]
$
(
logError
)
[
i
|
Also check the logs in ~/.ghcup/logs
|]
$
(
logError
)
[
i
|
Also check the logs in ~/.ghcup/logs
|]
e
xitFailure
pure
$
E
xitFailure
4
SetGHC
(
SetGHCOptions
{
..
})
->
SetGHC
(
SetGHCOptions
{
..
})
->
void
(
runSetGHC
$
do
$
(
runSetGHC
$
do
v
<-
liftE
$
fromVersion
dls
ghcVer
GHC
v
<-
liftE
$
fromVersion
dls
ghcVer
GHC
liftE
$
setGHC
v
SetGHCOnly
liftE
$
setGHC
v
SetGHCOnly
)
)
>>=
\
case
>>=
\
case
VRight
v
->
VRight
v
->
do
runLogger
$
$
(
logInfo
)
[
i
|
GHC #{prettyVer v} successfully set as default version
|]
runLogger
$
$
(
logInfo
)
[
i
|
GHC #{prettyVer v} successfully set as default version
|]
VLeft
e
->
pure
ExitSuccess
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
5
List
(
ListOptions
{
..
})
->
List
(
ListOptions
{
..
})
->
void
(
runListGHC
$
do
$
(
runListGHC
$
do
liftIO
$
listVersions
dls
lTool
lCriteria
liftIO
$
listVersions
dls
lTool
lCriteria
)
)
>>=
\
case
>>=
\
case
VRight
r
->
liftIO
$
printListResult
r
VRight
r
->
do
VLeft
e
->
liftIO
$
printListResult
r
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
pure
ExitSuccess
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
6
Rm
(
RmOptions
{
..
})
->
Rm
(
RmOptions
{
..
})
->
void
(
runRmGHC
$
do
$
(
runRmGHC
$
do
liftE
$
rmGHCVer
ghcVer
liftE
$
rmGHCVer
ghcVer
)
)
>>=
\
case
>>=
\
case
VRight
_
->
pure
()
VRight
_
->
VLeft
e
->
pure
ExitSuccess
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
7
DInfo
->
do
DInfo
->
do
void
(
runDebugInfo
$
do
$
(
runDebugInfo
$
do
liftE
$
getDebugInfo
liftE
$
getDebugInfo
)
)
>>=
\
case
>>=
\
case
VRight
dinfo
->
putStrLn
$
prettyDebugInfo
dinfo
VRight
dinfo
->
do
VLeft
e
->
putStrLn
$
prettyDebugInfo
dinfo
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
pure
ExitSuccess
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
8
Compile
(
CompileGHC
CompileOptions
{
..
})
->
Compile
(
CompileGHC
CompileOptions
{
..
})
->
void
(
runCompileGHC
$
do
$
(
runCompileGHC
$
do
liftE
liftE
$
compileGHC
dls
targetVer
bootstrapGhc
jobs
buildConfig
patchDir
$
compileGHC
dls
targetVer
bootstrapGhc
jobs
buildConfig
patchDir
)
)
>>=
\
case
>>=
\
case
VRight
_
->
VRight
_
->
do
runLogger
$
$
(
logInfo
)
runLogger
$
$
(
logInfo
)
(
"GHC successfully compiled and installed"
)
(
"GHC successfully compiled and installed"
)
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
pure
ExitSuccess
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
do
runLogger
$
$
(
logWarn
)
runLogger
$
$
(
logWarn
)
[
i
|
GHC ver #{prettyVer v} already installed
|]
[
i
|
GHC ver #{prettyVer v} already installed
|]
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
pure
ExitSuccess
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
do
runLogger
runLogger
(
$
(
logError
)
[
i
|
Build failed with #{e}
(
$
(
logError
)
[
i
|
Build failed with #{e}
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
Make sure to clean up #{tmpdir} afterwards.
|]
Make sure to clean up #{tmpdir} afterwards.
|]
)
)
>>
exitFailure
pure
$
ExitFailure
9
VLeft
e
->
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
9
Compile
(
CompileCabal
CompileOptions
{
..
})
->
Compile
(
CompileCabal
CompileOptions
{
..
})
->
void
(
runCompileCabal
$
do
$
(
runCompileCabal
$
do
liftE
$
compileCabal
dls
targetVer
bootstrapGhc
jobs
patchDir
liftE
$
compileCabal
dls
targetVer
bootstrapGhc
jobs
patchDir
)
)
>>=
\
case
>>=
\
case
VRight
_
->
VRight
_
->
do
runLogger
$
$
(
logInfo
)
runLogger
(
$
(
logInfo
)
(
"Cabal successfully compiled and installed"
)
"Cabal successfully compiled and installed"
)
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
pure
ExitSuccess
VLeft
(
V
(
BuildFailed
tmpdir
e
))
->
do
runLogger
runLogger
(
$
(
logError
)
[
i
|
Build failed with #{e}
(
$
(
logError
)
[
i
|
Build failed with #{e}
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
|]
Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues.
|]
)
)
>>
exitFailure
pure
$
ExitFailure
10
VLeft
e
->
VLeft
e
->
do
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
exitFailure
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
pure
$
ExitFailure
10
Upgrade
(
uOpts
)
force
->
do
Upgrade
(
uOpts
)
force
->
do
target
<-
case
uOpts
of
target
<-
case
uOpts
of
...
@@ -806,21 +817,21 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
...
@@ -806,21 +817,21 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
bdir
<-
liftIO
$
ghcupBinDir
bdir
<-
liftIO
$
ghcupBinDir
pure
(
Just
(
bdir
</>
[
rel
|
ghcup
|]
))
pure
(
Just
(
bdir
</>
[
rel
|
ghcup
|]
))
void
(
runUpgrade
$
(
liftE
$
upgradeGHCup
dls
target
force
))
$
(
runUpgrade
$
do
>>=
\
case
liftE
$
upgradeGHCup
dls
target
force
VRight
v'
->
do
)
let
pretty_v
=
prettyVer
v'
>>=
\
case
runLogger
VRight
v'
->
do
$
$
(
logInfo
)
let
pretty_v
=
prettyVer
v'
[
i
|
Successfully upgraded GHCup to version #{pretty_v}
|]
runLogger
pure
ExitSuccess
$
$
(
logInfo
)
VLeft
(
V
NoUpdate
)
->
do
[
i
|
Successfully upgraded GHCup to version #{pretty_v}
|]
runLogger
$
$
(
logWarn
)
VLeft
(
V
NoUpdate
)
->
[
i
|
No GHCup update available
|]
runLogger
$
$
(
logWarn
)
pure
ExitSuccess
[
i
|
No GHCup update available
|]
VLeft
e
->
do
VLeft
e
->
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
runLogger
(
$
(
logError
)
[
i
|
#{e}
|]
)
>>
e
xitFailure
pure
$
E
xitFailure
11
ToolRequirements
->
(
runLogger
$
runE
ToolRequirements
->
(
runLogger
$
runE
@
'
[
NoCompatiblePlatform
@
'
[
NoCompatiblePlatform
...
@@ -832,11 +843,17 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
...
@@ -832,11 +843,17 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
??
NoToolRequirements
??
NoToolRequirements
liftIO
$
T
.
hPutStr
stdout
(
prettyRequirements
req
))
liftIO
$
T
.
hPutStr
stdout
(
prettyRequirements
req
))
>>=
\
case
>>=
\
case
VRight
r
->
pure
r
VRight
_
->
pure
ExitSuccess
VLeft
e
->
VLeft
e
->
do
runLogger
runLogger
(
$
(
logError
)
[
i
|
Error getting tool requirements: #{e}
|]
)
(
$
(
logError
)
[
i
|
Error getting tool requirements: #{e}
|]
)
>>
exitFailure
pure
$
ExitFailure
12
case
res
of
ExitSuccess
->
pure
()
ef
@
(
ExitFailure
_
)
->
do
runLogger
(
$
(
logError
)
[
i
|
If you think this is a bug, report at: https://gitlab.haskell.org/haskell/ghcup-hs/issues
|]
)
exitWith
ef
pure
()
pure
()
...
@@ -912,3 +929,4 @@ Version: #{describe_result}|]
...
@@ -912,3 +929,4 @@ Version: #{describe_result}|]
=
show
plat
<>
", "
<>
show
v'
=
show
plat
<>
", "
<>
show
v'
prettyPlatform
PlatformResult
{
_platform
=
plat
,
_distroVersion
=
Nothing
}
prettyPlatform
PlatformResult
{
_platform
=
plat
,
_distroVersion
=
Nothing
}
=
show
plat
=
show
plat
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment