Commit e7e53d95 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

Force Cabal >= 1.19.2 when --allow-newer is enabled.

Fixes #1624.
parent 0ce9d92f
......@@ -15,7 +15,7 @@ module Distribution.Client.Configure (
) where
import Distribution.Client.Dependency
import Distribution.Client.Dependency.Types (AllowNewer(..))
import Distribution.Client.Dependency.Types (AllowNewer(..), isAllowNewer)
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.InstallPlan (InstallPlan)
import Distribution.Client.IndexUtils as IndexUtils
......@@ -52,6 +52,8 @@ import Distribution.System
( Platform )
import Distribution.Verbosity as Verbosity
( Verbosity )
import Distribution.Version
( Version(..), orLaterVersion )
import Data.Monoid (Monoid(..))
......@@ -93,8 +95,13 @@ configure verbosity packageDBs repos comp platform conf
++ "one local ready package."
where
allowNewer = fromFlagOrDefault False $
fmap isAllowNewer (configAllowNewer configExFlags)
setupScriptOptions index = SetupScriptOptions {
useCabalVersion = maybe anyVersion thisVersion
useCabalVersion = maybe (if allowNewer
then orLaterVersion (Version [1,19,2] [])
else anyVersion)
thisVersion
(flagToMaybe (configCabalVersion configExFlags)),
useCompiler = Just comp,
usePlatform = Just platform,
......
......@@ -17,7 +17,7 @@ module Distribution.Client.Dependency.Types (
Solver(..),
DependencyResolver,
AllowNewer(..),
AllowNewer(..), isAllowNewer,
PackageConstraint(..),
PackagePreferences(..),
InstalledPreference(..),
......@@ -184,6 +184,12 @@ data AllowNewer =
-- | Ignore upper bounds in dependencies on all packages.
| AllowNewerAll
-- | Convert 'AllowNewer' to a boolean.
isAllowNewer :: AllowNewer -> Bool
isAllowNewer AllowNewerNone = False
isAllowNewer (AllowNewerSome _) = True
isAllowNewer AllowNewerAll = True
-- | A type to represent the unfolding of an expensive long running
-- calculation that may fail. We may get intermediate steps before the final
-- retult which may be used to indicate progress and\/or logging messages.
......
......@@ -59,7 +59,7 @@ import System.IO.Error
import Distribution.Client.Targets
import Distribution.Client.Dependency
import Distribution.Client.Dependency.Types
( Solver(..) )
( AllowNewer, Solver(..), isAllowNewer )
import Distribution.Client.FetchUtils
import qualified Distribution.Client.Haddock as Haddock (regenerateHaddockIndex)
import Distribution.Client.IndexUtils as IndexUtils
......@@ -131,7 +131,7 @@ import Distribution.PackageDescription.Configuration
import Distribution.ParseUtils
( showPWarning )
import Distribution.Version
( Version, anyVersion, thisVersion )
( Version(..), anyVersion, orLaterVersion, thisVersion )
import Distribution.Simple.Utils as Utils
( notice, info, warn, debug, debugNoWrap, die
, intercalate, withTempDirectory )
......@@ -916,9 +916,14 @@ performInstallations verbosity
parallelInstall = numJobs >= 2
distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(configDistPref configFlags)
allowNewer = fromFlagOrDefault False $
fmap isAllowNewer (configAllowNewer configExFlags)
setupScriptOptions index lock = SetupScriptOptions {
useCabalVersion = maybe anyVersion thisVersion (libVersion miscOptions),
useCabalVersion = maybe (if allowNewer
then orLaterVersion (Version [1,19,2] [])
else anyVersion)
thisVersion (libVersion miscOptions),
useCompiler = Just comp,
usePlatform = Just platform,
-- Hack: we typically want to allow the UserPackageDB for finding the
......
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