+ list<string> problems;
+ set<const Package *> broken_packages;
+ set<const Component *> broken_components;
+ set<const Tool *> broken_tools;
+
+ const BuildGraph::TargetMap &targets = build_graph.get_targets();
+ for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
+ if(i->second->is_broken())
+ {
+ const list<string> &tgt_problems = i->second->get_problems();
+ for(list<string>::const_iterator j=tgt_problems.begin(); j!=tgt_problems.end(); ++j)
+ problems.push_back(format("%s: %s", i->second->get_name(), *j));
+
+ const Package *package = i->second->get_package();
+ if(package && !package->get_problems().empty())
+ broken_packages.insert(package);
+
+ const Component *component = i->second->get_component();
+ if(component && !component->get_problems().empty())
+ broken_components.insert(component);
+
+ const Tool *tool = i->second->get_tool();
+ if(tool && !tool->get_problems().empty())
+ broken_tools.insert(tool);
+ }
+
+ // TODO Sort components after their packages, and targets last
+ for(set<const Package *>::const_iterator i=broken_packages.begin(); i!=broken_packages.end(); ++i)
+ {
+ const list<string> &pkg_problems = (*i)->get_problems();
+ for(list<string>::const_iterator j=pkg_problems.begin(); j!=pkg_problems.end(); ++j)
+ problems.push_back(format("%s: %s", (*i)->get_name(), *j));
+ }
+
+ for(set<const Component *>::const_iterator i=broken_components.begin(); i!=broken_components.end(); ++i)
+ {
+ const list<string> &comp_problems = (*i)->get_problems();
+ for(list<string>::const_iterator j=comp_problems.begin(); j!=comp_problems.end(); ++j)
+ problems.push_back(format("%s/%s: %s", (*i)->get_package().get_name(), (*i)->get_name(), *j));
+ }
+
+ for(set<const Tool *>::const_iterator i=broken_tools.begin(); i!=broken_tools.end(); ++i)
+ {
+ const list<string> &tool_problems = (*i)->get_problems();
+ for(list<string>::const_iterator j=tool_problems.begin(); j!=tool_problems.end(); ++j)
+ problems.push_back(format("%s: %s", (*i)->get_tag(), *j));
+ }
+
+ return problems;