Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch :
http://hackage.haskell.org/trac/ghc/changeset/6d4bc5e59be3cec62688a0a575e30b83875b3cef >--------------------------------------------------------------- commit 6d4bc5e59be3cec62688a0a575e30b83875b3cef Author: Duncan Coutts <[email protected]> Date: Sun Oct 5 05:38:21 2008 +0000 When finalising paired packages, cope with there being multiple choices For ordinary packages we selected a single version which means we added an equality constraint. As a consequence we used to assume there was only one version left when finalising. For paired packages there may be two versions left if the package did not directly constrain the choice to just one. If there is more than one version remaining then we have to pick between them. At the moment we still pick the highest version, but later we can take a global preference or polciy into account. >--------------------------------------------------------------- .../Distribution/Client/Dependency/TopDown.hs | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cabal-install/Distribution/Client/Dependency/TopDown.hs b/cabal-install/Distribution/Client/Dependency/TopDown.hs index cd54be2..3dd42eb 100644 --- a/cabal-install/Distribution/Client/Dependency/TopDown.hs +++ b/cabal-install/Distribution/Client/Dependency/TopDown.hs @@ -410,11 +410,15 @@ finaliseSelectedPackages selected constraints = finaliseInstalled (InstalledPackage pkg _ _) = InstallPlan.PreExisting pkg finaliseAvailable (SemiConfiguredPackage pkg flags deps) = InstallPlan.Configured (ConfiguredPackage pkg flags deps') - where deps' = [ packageId pkg' - | dep <- deps - , let pkg' = case PackageIndex.lookupDependency selected dep of - [pkg''] -> pkg'' - _ -> impossible ] + where + deps' = map (packageId . pickRemaining) deps + pickRemaining dep = + case PackageIndex.lookupDependency remainingChoices dep of + [] -> impossible + [pkg'] -> pkg' + remaining -> maximumBy bestByPref remaining + bestByPref = comparing (\p -> (isPreferred p, packageVersion p)) + isPreferred _ = True -- | Improve an existing installation plan by, where possible, swapping -- packages we plan to install with ones that are already installed. _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
