@@ -1034,11 +1034,19 @@ valid loc graph =
10341034 ps -> internalError loc (' \n ' : unlines (map showPlanProblem ps))
10351035
10361036data PlanProblem ipkg srcpkg
1037- = PackageMissingDeps (GenericPlanPackage ipkg srcpkg ) [GraphKey ipkg srcpkg ]
1038- | PackageCycle [GenericPlanPackage ipkg srcpkg ]
1037+ = PackageMissingDeps
1038+ (GenericPlanPackage ipkg srcpkg )
1039+ -- ^ The package that is missing dependencies
1040+ [GraphKey ipkg srcpkg ]
1041+ -- ^ The missing dependencies
1042+ | PackageCycle
1043+ [GenericPlanPackage ipkg srcpkg ]
1044+ -- ^ The packages involved in a dependency cycle
10391045 | PackageStateInvalid
10401046 (GenericPlanPackage ipkg srcpkg )
1047+ -- ^ The package that is in an invalid state
10411048 (GenericPlanPackage ipkg srcpkg )
1049+ -- ^ The package that it depends on which is in an invalid state
10421050
10431051showPlanProblem
10441052 :: ( IsGraph ipkg srcpkg
@@ -1073,31 +1081,63 @@ problems
10731081 => Graph (GenericPlanPackage ipkg srcpkg )
10741082 -> [PlanProblem ipkg srcpkg ]
10751083problems graph =
1076- [ PackageMissingDeps
1084+ concat
1085+ [ checkForMissingDeps graph
1086+ , checkForCycles graph
1087+ -- , checkForDependencyInconsistencies graph
1088+ , checkForPackageStateInconsistencies graph
1089+ ]
1090+
1091+ checkForMissingDeps
1092+ :: IsGraph ipkg srcpkg
1093+ => Graph (GenericPlanPackage ipkg srcpkg )
1094+ -> [PlanProblem ipkg srcpkg ]
1095+ checkForMissingDeps graph =
1096+ [ PackageMissingDeps
10771097 pkg
10781098 ( mapMaybe
10791099 (fmap nodeKey . flip Graph. lookup graph)
10801100 missingDeps
10811101 )
10821102 | (pkg, missingDeps) <- Graph. broken graph
10831103 ]
1084- ++ [ PackageCycle cycleGroup
1085- | cycleGroup <- Graph. cycles graph
1086- ]
1087- {-
1088- ++ [ PackageInconsistency name inconsistencies
1089- | (name, inconsistencies) <-
1090- dependencyInconsistencies indepGoals graph ]
1091- --TODO: consider re-enabling this one, see SolverInstallPlan
1092- -}
1093- ++ [ PackageStateInvalid pkg pkg'
1094- | pkg <- Foldable. toList graph
1095- , Just pkg' <-
1096- map
1097- (flip Graph. lookup graph)
1098- (nodeNeighbors pkg)
1099- , not (stateDependencyRelation pkg pkg')
1100- ]
1104+
1105+ checkForCycles
1106+ :: IsGraph ipkg srcpkg
1107+ => Graph (GenericPlanPackage ipkg srcpkg )
1108+ -> [PlanProblem ipkg srcpkg ]
1109+ checkForCycles graph =
1110+ [ PackageCycle cycleGroup | cycleGroup <- Graph. cycles graph ]
1111+
1112+ -- TODO: consider re-enabling this one, see SolverInstallPlan
1113+ --
1114+ -- checkForDependencyInconsistencies
1115+ -- :: ( IsGraph ipkg srcpkg
1116+ -- , Pretty (GraphKey ipkg srcpkg)
1117+ -- , Key srcpkg ~ PlanProblem ipkg srcpkg
1118+ -- , Key ipkg ~ GraphKey ipkg srcpkg
1119+ -- )
1120+ -- => Graph (GenericPlanPackage ipkg srcpkg)
1121+ -- -> [PlanProblem ipkg srcpkg]
1122+ -- checkForDependencyInconsistencies graph =
1123+ -- [ PackageInconsistency name inconsistencies
1124+ -- | (name, inconsistencies) <-
1125+ -- dependencyInconsistencies indepGoals graph
1126+ -- ]
1127+
1128+ checkForPackageStateInconsistencies
1129+ :: IsGraph ipkg srcpkg
1130+ => Graph (GenericPlanPackage ipkg srcpkg )
1131+ -> [PlanProblem ipkg srcpkg ]
1132+ checkForPackageStateInconsistencies graph =
1133+ [ PackageStateInvalid pkg pkg'
1134+ | pkg <- Foldable. toList graph
1135+ , Just pkg' <-
1136+ map
1137+ (flip Graph. lookup graph)
1138+ (nodeNeighbors pkg)
1139+ , not (stateDependencyRelation pkg pkg')
1140+ ]
11011141
11021142-- | The states of packages have that depend on each other must respect
11031143-- this relation. That is for very case where package @a@ depends on
0 commit comments