Commit 6d22eb2e authored by Mikhail Glushenkov's avatar Mikhail Glushenkov Committed by GitHub
Browse files

Merge branch 'master' into pr/global-store-flag

parents fbdd244f 0fdf2174
......@@ -22,6 +22,7 @@ module Distribution.Simple.Program.Run (
runProgramInvocation,
getProgramInvocationOutput,
getProgramInvocationOutputAndErrors,
getEffectiveEnvironment,
) where
......@@ -148,7 +149,16 @@ runProgramInvocation verbosity
getProgramInvocationOutput :: Verbosity -> ProgramInvocation -> IO String
getProgramInvocationOutput verbosity
getProgramInvocationOutput verbosity inv = do
(output, errors, exitCode) <- getProgramInvocationOutputAndErrors verbosity inv
when (exitCode /= ExitSuccess) $
die' verbosity $ "'" ++ progInvokePath inv ++ "' exited with an error:\n" ++ errors
return output
getProgramInvocationOutputAndErrors :: Verbosity -> ProgramInvocation
-> IO (String, String, ExitCode)
getProgramInvocationOutputAndErrors verbosity
ProgramInvocation {
progInvokePath = path,
progInvokeArgs = args,
......@@ -167,9 +177,7 @@ getProgramInvocationOutput verbosity
path args
mcwd menv
input utf8
when (exitCode /= ExitSuccess) $
die' verbosity $ "'" ++ path ++ "' exited with an error:\n" ++ errors
return (decode output)
return (decode output, errors, exitCode)
where
input =
case minputStr of
......
......@@ -2539,6 +2539,7 @@ field of the stanza that is using it, besides :pkg-field:`other-modules` or
complex build hooks for this poweruser case.
.. pkg-field:: autogen-modules: module list
:since: 2.0
.. TODO: document autogen-modules field
......
......@@ -758,16 +758,36 @@ The following settings control the behavior of the dependency solver:
-- Disregard all upper bounds when dependency solving
allow-newer: all
-- Disregard all `^>=`-style upper bounds when dependency solving
allow-newer: ^all
For consistency, there is also the explicit wildcard scope syntax
``*`` (or its alphabetic synonym ``all``). Consequently, the first
part of the example above is equivalent to the explicitly scoped
variant:
``*`` (or its alphabetic synonym ``all``). Consequently, the
examples above are equivalent to the explicitly scoped variants:
::
allow-newer: all:bar, *:baz, *:^quux
allow-newer: *:*
allow-newer: all:all
allow-newer: *:^*
allow-newer: all:^all
In order to ignore all bounds specified by a package ``pkg-1.2.3``
you can combine scoping with a right-hand-side wildcard like so
::
-- Disregard any upper bounds specified by pkg-1.2.3
allow-newer: pkg-1.2.3:*
-- Disregard only `^>=`-style upper bounds in pkg-1.2.3
allow-newer: pkg-1.2.3:^*
:cfg-field:`allow-newer` is often used in conjunction with a constraint
(in the cfg-field:`constraints` field) forcing the usage of a specific,
newer version of a package.
......@@ -778,6 +798,7 @@ The following settings control the behavior of the dependency solver:
.. cfg-field:: allow-older: none, all, list of scoped package names (space or comma separated)
--allow-older, --allow-older=[none,all,[scope:][^]pkg]
:synopsis: Lift dependency lower bound constaints.
:since: 2.0
:default: ``none``
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: bench
--
......@@ -17,7 +18,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
......@@ -75,7 +77,7 @@ benchCommand = Client.installCommand {
--
benchAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
benchAction (configFlags, configExFlags, installFlags, haddockFlags)
benchAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: build
--
module Distribution.Client.CmdBuild (
......@@ -15,7 +17,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
......@@ -72,7 +75,7 @@ buildCommand = Client.installCommand {
--
buildAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
buildAction (configFlags, configExFlags, installFlags, haddockFlags)
buildAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: configure
--
module Distribution.Client.CmdConfigure (
......@@ -14,7 +15,8 @@ import Distribution.Client.ProjectConfig
( writeProjectLocalExtraConfig )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
import Distribution.Verbosity
......@@ -80,7 +82,7 @@ configureCommand = Client.installCommand {
--
configureAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
configureAction (configFlags, configExFlags, installFlags, haddockFlags)
configureAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
_extraArgs globalFlags = do
--TODO: deal with _extraArgs, since flags with wrong syntax end up there
......
{-# LANGUAGE CPP, NamedFieldPuns, RecordWildCards #-}
{-# LANGUAGE CPP, NamedFieldPuns, RecordWildCards, ViewPatterns #-}
-- | cabal-install CLI command: freeze
--
......@@ -31,7 +31,8 @@ import Distribution.Version
import Distribution.PackageDescription
( FlagAssignment )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
import Distribution.Simple.Utils
......@@ -101,7 +102,7 @@ freezeCommand = Client.installCommand {
--
freezeAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
freezeAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
extraArgs globalFlags = do
unless (null extraArgs) $
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: haddock
--
......@@ -17,7 +18,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags(..), fromFlagOrDefault, fromFlag )
......@@ -71,7 +73,7 @@ haddockCommand = Client.installCommand {
--
haddockAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
haddockAction (configFlags, configExFlags, installFlags, haddockFlags)
haddockAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: repl
--
......@@ -17,7 +18,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
......@@ -87,7 +89,7 @@ replCommand = Client.installCommand {
--
replAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
replAction (configFlags, configExFlags, installFlags, haddockFlags)
replAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: run
--
......@@ -20,7 +21,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
......@@ -35,7 +37,7 @@ import Distribution.Verbosity
import Distribution.Simple.Utils
( wrapText, die', ordNub, info )
import Distribution.Client.ProjectPlanning
( ElaboratedConfiguredPackage(..)
( ElaboratedConfiguredPackage(..), BuildStyle(..)
, ElaboratedInstallPlan, binDirectoryFor )
import Distribution.Client.InstallPlan
( toList, foldPlanPackage )
......@@ -50,13 +52,13 @@ import Distribution.Simple.Build.PathsModule
( pkgPathEnvVar )
import Distribution.Types.UnitId
( UnitId )
import Distribution.Client.Types
( PackageLocation(..) )
import qualified Data.Map as Map
import qualified Data.Set as Set
import System.FilePath
( (</>) )
import System.Directory
( getCurrentDirectory )
runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
......@@ -106,7 +108,7 @@ runCommand = Client.installCommand {
--
runAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
runAction (configFlags, configExFlags, installFlags, haddockFlags)
runAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......@@ -206,16 +208,13 @@ runAction (configFlags, configExFlags, installFlags, haddockFlags)
pkg
exeName
</> exeName
curDir <- getCurrentDirectory
let dataDirEnvVar = (pkgPathEnvVar (elabPkgDescription pkg) "datadir",
Just $ curDir </> dataDir (elabPkgDescription pkg))
args = drop 1 targetStrings
let args = drop 1 targetStrings
runProgramInvocation
verbosity
emptyProgramInvocation {
progInvokePath = exePath,
progInvokeArgs = args,
progInvokeEnv = [dataDirEnvVar]
progInvokeEnv = dataDirsEnvironmentForPlan elaboratedPlan
}
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
......@@ -223,6 +222,39 @@ runAction (configFlags, configExFlags, installFlags, haddockFlags)
globalFlags configFlags configExFlags
installFlags haddockFlags
-- | Construct the environment needed for the data files to work.
-- This consists of a separate @*_datadir@ variable for each
-- inplace package in the plan.
dataDirsEnvironmentForPlan :: ElaboratedInstallPlan
-> [(String, Maybe FilePath)]
dataDirsEnvironmentForPlan = catMaybes
. fmap (foldPlanPackage
(const Nothing)
dataDirEnvVarForPackage)
. toList
-- | Construct an environment variable that points
-- the package's datadir to its correct location.
-- This might be:
-- * 'Just' the package's source directory plus the data subdirectory
-- for inplace packages.
-- * 'Nothing' for packages installed in the store (the path was
-- already included in the package at install/build time).
-- * The other cases are not handled yet. See below.
dataDirEnvVarForPackage :: ElaboratedConfiguredPackage
-> Maybe (String, Maybe FilePath)
dataDirEnvVarForPackage pkg =
case (elabBuildStyle pkg, elabPkgSourceLocation pkg)
of (BuildAndInstall, _) -> Nothing
(BuildInplaceOnly, LocalUnpackedPackage path) -> Just
(pkgPathEnvVar (elabPkgDescription pkg) "datadir",
Just $ path </> dataDir (elabPkgDescription pkg))
-- TODO: handle the other cases for PackageLocation.
-- We will only need this when we add support for
-- remote/local tarballs.
(BuildInplaceOnly, _) -> Nothing
singleExeOrElse :: IO (UnitId, UnqualComponentName) -> TargetsMap -> IO (UnitId, UnqualComponentName)
singleExeOrElse action targetsMap =
case Set.toList . distinctTargetComponents $ targetsMap
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ViewPatterns #-}
-- | cabal-install CLI command: test
--
......@@ -17,7 +18,8 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, applyFlagDefaults )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
......@@ -78,7 +80,7 @@ testCommand = Client.installCommand {
--
testAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
-> [String] -> GlobalFlags -> IO ()
testAction (configFlags, configExFlags, installFlags, haddockFlags)
testAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig
......
......@@ -46,7 +46,7 @@ module Distribution.Client.Config (
import Distribution.Client.Types
( RemoteRepo(..), Username(..), Password(..), emptyRemoteRepo
, AllowOlder(..), AllowNewer(..), RelaxDeps(..)
, AllowOlder(..), AllowNewer(..), RelaxDeps(..), isRelaxDeps
)
import Distribution.Client.BuildReports.Types
( ReportLevel(..) )
......@@ -705,8 +705,8 @@ commentSavedConfig = do
},
savedInstallFlags = defaultInstallFlags,
savedConfigureExFlags = defaultConfigExFlags {
configAllowNewer = Just (AllowNewer RelaxDepsNone),
configAllowOlder = Just (AllowOlder RelaxDepsNone)
configAllowNewer = Just (AllowNewer mempty),
configAllowOlder = Just (AllowOlder mempty)
},
savedConfigureFlags = (defaultConfigFlags defaultProgramDb) {
configUserInstall = toFlag defaultUserInstall
......@@ -863,12 +863,12 @@ configFieldDescriptions src =
optional = Parse.option mempty . fmap toFlag
showRelaxDeps Nothing = mempty
showRelaxDeps (Just RelaxDepsNone) = Disp.text "False"
showRelaxDeps (Just _) = Disp.text "True"
showRelaxDeps Nothing = mempty
showRelaxDeps (Just rd) | isRelaxDeps rd = Disp.text "True"
| otherwise = Disp.text "False"
toRelaxDeps True = RelaxDepsAll
toRelaxDeps False = RelaxDepsNone
toRelaxDeps False = mempty
-- TODO: next step, make the deprecated fields elicit a warning.
......
......@@ -97,20 +97,14 @@ chooseCabalVersion configExFlags maybeVersion =
-- Cabal < 1.19.2 doesn't support '--exact-configuration' which is needed
-- for '--allow-newer' to work.
allowNewer = isRelaxDeps
(maybe RelaxDepsNone unAllowNewer $ configAllowNewer configExFlags)
(maybe mempty unAllowNewer $ configAllowNewer configExFlags)
allowOlder = isRelaxDeps
(maybe RelaxDepsNone unAllowOlder $ configAllowOlder configExFlags)
(maybe mempty unAllowOlder $ configAllowOlder configExFlags)
defaultVersionRange = if allowOlder || allowNewer
then orLaterVersion (mkVersion [1,19,2])
else anyVersion
-- | Convert 'RelaxDeps' to a boolean.
isRelaxDeps :: RelaxDeps -> Bool
isRelaxDeps RelaxDepsNone = False
isRelaxDeps (RelaxDepsSome _) = True
isRelaxDeps RelaxDepsAll = True
-- | Configure the package found in the local directory
configure :: Verbosity
-> PackageDBStack
......@@ -325,9 +319,9 @@ planLocalPackage verbosity comp platform configFlags configExFlags
resolverParams =
removeLowerBounds
(fromMaybe (AllowOlder RelaxDepsNone) $ configAllowOlder configExFlags)
(fromMaybe (AllowOlder mempty) $ configAllowOlder configExFlags)
. removeUpperBounds
(fromMaybe (AllowNewer RelaxDepsNone) $ configAllowNewer configExFlags)
(fromMaybe (AllowNewer mempty) $ configAllowNewer configExFlags)
. addPreferences
-- preferences from the config file or command line
......
......@@ -73,7 +73,7 @@ import Distribution.Client.Types
( SourcePackageDb(SourcePackageDb)
, UnresolvedPkgLoc, UnresolvedSourcePackage
, AllowNewer(..), AllowOlder(..), RelaxDeps(..), RelaxedDep(..)
, RelaxDepScope(..), RelaxDepMod(..)
, RelaxDepScope(..), RelaxDepMod(..), RelaxDepSubject(..), isRelaxDeps
)
import Distribution.Client.Dependency.Types
( PreSolver(..), Solver(..)
......@@ -434,8 +434,8 @@ data RelaxKind = RelaxLower | RelaxUpper
-- | Common internal implementation of 'removeLowerBounds'/'removeUpperBounds'
removeBounds :: RelaxKind -> RelaxDeps -> DepResolverParams -> DepResolverParams
removeBounds _relKind RelaxDepsNone params = params -- no-op optimisation
removeBounds relKind relDeps params =
removeBounds _ rd params | not (isRelaxDeps rd) = params -- no-op optimisation
removeBounds relKind relDeps params =
params {
depResolverSourcePkgIndex = sourcePkgIndex'
}
......@@ -454,9 +454,10 @@ removeBounds relKind relDeps params =
relaxPackageDeps :: RelaxKind
-> RelaxDeps
-> PD.GenericPackageDescription -> PD.GenericPackageDescription
relaxPackageDeps _ RelaxDepsNone gpd = gpd -- subsumed by no-op case in 'removeBounds'
relaxPackageDeps _ rd gpd | not (isRelaxDeps rd) = gpd -- subsumed by no-op case in 'removeBounds'
relaxPackageDeps relKind RelaxDepsAll gpd = PD.transformAllBuildDepends relaxAll gpd
where
relaxAll :: Dependency -> Dependency
relaxAll (Dependency pkgName verRange) =
Dependency pkgName (removeBound relKind RelaxDepModNone verRange)
......@@ -467,7 +468,7 @@ relaxPackageDeps relKind (RelaxDepsSome depsToRelax0) gpd =
thisPkgId = packageId gpd
depsToRelax = Map.fromList $ mapMaybe f depsToRelax0
f :: RelaxedDep -> Maybe (PackageName,RelaxDepMod)
f :: RelaxedDep -> Maybe (RelaxDepSubject,RelaxDepMod)
f (RelaxedDep scope rdm p) = case scope of
RelaxDepScopeAll -> Just (p,rdm)
RelaxDepScopePackage p0
......@@ -479,7 +480,11 @@ relaxPackageDeps relKind (RelaxDepsSome depsToRelax0) gpd =
relaxSome :: Dependency -> Dependency
relaxSome d@(Dependency depName verRange)
| Just relMod <- Map.lookup depName depsToRelax =
| Just relMod <- Map.lookup RelaxDepSubjectAll depsToRelax =
-- a '*'-subject acts absorbing, for consistency with
-- the 'Semigroup RelaxDeps' instance
Dependency depName (removeBound relKind relMod verRange)
| Just relMod <- Map.lookup (RelaxDepSubjectPkg depName) depsToRelax =
Dependency depName (removeBound relKind relMod verRange)
| otherwise = d -- no-op
......
......@@ -38,8 +38,7 @@ import qualified Paths_cabal_install (version)
import Distribution.Verbosity (Verbosity)
import Distribution.Simple.Utils
( die', info, warn, debug, notice, writeFileAtomic
, copyFileVerbose, withTempFile
, rawSystemStdInOut, toUTF8, fromUTF8, normaliseLineEndings )
, copyFileVerbose, withTempFile )
import Distribution.Client.Utils
( withTempFileName )
import Distribution.Client.Types
......@@ -67,7 +66,7 @@ import Distribution.Simple.Program.Db
, configureAllKnownPrograms
, requireProgram, lookupProgram )
import Distribution.Simple.Program.Run
( IOEncoding(..), getEffectiveEnvironment )
( getProgramInvocationOutputAndErrors )
import Numeric (showHex)
import System.Random (randomRIO)
import System.Exit (ExitCode(..))
......@@ -781,38 +780,3 @@ genBoundary :: IO String
genBoundary = do
i <- randomRIO (0x10000000000000,0xFFFFFFFFFFFFFF) :: IO Integer
return $ showHex i ""
------------------------------------------------------------------------------
-- Compat utils
-- TODO: This is only here temporarily so we can release without also requiring
-- the latest Cabal lib. The function is also included in Cabal now.
getProgramInvocationOutputAndErrors :: Verbosity -> ProgramInvocation
-> IO (String, String, ExitCode)
getProgramInvocationOutputAndErrors verbosity
ProgramInvocation {
progInvokePath = path,
progInvokeArgs = args,
progInvokeEnv = envOverrides,
progInvokeCwd = mcwd,
progInvokeInput = minputStr,
progInvokeOutputEncoding = encoding
} = do
let utf8 = case encoding of IOEncodingUTF8 -> True; _ -> False
decode | utf8 = fromUTF8 . normaliseLineEndings
| otherwise = id
menv <- getEffectiveEnvironment envOverrides
(output, errors, exitCode) <- rawSystemStdInOut verbosity
path args
mcwd menv
input utf8
return (decode output, decode errors, exitCode)
where
input =
case minputStr of
Nothing -> Nothing
Just inputStr -> Just $
case encoding of
IOEncodingText -> (inputStr, False)
IOEncodingUTF8 -> (toUTF8 inputStr, True) -- use binary mode for utf8
......@@ -458,9 +458,9 @@ planPackages verbosity comp platform mSandboxPkgInfo solver
upgradeDeps = fromFlag (installUpgradeDeps installFlags)
onlyDeps = fromFlag (installOnlyDeps installFlags)
allowOlder = fromMaybe (AllowOlder RelaxDepsNone)
allowOlder = fromMaybe (AllowOlder mempty)
(configAllowOlder configExFlags)
allowNewer = fromMaybe (AllowNewer RelaxDepsNone)
allowNewer = fromMaybe (AllowNewer mempty)
(configAllowNewer configExFlags)
-- | Remove the provided targets from the install plan.
......
......@@ -221,8 +221,8 @@ resolveSolverSettings ProjectConfig{
defaults = mempty {
projectConfigSolver = Flag defaultSolver,
projectConfigAllowOlder = Just (AllowOlder RelaxDepsNone),
projectConfigAllowNewer = Just (AllowNewer RelaxDepsNone),
projectConfigAllowOlder = Just (AllowOlder mempty),
projectConfigAllowNewer = Just (AllowNewer mempty),
projectConfigMaxBackjumps = Flag defaultMaxBackjumps,
projectConfigReorderGoals = Flag (ReorderGoals False),
projectConfigCountConflicts = Flag (CountConflicts True),
......
......@@ -26,7 +26,7 @@ import Distribution.Client.Compat.Prelude
import Distribution.Client.ProjectConfig.Types
import Distribution.Client.Types
( RemoteRepo(..), emptyRemoteRepo
, AllowNewer(..), AllowOlder(..), RelaxDeps(..) )
, AllowNewer(..), AllowOlder(..) )
import Distribution.Client.Config
( SavedConfig(..), remoteRepoFields )
......@@ -832,12 +832,12 @@ legacySharedConfigFieldDescrs =
configPreferences (\v conf -> conf { configPreferences = v })
, simpleField "allow-older"
(maybe mempty dispRelaxDeps) (fmap Just parseRelaxDeps)
(maybe mempty disp) (fmap Just parse)
(fmap unAllowOlder . configAllowOlder)
(\v conf -> conf { configAllowOlder = fmap AllowOlder v })
, simpleField "allow-newer"
(maybe mempty dispRelaxDeps) (fmap Just parseRelaxDeps)
(maybe mempty disp) (fmap Just parse)
(fmap unAllowNewer . configAllowNewer)