@@ -601,36 +601,25 @@ fromSolverInstallPlanWithProgress
601601 -> SolverInstallPlan
602602 -> LogProgress (GenericInstallPlan ipkg srcpkg )
603603fromSolverInstallPlanWithProgress f plan = do
604- (_, _, pkgs'') <-
604+ (_, pkgs'') <-
605605 foldM
606606 f'
607- (Map. empty, Map. empty, [] )
607+ (Map. empty, [] )
608608 (SolverInstallPlan. reverseTopologicalOrder plan)
609609 return $
610610 mkInstallPlan
611611 " fromSolverInstallPlanWithProgress"
612612 (Graph. fromDistinctList pkgs'')
613613 where
614- f' (pidMap, ipiMap, pkgs) pkg = do
615- pkgs' <- f (mapDep pidMap ipiMap) pkg
616- let (pidMap', ipiMap') =
617- case nodeKey pkg of
618- -- FIXME: stage is ignored
619- PreExistingId _stage _ uid -> (pidMap, Map. insert uid pkgs' ipiMap)
620- PlannedId _stage pid -> (Map. insert pid pkgs' pidMap, ipiMap)
621- return (pidMap', ipiMap', pkgs' ++ pkgs)
614+ f' (pMap, pkgs) pkg = do
615+ pkgs' <- f (mapDep pMap) pkg
616+ let pMap' = Map. insert (nodeKey pkg) pkgs' pMap
617+ return (pMap', pkgs' ++ pkgs)
622618
623619 -- The error below shouldn't happen, since mapDep should only
624620 -- be called on neighbor SolverId, which must have all been done
625621 -- already by the reverse top-sort (we assume the graph is not broken).
626- --
627- -- FIXME: stage is ignored
628- mapDep _ ipiMap (PreExistingId _stage _pid uid)
629- | Just pkgs <- Map. lookup uid ipiMap = pkgs
630- | otherwise = error (" fromSolverInstallPlan: PreExistingId " ++ prettyShow uid)
631- mapDep pidMap _ (PlannedId _stage pid)
632- | Just pkgs <- Map. lookup pid pidMap = pkgs
633- | otherwise = error (" fromSolverInstallPlan: PlannedId " ++ prettyShow pid)
622+ mapDep pMap key = fromMaybe (error (" fromSolverInstallPlan: " ++ prettyShow key)) (Map. lookup key pMap)
634623
635624-- | Conversion of 'SolverInstallPlan' to 'InstallPlan'.
636625-- Similar to 'elaboratedInstallPlan'
0 commit comments