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
1f0a891b
Verified
Commit
1f0a891b
authored
3 years ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Fix 'ghcup install cabal/hls/stack --set' wrt #324
parent
6c63a659
No related branches found
No related tags found
No related merge requests found
Pipeline
#48517
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
+110
-33
110 additions, 33 deletions
app/ghcup/GHCup/OptParse/Install.hs
with
110 additions
and
33 deletions
app/ghcup/GHCup/OptParse/Install.hs
+
110
−
33
View file @
1f0a891b
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ViewPatterns #-}
module
GHCup.OptParse.Install
where
module
GHCup.OptParse.Install
where
...
@@ -255,6 +256,48 @@ type InstallEffects = '[ AlreadyInstalled
...
@@ -255,6 +256,48 @@ type InstallEffects = '[ AlreadyInstalled
,
NoToolVersionSet
,
NoToolVersionSet
,
FileAlreadyExistsError
,
FileAlreadyExistsError
,
ProcessError
,
ProcessError
,
(
AlreadyInstalled
,
()
)
,
(
UnknownArchive
,
()
)
,
(
ArchiveResult
,
()
)
,
(
FileDoesNotExistError
,
()
)
,
(
CopyError
,
()
)
,
(
NotInstalled
,
()
)
,
(
DirNotEmpty
,
()
)
,
(
NoDownload
,
()
)
,
(
NotInstalled
,
()
)
,
(
BuildFailed
,
()
)
,
(
TagNotFound
,
()
)
,
(
DigestError
,
()
)
,
(
GPGError
,
()
)
,
(
DownloadFailed
,
()
)
,
(
TarDirDoesNotExist
,
()
)
,
(
NextVerNotFound
,
()
)
,
(
NoToolVersionSet
,
()
)
,
(
FileAlreadyExistsError
,
()
)
,
(
ProcessError
,
()
)
,
(
AlreadyInstalled
,
NotInstalled
)
,
(
UnknownArchive
,
NotInstalled
)
,
(
ArchiveResult
,
NotInstalled
)
,
(
FileDoesNotExistError
,
NotInstalled
)
,
(
CopyError
,
NotInstalled
)
,
(
NotInstalled
,
NotInstalled
)
,
(
DirNotEmpty
,
NotInstalled
)
,
(
NoDownload
,
NotInstalled
)
,
(
NotInstalled
,
NotInstalled
)
,
(
BuildFailed
,
NotInstalled
)
,
(
TagNotFound
,
NotInstalled
)
,
(
DigestError
,
NotInstalled
)
,
(
GPGError
,
NotInstalled
)
,
(
DownloadFailed
,
NotInstalled
)
,
(
TarDirDoesNotExist
,
NotInstalled
)
,
(
NextVerNotFound
,
NotInstalled
)
,
(
NoToolVersionSet
,
NotInstalled
)
,
(
FileAlreadyExistsError
,
NotInstalled
)
,
(
ProcessError
,
NotInstalled
)
,
(
()
,
NotInstalled
)
]
]
...
@@ -420,20 +463,22 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -420,20 +463,22 @@ install installCommand settings getAppState' runLogger = case installCommand of
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
(
case
instBindist
of
(
case
instBindist
of
Nothing
->
runInstTool
s'
instPlatform
$
do
Nothing
->
runInstTool
s'
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Cabal
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Cabal
liftE
$
installCabalBin
void
$
liftE
$
sequenceE
(
installCabalBin
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setCabal
v
pure
vi
pure
vi
Just
uri
->
do
Just
uri
->
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Cabal
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Cabal
liftE
$
installCabalBindist
void
$
liftE
$
sequenceE
(
installCabalBindist
(
DownloadInfo
uri
Nothing
""
)
(
DownloadInfo
uri
Nothing
""
)
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setCabal
v
pure
vi
pure
vi
)
)
>>=
\
case
>>=
\
case
...
@@ -450,6 +495,14 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -450,6 +495,14 @@ install installCommand settings getAppState' runLogger = case installCommand of
runLogger
$
logWarn
$
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install cabal --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install cabal --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
pure
$
ExitFailure
3
VLeft
(
V
(
AlreadyInstalled
_
v
,
()
))
->
do
runLogger
$
logWarn
$
"Cabal ver "
<>
prettyVer
v
<>
" already installed; if you really want to reinstall it, you may want to run 'ghcup install cabal --force "
<>
prettyVer
v
<>
"'"
pure
ExitSuccess
VLeft
(
V
(
FileAlreadyExistsError
fp
,
()
))
->
do
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install cabal --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
VLeft
e
->
do
VLeft
e
->
do
runLogger
$
do
runLogger
$
do
logError
$
T
.
pack
$
prettyShow
e
logError
$
T
.
pack
$
prettyShow
e
...
@@ -461,21 +514,23 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -461,21 +514,23 @@ install installCommand settings getAppState' runLogger = case installCommand of
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
(
case
instBindist
of
(
case
instBindist
of
Nothing
->
runInstTool
s'
instPlatform
$
do
Nothing
->
runInstTool
s'
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
HLS
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
HLS
liftE
$
installHLSBin
void
$
liftE
$
sequenceE
(
installHLSBin
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setHLS
v
SetHLSOnly
Nothing
pure
vi
pure
vi
Just
uri
->
do
Just
uri
->
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
HLS
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
HLS
-- TODO: support legacy
-- TODO: support legacy
liftE
$
installHLSBindist
void
$
liftE
$
sequenceE
(
installHLSBindist
(
DownloadInfo
uri
(
Just
$
RegexDir
"haskell-language-server-*"
)
""
)
(
DownloadInfo
uri
(
Just
$
RegexDir
"haskell-language-server-*"
)
""
)
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setHLS
v
SetHLSOnly
Nothing
pure
vi
pure
vi
)
)
>>=
\
case
>>=
\
case
...
@@ -496,6 +551,18 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -496,6 +551,18 @@ install installCommand settings getAppState' runLogger = case installCommand of
runLogger
$
logWarn
$
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install hls --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install hls --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
pure
$
ExitFailure
3
VLeft
(
V
(
AlreadyInstalled
_
v
,
()
))
->
do
runLogger
$
logWarn
$
"HLS ver "
<>
prettyVer
v
<>
" already installed; if you really want to reinstall it, you may want to run 'ghcup install hls --force "
<>
prettyVer
v
<>
"'"
pure
ExitSuccess
VLeft
(
V
(
FileAlreadyExistsError
fp
,
()
))
->
do
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install hls --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
VLeft
e
->
do
VLeft
e
->
do
runLogger
$
do
runLogger
$
do
logError
$
T
.
pack
$
prettyShow
e
logError
$
T
.
pack
$
prettyShow
e
...
@@ -507,20 +574,22 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -507,20 +574,22 @@ install installCommand settings getAppState' runLogger = case installCommand of
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
s'
@
AppState
{
dirs
=
Dirs
{
..
}
}
<-
liftIO
getAppState'
(
case
instBindist
of
(
case
instBindist
of
Nothing
->
runInstTool
s'
instPlatform
$
do
Nothing
->
runInstTool
s'
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Stack
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Stack
liftE
$
installStackBin
void
$
liftE
$
sequenceE
(
installStackBin
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setStack
v
pure
vi
pure
vi
Just
uri
->
do
Just
uri
->
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
runInstTool
s'
{
settings
=
settings
{
noVerify
=
True
}}
instPlatform
$
do
(
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Stack
(
_tvVersion
->
v
,
vi
)
<-
liftE
$
fromVersion
instVer
Stack
liftE
$
installStackBindist
void
$
liftE
$
sequenceE
(
installStackBindist
(
DownloadInfo
uri
Nothing
""
)
(
DownloadInfo
uri
Nothing
""
)
(
_tvVersion
v
)
v
isolateDir
isolateDir
forceInstall
forceInstall
)
$
when
instSet
$
void
$
setStack
v
pure
vi
pure
vi
)
)
>>=
\
case
>>=
\
case
...
@@ -537,6 +606,14 @@ install installCommand settings getAppState' runLogger = case installCommand of
...
@@ -537,6 +606,14 @@ install installCommand settings getAppState' runLogger = case installCommand of
runLogger
$
logWarn
$
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install stack --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install stack --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
pure
$
ExitFailure
3
VLeft
(
V
(
AlreadyInstalled
_
v
,
()
))
->
do
runLogger
$
logWarn
$
"Stack ver "
<>
prettyVer
v
<>
" already installed; if you really want to reinstall it, you may want to run 'ghcup install stack --force "
<>
prettyVer
v
<>
"'"
pure
ExitSuccess
VLeft
(
V
(
FileAlreadyExistsError
fp
,
()
))
->
do
runLogger
$
logWarn
$
"File "
<>
T
.
pack
fp
<>
" already exists. Use 'ghcup install stack --isolate "
<>
T
.
pack
fp
<>
" --force ..."
<>
"' if you want to overwrite."
pure
$
ExitFailure
3
VLeft
e
->
do
VLeft
e
->
do
runLogger
$
do
runLogger
$
do
logError
$
T
.
pack
$
prettyShow
e
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