Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c0815a55d12b15313f898cc738c6209356af5479 >--------------------------------------------------------------- commit c0815a55d12b15313f898cc738c6209356af5479 Author: Duncan Coutts <[email protected]> Date: Wed Apr 30 11:47:09 2008 +0000 Add a new --cabal-lib-version flag to the install command It's used to select which version of the Cabal lib to use when configuring, building and installing packages. It's mainly so that we can use cabal-install to help us test that packages build ok with both old and new versions of the Cabal library. In particular we'd like to check every package on hackage to make sure that new Cabal versions are not breaking packages that worked with older versions. >--------------------------------------------------------------- cabal-install/Hackage/Setup.hs | 49 ++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 14 deletions(-) diff --git a/cabal-install/Hackage/Setup.hs b/cabal-install/Hackage/Setup.hs index b51cdd9..94e3bf1 100644 --- a/cabal-install/Hackage/Setup.hs +++ b/cabal-install/Hackage/Setup.hs @@ -43,7 +43,14 @@ import qualified Distribution.Simple.Setup as Cabal testCommand-}) import Distribution.Simple.Setup ( Flag(..), toFlag, flagToList, trueArg, optionVerbosity ) +import Distribution.Version + ( Version ) +import Distribution.Text + ( Text(parse), display ) +import Distribution.ReadE + ( readP_to_E ) import Distribution.Verbosity (Verbosity, normal) + import Hackage.Types (UnresolvedDependency(..), Username, Password) import Hackage.ParseUtils (readPToMaybe, parseDependencyOrPackageId) @@ -183,20 +190,21 @@ instance Monoid ListFlags where -- * Install flags -- ------------------------------------------------------------ --- Install takes exactly the same flags as configure, but with the addition --- of doing --dry-run. - +-- | Install takes the same flags as configure along with a few extras. +-- data InstallFlags = InstallFlags { - installDryRun :: Flag Bool - ,installOnly :: Flag Bool - ,installRootCmd :: Flag String + installDryRun :: Flag Bool, + installOnly :: Flag Bool, + installRootCmd :: Flag String, + installCabalVersion :: Flag Version } defaultInstallFlags :: InstallFlags defaultInstallFlags = InstallFlags { - installDryRun = Flag False - ,installOnly = Flag False - ,installRootCmd = mempty + installDryRun = Flag False, + installOnly = Flag False, + installRootCmd = mempty, + installCabalVersion = mempty } installCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags) @@ -208,8 +216,10 @@ installCommand = configureCommand { commandOptions = \showOrParseArgs -> liftOptionsFst (commandOptions configureCommand showOrParseArgs) ++ liftOptionsSnd - (optionDryRun : optionRootCmd : - case showOrParseArgs of -- TODO: remove when "cabal install" avoids + (optionDryRun + :optionRootCmd + :optionCabalVersion + :case showOrParseArgs of -- TODO: remove when "cabal install" avoids ParseArgs -> [optionOnly] -- reconfiguring/building with dep. analysis _ -> []) -- It's used by --root-cmd. @@ -236,12 +246,23 @@ optionRootCmd = installRootCmd (\v flags -> flags { installRootCmd = v }) (reqArg' "COMMAND" toFlag flagToList) +optionCabalVersion :: OptionField InstallFlags +optionCabalVersion = + option [] ["cabal-lib-version"] + ("Select which version of the Cabal lib to use to build packages " + ++ "(useful for testing).") + installCabalVersion (\v flags -> flags { installCabalVersion = v }) + (reqArg "VERSION" (readP_to_E ("Cannot parse cabal lib version: "++) + (fmap toFlag parse)) + (map display . flagToList)) + instance Monoid InstallFlags where mempty = defaultInstallFlags mappend a b = InstallFlags { - installDryRun = combine installDryRun - ,installOnly = combine installOnly - ,installRootCmd = combine installRootCmd + installDryRun = combine installDryRun, + installOnly = combine installOnly, + installRootCmd = combine installRootCmd, + installCabalVersion = combine installCabalVersion } where combine field = field a `mappend` field b _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
