Skip to content

Commit 5e2a359

Browse files
committed
WIP2
1 parent ea1a8cc commit 5e2a359

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed

cabal-install/Distribution/Client/PackageUtils.hs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ import Distribution.Version (isAnyVersion, withinRange)
2929
-- | The list of dependencies that refer to external packages
3030
-- rather than internal package components.
3131
--
32+
-- Previously we needed to filter internal packages.
33+
-- This is no more the case (see #6083).
34+
-- Internal dependencies are always of the form
35+
--
36+
-- Dependency thisPkgName vr [LSubLibName name, ...]
37+
--
3238
externalBuildDepends :: PackageDescription -> ComponentRequestedSpec -> [Dependency]
33-
externalBuildDepends pkg spec = filter (not . internal) (enabledBuildDepends pkg spec)
34-
where
35-
-- True if this dependency is an internal one (depends on a library
36-
-- defined in the same package).
37-
internal (Dependency depName versionRange _) =
38-
(depName == packageName pkg &&
39-
packageVersion pkg `withinRange` versionRange) ||
40-
(LSubLibName (packageNameToUnqualComponentName depName) `elem` map libName (subLibraries pkg) &&
41-
isAnyVersion versionRange)
39+
externalBuildDepends pkg spec = enabledBuildDepends pkg spec

cabal-install/Distribution/Solver/Modular/IndexConversion.hs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ convGPD os arch cinfo constraints strfl solveExes pn
187187
-- by creating a set of package names which are "internal"
188188
-- and dropping them as we convert.
189189

190-
ipns = S.fromList $ [ unqualComponentNameToPackageName nm
191-
| (nm, _) <- sub_libs ]
190+
-- TODO: remove IPNS argument
191+
ipns = S.empty
192+
192193

193194
conv :: Monoid a => Component -> (a -> BuildInfo) -> DependencyReason PN ->
194195
CondTree ConfVar [Dependency] a -> FlaggedDeps PN
@@ -335,13 +336,6 @@ flagInfo (StrongFlags strfl) =
335336
-- dependencies.
336337
type IPNs = S.Set PN
337338

338-
-- | Convenience function to delete a 'Dependency' if it's
339-
-- for a 'PN' that isn't actually real.
340-
filterIPNs :: IPNs -> Dependency -> Maybe Dependency
341-
filterIPNs ipns d@(Dependency pn _ _)
342-
| S.notMember pn ipns = Just d
343-
| otherwise = Nothing
344-
345339
-- | Convert condition trees to flagged dependencies. Mutually
346340
-- recursive with 'convBranch'. See 'convBranch' for an explanation
347341
-- of all arguments preceding the input 'CondTree'.
@@ -359,7 +353,7 @@ convCondTree flags dr pkg os arch cinfo pn fds comp getInfo ipns solveExes@(Solv
359353
-- of the tree.
360354
mergeSimpleDeps $
361355
[ D.Simple singleDep comp
362-
| dep <- mapMaybe (filterIPNs ipns) ds
356+
| dep <- ds
363357
, singleDep <- convLibDeps dr dep ] -- unconditional package dependencies
364358

365359
++ L.map (\e -> D.Simple (LDep dr (Ext e)) comp) (allExtensions bi) -- unconditional extension dependencies

cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.out

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
Resolving dependencies...
33
Build profile: -w ghc-<GHCVER> -O1
44
In order, the following will be built:
5-
- pkg-abc-0.1.0.0 (lib:pkg-def) (first run)
5+
- pkg-def-0.1.0.0 (lib) (first run)
66
- pkg-abc-0.1.0.0 (exe:program) (first run)
7-
Warning: pkg-abc.cabal:19:15: colon specifier is experimental feature (issue #5660)
8-
Configuring library 'pkg-def' for pkg-abc-0.1.0.0..
9-
Preprocessing library 'pkg-def' for pkg-abc-0.1.0.0..
10-
Building library 'pkg-def' for pkg-abc-0.1.0.0..
7+
Warning: pkg-def.cabal:13:27: visibility is experimental feature (issue #5660)
8+
Configuring library for pkg-def-0.1.0.0..
9+
Preprocessing library for pkg-def-0.1.0.0..
10+
Building library for pkg-def-0.1.0.0..
1111
Warning: pkg-abc.cabal:19:15: colon specifier is experimental feature (issue #5660)
1212
Configuring executable 'program' for pkg-abc-0.1.0.0..
13+
Warning: The package has an extraneous version range for a dependency on an internal library: pkg-def >=0 && ==0.1.0.0. This version range includes the current package but isn't needed as the current package's library will always be used.
1314
Preprocessing executable 'program' for pkg-abc-0.1.0.0..
1415
Building executable 'program' for pkg-abc-0.1.0.0..

cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.test.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import Test.Cabal.Prelude
33
-- https://github.com/haskell/cabal/issues/6083
44
-- see pkg-abc.cabal
55
main = cabalTest $
6-
cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-abc:pkg-def"
6+
cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-def:pkg-def"

0 commit comments

Comments
 (0)