[commit: packages/Cabal] ghc-head: Use the --extra-prog-path flag in cabal-install (eb789dc)
git at git.haskell.org
git at git.haskell.org
Mon Aug 26 23:29:30 CEST 2013
Repository : ssh://git@git.haskell.org/Cabal
On branch : ghc-head
Link : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=eb789dcab23e3d7a732d2f1434ca7f4a37a3e38e
>---------------------------------------------------------------
commit eb789dcab23e3d7a732d2f1434ca7f4a37a3e38e
Author: Duncan Coutts <duncan at community.haskell.org>
Date: Sat Aug 10 22:42:32 2013 +0100
Use the --extra-prog-path flag in cabal-install
We have to pass it properly in the setupWrapper. For the external build
method we just set the $PATH rather than passing the flag. This way it
works when talking to Setup.hs built with an older Cabal lib.
>---------------------------------------------------------------
eb789dcab23e3d7a732d2f1434ca7f4a37a3e38e
Cabal/Distribution/Simple/Program/Run.hs | 1 +
cabal-install/Distribution/Client/Setup.hs | 7 +++++--
cabal-install/Distribution/Client/SetupWrapper.hs | 18 +++++++++++++-----
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/Cabal/Distribution/Simple/Program/Run.hs b/Cabal/Distribution/Simple/Program/Run.hs
index 15b58c6..21065f9 100644
--- a/Cabal/Distribution/Simple/Program/Run.hs
+++ b/Cabal/Distribution/Simple/Program/Run.hs
@@ -20,6 +20,7 @@ module Distribution.Simple.Program.Run (
runProgramInvocation,
getProgramInvocationOutput,
+ getEffectiveEnvironment,
) where
import Distribution.Simple.Program.Types
diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs
index c56cd5c..91f4cf9 100644
--- a/cabal-install/Distribution/Client/Setup.hs
+++ b/cabal-install/Distribution/Client/Setup.hs
@@ -240,16 +240,19 @@ configureOptions = commandOptions configureCommand
filterConfigureFlags :: ConfigFlags -> Version -> ConfigFlags
filterConfigureFlags flags cabalLibVersion
- | cabalLibVersion >= Version [1,14,0] [] = flags
+ | cabalLibVersion >= Version [1,17,0] [] = flags
| cabalLibVersion < Version [1,3,10] [] = flags_1_3_10
| cabalLibVersion < Version [1,10,0] [] = flags_1_10_0
| cabalLibVersion < Version [1,14,0] [] = flags_1_14_0
+ | cabalLibVersion < Version [1,17,0] [] = flags_1_17_0
-- A no-op that silences the "pattern match is non-exhaustive" warning.
| otherwise = flags
where
+ -- Cabal < 1.17.0 doesn't know about --extra-prog-path.
+ flags_1_17_0 = flags { configProgramPathExtra = [] }
-- Cabal < 1.14.0 doesn't know about --disable-benchmarks.
- flags_1_14_0 = flags { configBenchmarks = NoFlag }
+ flags_1_14_0 = flags_1_17_0 { configBenchmarks = NoFlag }
-- Cabal < 1.10.0 doesn't know about --disable-tests.
flags_1_10_0 = flags_1_14_0 { configTests = NoFlag }
-- Cabal < 1.3.10 does not grok the constraints flag.
diff --git a/cabal-install/Distribution/Client/SetupWrapper.hs b/cabal-install/Distribution/Client/SetupWrapper.hs
index e33eee2..320a96e 100644
--- a/cabal-install/Distribution/Client/SetupWrapper.hs
+++ b/cabal-install/Distribution/Client/SetupWrapper.hs
@@ -46,7 +46,11 @@ import Distribution.Simple.Compiler
, PackageDB(..), PackageDBStack )
import Distribution.Simple.Program
( ProgramConfiguration, emptyProgramConfiguration
- , getDbProgramOutput, runDbProgram, ghcProgram )
+ , getProgramSearchPath, getDbProgramOutput, runDbProgram, ghcProgram )
+import Distribution.Simple.Program.Find
+ ( programSearchPathAsPATHVar )
+import Distribution.Simple.Program.Run
+ ( getEffectiveEnvironment )
import Distribution.Simple.BuildPaths
( defaultDistPref, exeExtension )
import Distribution.Simple.Command
@@ -217,7 +221,7 @@ externalSetupMethod verbosity options pkg bt mkargs = do
-- types?
Simple -> getCachedSetupExecutable options' cabalLibVersion setupHs
_ -> compileSetupExecutable options' cabalLibVersion setupHs False
- invokeSetupScript path (mkargs cabalLibVersion)
+ invokeSetupScript options' path (mkargs cabalLibVersion)
where
workingDir = case fromMaybe "" (useWorkingDir options) of
@@ -422,8 +426,8 @@ externalSetupMethod verbosity options pkg bt mkargs = do
where
setupProgFile = setupDir </> "setup" <.> exeExtension
- invokeSetupScript :: FilePath -> [String] -> IO ()
- invokeSetupScript path args = do
+ invokeSetupScript :: SetupScriptOptions -> FilePath -> [String] -> IO ()
+ invokeSetupScript options' path args = do
info verbosity $ unwords (path : args)
case useLoggingHandle options of
Nothing -> return ()
@@ -436,8 +440,12 @@ externalSetupMethod verbosity options pkg bt mkargs = do
-- working directory.
path' <- tryCanonicalizePath path
+ searchpath <- programSearchPathAsPATHVar
+ (getProgramSearchPath (useProgramConfig options'))
+ env <- getEffectiveEnvironment [("PATH", Just searchpath)]
+
process <- runProcess path' args
- (useWorkingDir options) Nothing
+ (useWorkingDir options) env
Nothing (useLoggingHandle options) (useLoggingHandle options)
exitCode <- waitForProcess process
unless (exitCode == ExitSuccess) $ exitWith exitCode
More information about the ghc-commits
mailing list