Skip to content

Commit c17b976

Browse files
committed
Bootstrap generation fix for exe-only dependencies
This isn't currently a concrete problem, but surfaced when adding a dependency to cabal-install:exe.
1 parent 4c9590e commit c17b976

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bootstrap/src/Main.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,21 @@ bfs plan unit0 = do
122122
-- nub and sort
123123
reverse $ Set.toList $ Set.fromList $ concat t
124124

125-
for uids $ \uid -> do
126-
unit <- lookupUnit units uid
125+
units <- for uids $ \uid -> do
126+
unit <- lookupUnit (P.pjUnits plan) uid
127127
case Map.toList (P.uComps unit) of
128128
[(_, compinfo)] -> checkExeDeps uid (P.pjUnits plan) (P.ciExeDeps compinfo)
129129
_ -> die $ "Unit with multiple components " ++ show uid
130130
return unit
131131

132+
-- Remove non-exe copies of cabal-install. Otherwise, cabal-install
133+
-- may appear as cabal-install:lib before dependencies of
134+
-- cabal-install:exe:cabal, and the bootstrap build tries to build
135+
-- all of cabal-install before those dependencies.
136+
return $ filter (\u -> P.uId u == P.uId unit0 || P.uPId u /= P.uPId unit0) units
132137
where
133138
am :: Map.Map P.UnitId (Set.Set P.UnitId)
134-
am = fmap (foldMap P.ciLibDeps . P.uComps) units
135-
136-
units = P.pjUnits plan
139+
am = fmap (foldMap P.ciLibDeps . P.uComps) (P.pjUnits plan)
137140

138141
checkExeDeps :: P.UnitId -> Map.Map P.UnitId P.Unit -> Set.Set P.UnitId -> IO ()
139142
checkExeDeps pkgUid units = traverse_ check . Set.toList where

0 commit comments

Comments
 (0)