Skip to content

Commit

Permalink
Bootstrap generation fix for exe-only dependencies
Browse files Browse the repository at this point in the history
Specifically, before this, with 'signal' as a dependency for
cabal-install:exe:cabal, the dependency list ended

...
cabal-install
signal
cabal-install

and the first cabal-install copy failed to build because it's
built as executable.
  • Loading branch information
robx committed Feb 23, 2022
1 parent 4d2c324 commit e02959a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bootstrap/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,20 @@ bfs plan unit0 = do
-- nub and sort
reverse $ Set.toList $ Set.fromList $ concat t

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

-- Remove non-exe copies of cabal-install. Otherwise, cabal-install
-- may appear as cabal-install:lib before dependencies of
-- cabal-install:exe:cabal.
return $ filter (\u -> P.uId u == P.uId unit0 || P.uPId u /= P.uPId unit0) units
where
am :: Map.Map P.UnitId (Set.Set P.UnitId)
am = fmap (foldMap P.ciLibDeps . P.uComps) units

units = P.pjUnits plan
am = fmap (foldMap P.ciLibDeps . P.uComps) (P.pjUnits plan)

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

0 comments on commit e02959a

Please sign in to comment.