Author: kkaempf Date: Wed Jan 9 14:53:13 2008 New Revision: 8245 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8245&view=rev Log: Problem.to_s and Decision.to_s Added: trunk/sat-solver/examples/ruby/decision.rb trunk/sat-solver/examples/ruby/problem.rb Added: trunk/sat-solver/examples/ruby/decision.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/examples/ruby/decision.rb?rev=8245&view=auto ============================================================================== --- trunk/sat-solver/examples/ruby/decision.rb (added) +++ trunk/sat-solver/examples/ruby/decision.rb Wed Jan 9 14:53:13 2008 @@ -0,0 +1,21 @@ +# +# Extend SatSolver::Decision with to_s +# + +class Satsolverx::Decision + def to_s + case self.op + when SatSolver::DEC_INSTALL + return "Install #{self.solvable} #{self.reason}" + when SatSolver::DEC_REMOVE + return "Remove #{self.solvable} #{self.reason}" + when SatSolver::DEC_OBSOLETE + return "Obsolete #{self.solvable} #{self.reason}" + when SatSolver::DEC_UPDATE + return "Update #{self.solvable} #{self.reason}" + else + return "Decision op #{self.op}" + end + "**Decision**" + end +end Added: trunk/sat-solver/examples/ruby/problem.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/examples/ruby/problem.rb?rev=8245&view=auto ============================================================================== --- trunk/sat-solver/examples/ruby/problem.rb (added) +++ trunk/sat-solver/examples/ruby/problem.rb Wed Jan 9 14:53:13 2008 @@ -0,0 +1,31 @@ +# +# Extend SatSolver::Problem with to_s +# + +class Satsolverx::Problem + def to_s + case self.reason + when SatSolver::SOLVER_PROBLEM_UPDATE_RULE #1 + reason = "problem with installed" + when SatSolver::SOLVER_PROBLEM_JOB_RULE #2 + reason = "conflicting requests" + when SatSolver::SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP #3 + reason = "nothing provides requested" + when SatSolver::SOLVER_PROBLEM_NOT_INSTALLABLE #4 + reason = "not installable" + when SatSolver::SOLVER_PROBLEM_NOTHING_PROVIDES_DEP #5 + reason = "nothing provides rel required by source" + when SatSolver::SOLVER_PROBLEM_SAME_NAME #6 + reason = "cannot install both" + when SatSolver::SOLVER_PROBLEM_PACKAGE_CONFLICT #7 + reason = "source conflicts with rel provided by target" + when SatSolver::SOLVER_PROBLEM_PACKAGE_OBSOLETES #8 + reason = "source obsoletes rel provided by target" + when SatSolver::SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE #9 + reason = "source requires rel but no providers are installable" + else + reason = "**unknown**" + end + "[#{self.reason}]: #{reason}] Source #{self.source}, Rel #{self.relation}, Target #{self.target}" + end +end -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org