[commit: Cabal] master: Install phase pulls in benchmark dependencies when necessary (6e93fe6)
Ian Lynagh
igloo at earth.li
Sat Oct 15 02:46:44 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/6e93fe64e61c1f18ba5a08baccd3495dd54078b4
>---------------------------------------------------------------
commit 6e93fe64e61c1f18ba5a08baccd3495dd54078b4
Author: Johan Tibell <johan.tibell at gmail.com>
Date: Wed Oct 12 21:00:35 2011 +0000
Install phase pulls in benchmark dependencies when necessary
>---------------------------------------------------------------
cabal-install/Distribution/Client/Install.hs | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/cabal-install/Distribution/Client/Install.hs b/cabal-install/Distribution/Client/Install.hs
index f678ee9..626089c 100644
--- a/cabal-install/Distribution/Client/Install.hs
+++ b/cabal-install/Distribution/Client/Install.hs
@@ -100,7 +100,8 @@ import Distribution.Package
, Dependency(..), thisPackageVersion )
import qualified Distribution.PackageDescription as PackageDescription
import Distribution.PackageDescription
- ( PackageDescription, GenericPackageDescription(..), TestSuite(..) )
+ ( Benchmark(..), PackageDescription, GenericPackageDescription(..)
+ , TestSuite(..) )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription, mapTreeData )
import Distribution.Version
@@ -249,11 +250,11 @@ planPackages comp configFlags configExFlags installFlags
[ PackageConstraintFlags (pkgSpecifierTarget pkgSpecifier) flags
| let flags = configConfigurationsFlags configFlags
, not (null flags)
- , pkgSpecifier <- pkgSpecifiers' ]
+ , pkgSpecifier <- pkgSpecifiers'' ]
. (if reinstall then reinstallTargets else id)
- $ standardInstallPolicy installedPkgIndex sourcePkgDb pkgSpecifiers'
+ $ standardInstallPolicy installedPkgIndex sourcePkgDb pkgSpecifiers''
-- Mark test suites as enabled if invoked with '--enable-tests'. This
-- ensures that test suite dependencies are included.
@@ -267,6 +268,18 @@ planPackages comp configFlags configExFlags installFlags
{ condTestSuites = map (\(n, t) -> (n, enable t)) suites } }
enableTests x = x
+ -- Mark benchmarks as enabled if invoked with
+ -- '--enable-benchmarks'. This ensures that benchmark dependencies
+ -- are included.
+ pkgSpecifiers'' = map enableBenchmarks pkgSpecifiers'
+ benchmarksEnabled = fromFlagOrDefault False $ configBenchmarks configFlags
+ enableBenchmarks (SpecificSourcePackage pkg) =
+ let pkgDescr = Source.packageDescription pkg
+ bms = condBenchmarks pkgDescr
+ enable = mapTreeData (\t -> t { benchmarkEnabled = benchmarksEnabled })
+ in SpecificSourcePackage $ pkg { Source.packageDescription = pkgDescr
+ { condBenchmarks = map (\(n, t) -> (n, enable t)) bms } }
+ enableBenchmarks x = x
--TODO: this is a general feature and should be moved to D.C.Dependency
-- Also, the InstallPlan.remove should return info more precise to the
More information about the Cvs-libraries
mailing list