Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4a951329d57a9df7f9795c3cdb3c4541d3cd938d >--------------------------------------------------------------- commit 4a951329d57a9df7f9795c3cdb3c4541d3cd938d Author: Duncan Coutts <[email protected]> Date: Fri Jan 16 00:28:51 2009 +0000 Parse compiler field from old config files correctly Really old versions of cabal-install generated a default config containing "compiler: GHC". Sadly the new way we generate the config file parser from the command line parser means we end up with a case-sensitive parser as it only matches the exact command line flags. So we hack it and add in a traditional parser for that field only. Really the command line and config file infrastructure needs rewriting again. Sigh. >--------------------------------------------------------------- cabal-install/Distribution/Client/Config.hs | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs index cd5eda9..101474d 100644 --- a/cabal-install/Distribution/Client/Config.hs +++ b/cabal-install/Distribution/Client/Config.hs @@ -46,6 +46,8 @@ import Distribution.ParseUtils , simpleField, listField, parseFilePathQ, showFilePath, parseTokenQ ) import qualified Distribution.ParseUtils as ParseUtils ( Field(..) ) +import qualified Distribution.Text as Text + ( Text(..) ) import Distribution.ReadE ( readP_to_E ) import Distribution.Simple.Command @@ -74,7 +76,7 @@ import qualified Data.Map as Map import qualified Distribution.Compat.ReadP as Parse ( option ) import qualified Text.PrettyPrint.HughesPJ as Disp - ( Doc, render, text, colon, vcat, isEmpty, nest ) + ( Doc, render, text, colon, vcat, empty, isEmpty, nest ) import Text.PrettyPrint.HughesPJ ( (<>), (<+>), ($$), ($+$) ) import System.Directory @@ -296,6 +298,13 @@ configFieldDescriptions = (configureOptions ParseArgs) (["scratchdir", "configure-option"] ++ map fieldName installDirsFields) + --FIXME: this is only here because viewAsFieldDescr gives us a parser + -- that only recognises 'ghc' etc, the case-sensitive flag names, not + -- what the normal case-insensitive parser gives us. + ++ [liftConfigFlag $ simpleField "compiler" + (fromFlagOrDefault Disp.empty . fmap Text.disp) (optional Text.parse) + configHcFlavor (\v flags -> flags { configHcFlavor = v })] + ++ toSavedConfig liftUploadFlag (commandOptions uploadCommand ParseArgs) ["verbose", "check"] @@ -306,6 +315,7 @@ configFieldDescriptions = | opt <- options , let field = viewAsFieldDescr opt , fieldName field `notElem` excluded ] + optional = Parse.option mempty . fmap toFlag -- TODO: next step, make the deprecated fields elicit a warning. -- _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
