diff --git a/cabal-install/src/Distribution/Client/CmdOutdated.hs b/cabal-install/src/Distribution/Client/CmdOutdated.hs index 6a9762ff4e8..3a94c314a78 100644 --- a/cabal-install/src/Distribution/Client/CmdOutdated.hs +++ b/cabal-install/src/Distribution/Client/CmdOutdated.hs @@ -11,12 +11,6 @@ module Distribution.Client.CmdOutdated import qualified Data.Set as Set import Distribution.Client.Compat.Prelude -import Distribution.Client.Config - ( SavedConfig - ( savedGlobalFlags - ) - ) -import Distribution.Client.Errors (CabalInstallException (OutdatedAction)) import qualified Distribution.Client.IndexUtils as IndexUtils import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -41,14 +35,10 @@ import Distribution.Client.ProjectOrchestration , ProjectBaseContext (..) , establishProjectBaseContext ) -import Distribution.Client.Sandbox - ( loadConfigOrSandboxConfig - ) import Distribution.Client.Setup ( ConfigFlags (..) , GlobalFlags (..) , configCompilerAux' - , withRepoContext ) import Distribution.Client.Types.PackageLocation ( UnresolvedPkgLoc @@ -79,7 +69,6 @@ import Distribution.Simple.Setup ) import Distribution.Simple.Utils ( debug - , dieWithException , wrapText ) import Distribution.Solver.Types.SourcePackage @@ -103,7 +92,6 @@ import Distribution.Types.UnqualComponentName (UnqualComponentName) import Distribution.Verbosity ( lessVerbose , normal - , silent ) import Distribution.Version ( simplifyVersionRange @@ -139,13 +127,18 @@ outdatedAction flags@NixStyleFlags{configFlags} _extraArgs globalFlags = do (projectConfigShared projectConfig) (projectConfigBuildOnly projectConfig) $ \repoContext -> do - -- Why? - -- when (not v2FreezeFile && (isJust mprojectDir || isJust mprojectFile)) $ - -- dieWithException verbosity OutdatedAction + let mprojectDir = flagToMaybe . flagProjectDir $ projectFlags flags + mprojectFile = flagToMaybe . flagProjectFile $ projectFlags flags + (comp, platform, _progdb) <- configCompilerAux' configFlags sourcePkgDb <- IndexUtils.getSourcePackages verbosity repoContext - let pkgVerConstraints = extractPackageVersionConstraints localPackages + pkgVerConstraints <- + if + | v1FreezeFile -> V1Outdated.depsFromFreezeFile verbosity + | v2FreezeFile -> + V1Outdated.depsFromNewFreezeFile verbosity globalFlags comp platform mprojectDir mprojectFile + | otherwise -> pure $ extractPackageVersionConstraints localPackages debug verbosity $ "Dependencies loaded: " ++ intercalate ", " (map prettyShow pkgVerConstraints)