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
072161ad
Verified
Commit
072161ad
authored
3 years ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Don't fail to set ghc version if already installed
Fixes
#291
parent
a67b3e8a
No related branches found
No related tags found
1 merge request
!236
Don't fail to set ghc version if already installed
Pipeline
#46761
passed
3 years ago
Stage: checks
Stage: quick-test
Stage: test
Stage: expensive-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/ghcup/GHCup/OptParse/Install.hs
+92
-13
92 additions, 13 deletions
app/ghcup/GHCup/OptParse/Install.hs
with
92 additions
and
13 deletions
app/ghcup/GHCup/OptParse/Install.hs
+
92
−
13
View file @
072161ad
...
...
@@ -268,6 +268,64 @@ runInstTool appstate' mInstPlatform =
@
InstallEffects
type
InstallGHCEffects
=
'
[
TagNotFound
,
NextVerNotFound
,
NoToolVersionSet
,
BuildFailed
,
DirNotEmpty
,
AlreadyInstalled
,
(
AlreadyInstalled
,
NotInstalled
)
,
(
UnknownArchive
,
NotInstalled
)
,
(
ArchiveResult
,
NotInstalled
)
,
(
FileDoesNotExistError
,
NotInstalled
)
,
(
CopyError
,
NotInstalled
)
,
(
NotInstalled
,
NotInstalled
)
,
(
DirNotEmpty
,
NotInstalled
)
,
(
NoDownload
,
NotInstalled
)
,
(
BuildFailed
,
NotInstalled
)
,
(
TagNotFound
,
NotInstalled
)
,
(
DigestError
,
NotInstalled
)
,
(
GPGError
,
NotInstalled
)
,
(
DownloadFailed
,
NotInstalled
)
,
(
TarDirDoesNotExist
,
NotInstalled
)
,
(
NextVerNotFound
,
NotInstalled
)
,
(
NoToolVersionSet
,
NotInstalled
)
,
(
FileAlreadyExistsError
,
NotInstalled
)
,
(
ProcessError
,
NotInstalled
)
,
(
AlreadyInstalled
,
()
)
,
(
UnknownArchive
,
()
)
,
(
ArchiveResult
,
()
)
,
(
FileDoesNotExistError
,
()
)
,
(
CopyError
,
()
)
,
(
NotInstalled
,
()
)
,
(
DirNotEmpty
,
()
)
,
(
NoDownload
,
()
)
,
(
BuildFailed
,
()
)
,
(
TagNotFound
,
()
)
,
(
DigestError
,
()
)
,
(
GPGError
,
()
)
,
(
DownloadFailed
,
()
)
,
(
TarDirDoesNotExist
,
()
)
,
(
NextVerNotFound
,
()
)
,
(
NoToolVersionSet
,
()
)
,
(
FileAlreadyExistsError
,
()
)
,
(
ProcessError
,
()
)
,
(
()
,
NotInstalled
)
]
runInstGHC
::
AppState
->
Maybe
PlatformRequest
->
Excepts
InstallGHCEffects
(
ResourceT
(
ReaderT
AppState
IO
))
a
->
IO
(
VEither
InstallGHCEffects
a
)
runInstGHC
appstate'
mInstPlatform
=
flip
runReaderT
(
maybe
appstate'
(
\
x
->
appstate'
{
pfreq
=
x
}
::
AppState
)
mInstPlatform
)
.
runResourceT
.
runE
@
InstallGHCEffects
-------------------
--[ Entrypoints ]--
...
...
@@ -288,23 +346,25 @@ install installCommand settings getAppState' runLogger = case installCommand of
installGHC
InstallOptions
{
..
}
=
do
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
(
case
instBindist
of
Nothing
->
runInst
Tool
s'
instPlatform
$
do
Nothing
->
runInst
GHC
s'
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
GHC
liftE
$
installGHCBin
(
_tvVersion
v
)
isolateDir
forceInstall
when
instSet
$
void
$
liftE
$
setGHC
v
SetGHCOnly
pure
vi
Just
uri
->
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
GHC
liftE
$
installGHCBindist
(
DownloadInfo
uri
(
Just
$
RegexDir
"ghc-.*"
)
""
)
void
$
liftE
$
sequenceE
(
installGHCBin
(
_tvVersion
v
)
isolateDir
forceInstall
when
instSet
$
void
$
liftE
$
setGHC
v
SetGHCOnly
)
$
when
instSet
$
void
$
setGHC
v
SetGHCOnly
pure
vi
Just
uri
->
do
runInstGHC
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
GHC
void
$
liftE
$
sequenceE
(
installGHCBindist
(
DownloadInfo
uri
(
Just
$
RegexDir
"ghc-.*"
)
""
)
(
_tvVersion
v
)
isolateDir
forceInstall
)
$
when
instSet
$
void
$
setGHC
v
SetGHCOnly
pure
vi
)
>>=
\
case
...
...
@@ -313,14 +373,25 @@ install installCommand settings getAppState' runLogger = case installCommand of
forM_
(
_viPostInstall
=<<
vi
)
$
\
msg
->
runLogger
$
logInfo
msg
pure
ExitSuccess
VLeft
(
V
(
AlreadyInstalled
_
v
,
()
))
->
do
runLogger
$
logWarn
$
"GHC ver "
<>
prettyVer
v
<>
" already installed; if you really want to reinstall it, you may want to run 'ghcup install ghc --force "
<>
prettyVer
v
<>
"'"
pure
ExitSuccess
VLeft
(
V
(
AlreadyInstalled
_
v
))
->
do
runLogger
$
logWarn
$
"GHC ver "
<>
prettyVer
v
<>
" already installed; if you really want to reinstall it, you may want to run 'ghcup install ghc --force "
<>
prettyVer
v
<>
"'"
pure
ExitSuccess
VLeft
(
V
(
DirNotEmpty
fp
))
->
do
runLogger
$
logWarn
$
"Install directory "
<>
T
.
pack
fp
<>
" is not empty. Use 'ghcup install ghc --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' to install regardless."
pure
$
ExitFailure
3
VLeft
(
V
(
DirNotEmpty
fp
,
()
))
->
do
runLogger
$
logWarn
$
"Install directory "
<>
T
.
pack
fp
<>
" is not empty. Use 'ghcup install ghc --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' to install regardless."
pure
$
ExitFailure
3
VLeft
err
@
(
V
(
BuildFailed
tmpdir
_
))
->
do
case
keepDirs
settings
of
Never
->
runLogger
(
logError
$
T
.
pack
$
prettyShow
err
)
...
...
@@ -328,6 +399,14 @@ install installCommand settings getAppState' runLogger = case installCommand of
"Check the logs at "
<>
T
.
pack
logsDir
<>
" and the build directory "
<>
T
.
pack
tmpdir
<>
" for more clues."
<>
"
\n
"
<>
"Make sure to clean up "
<>
T
.
pack
tmpdir
<>
" afterwards."
)
pure
$
ExitFailure
3
VLeft
err
@
(
V
(
BuildFailed
tmpdir
_
,
()
))
->
do
case
keepDirs
settings
of
Never
->
runLogger
(
logError
$
T
.
pack
$
prettyShow
err
)
_
->
runLogger
(
logError
$
T
.
pack
(
prettyShow
err
)
<>
"
\n
"
<>
"Check the logs at "
<>
T
.
pack
logsDir
<>
" and the build directory "
<>
T
.
pack
tmpdir
<>
" for more clues."
<>
"
\n
"
<>
"Make sure to clean up "
<>
T
.
pack
tmpdir
<>
" afterwards."
)
pure
$
ExitFailure
3
VLeft
e
->
do
runLogger
$
do
logError
$
T
.
pack
$
prettyShow
e
...
...
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