Class: DepSelector::ErrorReporter::SimpleTreeTraverser

Inherits:
DepSelector::ErrorReporter show all
Defined in:
lib/dep_selector/error_reporter/simple_tree_traverser.rb

Instance Method Summary collapse

Instance Method Details

#give_feedback(dep_graph, soln_constraints, unsatisfiable_constraint_idx, most_constrained_pkg) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dep_selector/error_reporter/simple_tree_traverser.rb', line 29

def give_feedback(dep_graph, soln_constraints, unsatisfiable_constraint_idx, most_constrained_pkg)
  unsatisfiable_soln_constraint = soln_constraints[unsatisfiable_constraint_idx]
  feedback = "Unable to satisfy constraints on package #{most_constrained_pkg.name}"
  feedback << ", which does not exist," unless most_constrained_pkg.valid?
  feedback << " due to solution constraint #{unsatisfiable_soln_constraint}. "

  all_paths = paths_from_soln_constraints_to_pkg_constraints(dep_graph, soln_constraints, most_constrained_pkg)
  collapsed_paths = collapse_adjacent_paths(all_paths).map{|collapsed_path| "[#{print_path(collapsed_path).join(' -> ')}]"}

  feedback << "Solution constraints that may result in a constraint on #{most_constrained_pkg.name}: #{collapsed_paths.join(', ')}"
end