Commit 748fe144 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Remove a module dependency to avoid cyclic imports

parent 88fcc0d2
......@@ -83,7 +83,9 @@ fetch verbosity packageDBs repos comp conf
sourcePkgDb <- getSourcePackages verbosity repos
pkgSpecifiers <- resolveUserTargets verbosity
globalFlags (packageIndex sourcePkgDb) userTargets
(fromFlag $ globalWorldFile globalFlags)
(packageIndex sourcePkgDb)
userTargets
pkgs <- planPackages
verbosity comp fetchFlags
......
......@@ -159,7 +159,9 @@ install verbosity packageDBs repos comp conf
| otherwise = userTargets0
pkgSpecifiers <- resolveUserTargets verbosity
globalFlags (packageIndex sourcePkgDb) userTargets
(fromFlag $ globalWorldFile globalFlags)
(packageIndex sourcePkgDb)
userTargets
notice verbosity "Resolving dependencies..."
installPlan <- foldProgress logMsg die return $
......
......@@ -155,7 +155,8 @@ info verbosity packageDBs repos comp conf
$ map packageId (PackageIndex.allPackages installedPkgIndex)
++ map packageId (PackageIndex.allPackages sourcePkgIndex)
pkgSpecifiers <- resolveUserTargets verbosity
globalFlags sourcePkgs' userTargets
(fromFlag $ globalWorldFile globalFlags)
sourcePkgs' userTargets
pkgsinfo <- sequence
[ do pkginfo <- either die return $
......
......@@ -58,10 +58,6 @@ import Distribution.PackageDescription
( GenericPackageDescription )
import Distribution.PackageDescription.Parse
( readPackageDescription, parsePackageDescription, ParseResult(..) )
import Distribution.Simple.Setup
( fromFlag )
import Distribution.Client.Setup
( GlobalFlags(..) )
import Distribution.Version
( Version(Version), thisVersion, anyVersion, isAnyVersion )
import Distribution.Text
......@@ -341,17 +337,17 @@ reportUserTargetProblems problems = do
--
resolveUserTargets :: Package pkg
=> Verbosity
-> GlobalFlags
-> FilePath
-> PackageIndex pkg
-> [UserTarget]
-> IO [PackageSpecifier SourcePackage]
resolveUserTargets verbosity globalFlags available userTargets = do
resolveUserTargets verbosity worldFile available userTargets = do
-- given the user targets, get a list of fully or partially resolved
-- package references
packageTargets <- mapM (readPackageTarget verbosity)
=<< mapM (fetchPackageTarget verbosity) . concat
=<< mapM (expandUserTarget globalFlags) userTargets
=<< mapM (expandUserTarget worldFile) userTargets
-- users are allowed to give package names case-insensitively, so we must
-- disambiguate named package references
......@@ -391,10 +387,10 @@ data PackageTarget pkg =
-- | Given a user-specified target, expand it to a bunch of package targets
-- (each of which refers to only one package).
--
expandUserTarget :: GlobalFlags
expandUserTarget :: FilePath
-> UserTarget
-> IO [PackageTarget (PackageLocation ())]
expandUserTarget globalFlags userTarget = case userTarget of
expandUserTarget worldFile userTarget = case userTarget of
UserTargetNamed (Dependency name vrange) ->
let constraints = [ PackageVersionConstraint name vrange
......@@ -424,8 +420,6 @@ expandUserTarget globalFlags userTarget = case userTarget of
UserTargetRemoteTarball tarballURL ->
return [ PackageTargetLocation (RemoteTarballPackage tarballURL ()) ]
where
worldFile = fromFlag $ globalWorldFile globalFlags
-- ------------------------------------------------------------
......
......@@ -21,7 +21,7 @@ module Distribution.Client.Unpack (
import Distribution.Package
( PackageId, packageId )
import Distribution.Simple.Setup
( fromFlagOrDefault )
( fromFlag, fromFlagOrDefault )
import Distribution.Simple.Utils
( notice, die )
import Distribution.Verbosity
......@@ -63,7 +63,9 @@ unpack verbosity repos globalFlags unpackFlags userTargets = do
sourcePkgDb <- getSourcePackages verbosity repos
pkgSpecifiers <- resolveUserTargets verbosity
globalFlags (packageIndex sourcePkgDb) userTargets
(fromFlag $ globalWorldFile globalFlags)
(packageIndex sourcePkgDb)
userTargets
pkgs <- either (die . unlines . map show) return $
resolveWithoutDependencies
......
Supports Markdown
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