Commit 026156ac authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Cope with intra-package deps when constructing install plans

parent e4a087d0
......@@ -36,6 +36,8 @@ import Distribution.Package
, PackageFixedDeps(depends) )
import Distribution.PackageDescription
( PackageDescription(buildDepends) )
import Distribution.Client.PackageUtils
( externalBuildDepends )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription, flattenPackageDescription )
import Distribution.Version
......@@ -301,7 +303,7 @@ configurePackage platform comp available spkg = case spkg of
platform comp [] p of
Left missing -> Left missing
Right (pkg, flags') -> Right $
SemiConfiguredPackage apkg flags' (buildDepends pkg)
SemiConfiguredPackage apkg flags' (externalBuildDepends pkg)
dependencySatisfiable = not . null . PackageIndex.lookupDependency available
......
......@@ -54,8 +54,9 @@ import Distribution.Version
( Version, withinRange )
import Distribution.PackageDescription
( GenericPackageDescription(genPackageFlags)
, PackageDescription(buildDepends)
, Flag(flagName), FlagName(..) )
import Distribution.Client.PackageUtils
( externalBuildDepends )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.Client.PackageIndex
......@@ -490,5 +491,5 @@ configuredPackageProblems platform comp
platform comp
[]
(packageDescription pkg) of
Right (resolvedPkg, _) -> buildDepends resolvedPkg
Right (resolvedPkg, _) -> externalBuildDepends resolvedPkg
Left _ -> error "configuredPackageInvalidDeps internal error"
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.PackageUtils
-- Copyright : (c) Duncan Coutts 2010
-- License : BSD-like
--
-- Maintainer : cabal-devel@gmail.com
-- Stability : provisional
-- Portability : portable
--
-- Various package description utils that should be in the Cabal lib
-----------------------------------------------------------------------------
module Distribution.Client.PackageUtils (
externalBuildDepends,
) where
import Distribution.Package
( packageVersion, packageName, Dependency(..) )
import Distribution.PackageDescription
( PackageDescription(..) )
import Distribution.Version
( withinRange )
-- | The list of dependencies that refer to external packages
-- rather than internal package components.
--
externalBuildDepends :: PackageDescription -> [Dependency]
externalBuildDepends pkg = filter (not . internal) (buildDepends pkg)
where
-- True if this dependency is an internal one (depends on a library
-- defined in the same package).
internal (Dependency depName versionRange) =
depName == packageName pkg &&
packageVersion pkg `withinRange` versionRange
......@@ -68,6 +68,7 @@ Executable cabal
Distribution.Client.InstallSymlink
Distribution.Client.List
Distribution.Client.PackageIndex
Distribution.Client.PackageUtils
Distribution.Client.Setup
Distribution.Client.SetupWrapper
Distribution.Client.SrcDist
......
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