Commit 8c03984d authored by Duncan Coutts's avatar Duncan Coutts

Update to recent Cabal lib changes

parent c37be0fb
......@@ -34,7 +34,7 @@ import Distribution.Compiler (CompilerFlavor(..), defaultCompilerFlavor)
import Distribution.PackageDescription.Parse (ParseResult(..))
import Distribution.ParseUtils
( FieldDescr(..), simpleField, listField, liftField, field
, parseFilePathQ, parseTokenQ )
, parseFilePathQ, parseTokenQ, PWarning(..) )
import Distribution.Simple.Compiler (PackageDB(..))
import Distribution.Simple.InstallDirs
( InstallDirs(..), PathTemplate, toPathTemplate, fromPathTemplate )
......@@ -131,7 +131,7 @@ defaultSavedConfig =
return SavedConfig
{ configFlags = (defaultConfigFlags defaultProgramConfiguration){
ConfigFlags.configHcFlavor = toFlag defaultCompiler
, ConfigFlags.configVerbose = toFlag normal
, ConfigFlags.configVerbosity = toFlag normal
, ConfigFlags.configUserInstall = toFlag True
, ConfigFlags.configInstallDirs = error
"ConfigFlags.installDirs: avoid this field. Use UserInstallDirs \
......@@ -166,7 +166,8 @@ loadConfig verbosity configFile =
Just inp -> case parseBasicStanza configFieldDescrs defaultConf inp of
ParseOk ws conf ->
do when (not $ null ws) $
warn verbosity $ "Config file: " ++ unlines ws
warn verbosity $ "Config file: "
++ unlines [ m | PWarning m <- ws ]
return conf
ParseFailed err ->
do warn verbosity $ "Error parsing config file "
......
......@@ -41,7 +41,8 @@ import qualified Distribution.Simple.Setup as Cabal
RegisterFlags(..), emptyRegisterFlags, registerCommand, unregisterCommand,
SDistFlags(..), emptySDistFlags, sdistCommand,
testCommand-})
import Distribution.Simple.Setup (Flag(..), toFlag, flagToList, trueArg, optionVerbose)
import Distribution.Simple.Setup
( Flag(..), toFlag, flagToList, trueArg, optionVerbosity )
import Distribution.Verbosity (Verbosity, normal)
import Hackage.Types (UnresolvedDependency(..), Username, Password)
import Hackage.ParseUtils (readPToMaybe, parseDependencyOrPackageId)
......@@ -76,7 +77,7 @@ fetchCommand = CommandUI {
commandDescription = Nothing,
commandUsage = usagePackages "fetch",
commandDefaultFlags = toFlag normal,
commandOptions = \_ -> [optionVerbose id const]
commandOptions = \_ -> [optionVerbosity id const]
}
updateCommand :: CommandUI (Flag Verbosity)
......@@ -86,7 +87,7 @@ updateCommand = CommandUI {
commandDescription = Nothing,
commandUsage = usagePackages "update",
commandDefaultFlags = toFlag normal,
commandOptions = \_ -> [optionVerbose id const]
commandOptions = \_ -> [optionVerbosity id const]
}
upgradeCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags)
......@@ -119,7 +120,7 @@ infoCommand = CommandUI {
commandDescription = Nothing,
commandUsage = usagePackages "info",
commandDefaultFlags = toFlag normal,
commandOptions = \_ -> [optionVerbose id const]
commandOptions = \_ -> [optionVerbosity id const]
}
checkCommand :: CommandUI (Flag Verbosity)
......@@ -157,7 +158,7 @@ listCommand = CommandUI {
commandUsage = usagePackages "list",
commandDefaultFlags = defaultListFlags,
commandOptions = \_ -> [
optionVerbose listVerbosity (\v flags -> flags { listVerbosity = v })
optionVerbosity listVerbosity (\v flags -> flags { listVerbosity = v })
, option [] ["installed"]
"Only print installed packages"
......@@ -278,7 +279,7 @@ uploadCommand = CommandUI {
++ "Flags for upload:",
commandDefaultFlags = defaultUploadFlags,
commandOptions = \_ ->
[optionVerbose uploadVerbosity (\v flags -> flags { uploadVerbosity = v })
[optionVerbosity uploadVerbosity (\v flags -> flags { uploadVerbosity = v })
,option ['c'] ["check"]
"Do not upload, just do QA checks."
......
......@@ -61,7 +61,7 @@ sdist flags = do
notice verbosity $ "Source tarball created: " ++ targzFile
where
verbosity = fromFlag (sDistVerbose flags)
verbosity = fromFlag (sDistVerbosity flags)
snapshot = fromFlag (sDistSnapshot flags)
-- |Create an archive from a tree of source files, and clean up the tree.
......
......@@ -105,7 +105,7 @@ mainWorker args =
-- ,wrapperAction makefileCommand
]
wrapperAction :: CommandUI flags -> Command (IO ())
wrapperAction :: Monoid flags => CommandUI flags -> Command (IO ())
wrapperAction command =
commandAddAction command $ \flags extraArgs ->
let args = commandName command : commandShowOptions command flags ++ extraArgs
......@@ -114,7 +114,7 @@ wrapperAction command =
configureAction :: Cabal.ConfigFlags -> [String] -> IO ()
configureAction flags extraArgs = do
configFile <- defaultConfigFile --FIXME
let verbosity = fromFlagOrDefault normal (Cabal.configVerbose flags)
let verbosity = fromFlagOrDefault normal (Cabal.configVerbosity flags)
config <- loadConfig verbosity configFile
let flags' = savedConfigToConfigFlags (Cabal.configUserInstall flags) config
`mappend` flags
......@@ -126,7 +126,7 @@ installAction :: (Cabal.ConfigFlags, InstallFlags) -> [String] -> IO ()
installAction (cflags,iflags) extraArgs = do
pkgs <- either die return (parsePackageArgs extraArgs)
configFile <- defaultConfigFile --FIXME
let verbosity = fromFlagOrDefault normal (Cabal.configVerbose cflags)
let verbosity = fromFlagOrDefault normal (Cabal.configVerbosity cflags)
config <- loadConfig verbosity configFile
let cflags' = savedConfigToConfigFlags (Cabal.configUserInstall cflags) config
`mappend` cflags
......@@ -160,7 +160,7 @@ updateAction verbosityFlag _extraArgs = do
upgradeAction :: (Cabal.ConfigFlags, InstallFlags) -> [String] -> IO ()
upgradeAction (cflags,iflags) _extraArgs = do
configFile <- defaultConfigFile --FIXME
let verbosity = fromFlagOrDefault normal (Cabal.configVerbose cflags)
let verbosity = fromFlagOrDefault normal (Cabal.configVerbosity cflags)
config <- loadConfig verbosity configFile
let cflags' = savedConfigToConfigFlags (Cabal.configUserInstall cflags) config
`mappend` cflags
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment