Upload Tizen:Main source
[external/libsatsolver.git] / examples / ruby / problem.rb
1 #
2 # Extend SatSolver::Problem with to_s
3 #
4
5 class Satsolverx::Problem
6   def to_s
7     case self.reason
8       when SatSolver::SOLVER_PROBLEM_UPDATE_RULE #1
9         reason = "problem with installed"
10       when SatSolver::SOLVER_PROBLEM_JOB_RULE #2
11         reason = "conflicting requests"
12       when SatSolver::SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP #3
13         reason = "nothing provides requested"
14       when SatSolver::SOLVER_PROBLEM_NOT_INSTALLABLE #4
15         reason = "not installable"
16       when SatSolver::SOLVER_PROBLEM_NOTHING_PROVIDES_DEP #5
17         reason = "nothing provides rel required by source"
18       when SatSolver::SOLVER_PROBLEM_SAME_NAME #6
19         reason = "cannot install both"
20       when SatSolver::SOLVER_PROBLEM_PACKAGE_CONFLICT #7
21         reason = "source conflicts with rel provided by target"
22       when SatSolver::SOLVER_PROBLEM_PACKAGE_OBSOLETES #8
23         reason = "source obsoletes rel provided by target"
24       when SatSolver::SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE #9
25         reason = "source requires rel but no providers are installable"
26       else
27         reason = "**unknown**"
28     end
29     "[#{self.reason}]: #{reason}] Source #{self.source}, Rel #{self.relation}, Target #{self.target}"
30   end
31 end