Skip to content

Commit

Permalink
Consider Installed packages when pruning the install plan
Browse files Browse the repository at this point in the history
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't
quite work yet. It turns out in order for cabal to find exes for
already installed extra-packages we need to also consider `installed`
packages when pruning the install plan.
  • Loading branch information
Alex Biehl authored and phadej committed Oct 2, 2020
1 parent f6682ef commit 3a0e93b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2680,16 +2680,22 @@ pruneInstallPlanPass1 pkgs =
setDocumentation
$ addOptionalStanzas elab

find_root (InstallPlan.Configured (PrunedPackage elab _)) =
if not $ and [ null (elabConfigureTargets elab)
, null (elabBuildTargets elab)
, null (elabTestTargets elab)
, null (elabBenchTargets elab)
, isNothing (elabReplTarget elab)
, null (elabHaddockTargets elab)
]
then Just (installedUnitId elab)
else Nothing
is_root :: PrunedPackage -> Maybe UnitId
is_root (PrunedPackage elab _) =
if not $ and [ null (elabConfigureTargets elab)
, null (elabBuildTargets elab)
, null (elabTestTargets elab)
, null (elabBenchTargets elab)
, isNothing (elabReplTarget elab)
, null (elabHaddockTargets elab)
]
then Just (installedUnitId elab)
else Nothing

find_root (InstallPlan.Configured pkg) = is_root pkg
-- When using the extra-packages stanza we need to
-- look at installed packages as well.
find_root (InstallPlan.Installed pkg) = is_root pkg
find_root _ = Nothing

-- Note [Sticky enabled testsuites]
Expand Down

0 comments on commit 3a0e93b

Please sign in to comment.