Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
Glasgow Haskell Compiler
Packages
Cabal
Commits
8e050a65
Commit
8e050a65
authored
7 years ago
by
Francesco Gazzetta
Browse files
Options
Downloads
Patches
Plain Diff
Make withTempEnvFile its own function
parent
9298ad8b
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
cabal-install/Distribution/Client/CmdExec.hs
+29
-16
29 additions, 16 deletions
cabal-install/Distribution/Client/CmdExec.hs
with
29 additions
and
16 deletions
cabal-install/Distribution/Client/CmdExec.hs
+
29
−
16
View file @
8e050a65
...
...
@@ -40,6 +40,7 @@ import Distribution.Client.ProjectPlanOutput
(
updatePostBuildProjectStatus
,
createPackageEnvironment
,
argsEquivalentOfGhcEnvironmentFile
,
PostBuildProjectStatus
)
import
qualified
Distribution.Client.ProjectPlanning
as
Planning
import
Distribution.Client.ProjectPlanning
...
...
@@ -179,23 +180,8 @@ execAction (configFlags, configExFlags, installFlags, haddockFlags)
then
[]
else
argOverrides
-- MAYBE move this outside this "do" block
-- or make it a top level function (with 5 args)
withEnvFile
action
=
withTempDirectory
verbosity
(
distTempDirectory
(
distDirLayout
baseCtx
))
"environment."
(
\
tmpDir
->
do
envOverrides
<-
createPackageEnvironment
verbosity
tmpDir
(
elaboratedPlanToExecute
buildCtx
)
(
elaboratedShared
buildCtx
)
buildStatus
action
envOverrides
)
(
if
envFilesSupported
then
withEnvFile
then
with
Temp
EnvFile
verbosity
baseCtx
buildCtx
buildStatus
else
\
f
->
f
[]
)
$
\
envOverrides
->
do
let
program'
=
withOverrides
envOverrides
...
...
@@ -213,6 +199,33 @@ execAction (configFlags, configExFlags, installFlags, haddockFlags)
,
programDefaultArgs
=
programDefaultArgs
program
++
args
}
-- | Execute an action with a temporary .ghc.environment file reflecting the
-- current environment. The action takes an environment containing the env
-- variable which points ghc to the file.
withTempEnvFile
::
Verbosity
->
ProjectBaseContext
->
ProjectBuildContext
->
PostBuildProjectStatus
->
([(
String
,
Maybe
String
)]
->
IO
a
)
->
IO
a
withTempEnvFile
verbosity
baseCtx
buildCtx
buildStatus
action
=
withTempDirectory
verbosity
(
distTempDirectory
(
distDirLayout
baseCtx
))
"environment."
(
\
tmpDir
->
do
envOverrides
<-
createPackageEnvironment
verbosity
tmpDir
(
elaboratedPlanToExecute
buildCtx
)
(
elaboratedShared
buildCtx
)
buildStatus
action
envOverrides
)
pathAdditions
::
Verbosity
->
ProjectBaseContext
->
ProjectBuildContext
->
IO
[
FilePath
]
pathAdditions
verbosity
ProjectBaseContext
{
..
}
ProjectBuildContext
{
..
}
=
do
info
verbosity
.
unlines
$
"Including the following directories in PATH:"
...
...
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