* ZYPPER_EXIT_INF_REBOOT_NEEDED - if one of patches to be installed needs machine reboot,
* ZYPPER_EXIT_INF_RESTART_NEEDED - if one of patches to be installed needs package manager restart
*/
-int summary(Zypper & zypper)
+static int summary(Zypper & zypper)
{
int retv = -1; // nothing to do;
return locks;
}
-bool resolve(Zypper & zypper)
+static void set_force_resolution(Zypper & zypper)
{
- apply_locks(zypper);
- dump_pool();
-
// --force-resolution command line parameter value
tribool force_resolution = indeterminate;
- vector<string>::size_type count = copts.count("force-resolution");
+ unsigned int count = zypper.cOpts().count("force-resolution");
if (count)
{
string value = copts["force-resolution"].front();
ostringstream s;
s << _("Force resolution:") << " " << (force_resolution ? _("Yes") : _("No"));
zypper.out().info(s.str(), Out::HIGH);
- God->resolver()->setForceResolve( force_resolution );
+ God->resolver()->setForceResolve(force_resolution);
+}
+
+/**
+ * Run the solver.
+ *
+ * \return <tt>true</tt> if a solution has been found, <tt>false</tt> otherwise
+ */
+static bool resolve(Zypper & zypper)
+{
+ apply_locks(zypper);
+ dump_pool(); // debug
+ set_force_resolution(zypper);
zypper.out().info(_("Resolving dependencies..."), Out::HIGH);
DBG << "Calling the solver..." << endl;
return God->resolver()->resolvePool();
}
-bool verify(Zypper & zypper)
+static bool verify(Zypper & zypper)
{
apply_locks(zypper);
dump_pool();
return God->resolver()->verifySystem();
}
+static void make_solver_test_case(Zypper & zypper)
+{
+ apply_locks(zypper);
+ set_force_resolution(zypper);
+
+ string testcase_dir("/var/log/zypper.solverTestCase");
+
+ zypper.out().info(_("Generating solver test case..."));
+ if (God->resolver()->createSolverTestcase(testcase_dir))
+ zypper.out().info(boost::str(
+ format(_("Solver test case generated successfully at %s."))
+ % testcase_dir));
+ else
+ {
+ zypper.out().error(_("Error creating the solver test case."));
+ zypper.setExitCode(ZYPPER_EXIT_ERR_ZYPP);
+ }
+}
+
void patch_check ()
{
Out & out = Zypper::instance()->out();
*/
void solve_and_commit (Zypper & zypper)
{
+ if (zypper.cOpts().count("debug-solver"))
+ {
+ make_solver_test_case(zypper);
+ return;
+ }
+
MIL << "solving..." << endl;
while (true) {
*/
void remove_selections(Zypper & zypper);
-/** Show install summary */
-int show_summary(Zypper & zypper);
-
-/**
- * Run the solver.
- *
- * \return <tt>true</tt> if a solution has been found, <tt>false</tt> otherwise
- */
-bool resolve(Zypper & zypper);
-
/** List patches */
void show_patches(Zypper & zypper);
it != rpms_files_caps.end(); ++it )
mark_by_capability (*this, true, kind, *it);
- // solve dependencies
- if (copts.count("debug-solver"))
- {
- God->applyLocks();
- out().info(_("Generating solver test case..."));
- if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase"))
- out().info(_("Solver test case generated successfully at /var/log/zypper.solverTestCase."));
- else
- {
- out().error(_("Error creating the solver test case."));
- setExitCode(ZYPPER_EXIT_ERR_ZYPP);
- return;
- }
- }
- else
- {
- solve_and_commit(*this);
- }
+ solve_and_commit(*this);
return;
}
bool skip_interactive = copts.count("skip-interactive") || globalOpts().non_interactive;
mark_updates( kinds, skip_interactive, best_effort );
-
- if (copts.count("debug-solver"))
- {
- God->applyLocks();
- out().info(_("Generating solver test case..."));
- if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase"))
- out().info(_("Solver test case generated successfully at /var/log/zypper.solverTestCase."));
- else
- out().error(_("Error creating the solver test case."));
- }
- // commit
- // returns ZYPPER_EXIT_OK, ZYPPER_EXIT_ERR_ZYPP,
- // ZYPPER_EXIT_INF_REBOOT_NEEDED, or ZYPPER_EXIT_INF_RESTART_NEEDED
- else
- {
- solve_and_commit(*this);
- }
+ solve_and_commit(*this);
return;
}
zypp::UpgradeStatistics opt_stats;
God->resolver()->doUpgrade(opt_stats);
- if (copts.count("debug-solver"))
- {
- God->applyLocks();
- out().info(_("Generating solver test case..."));
- if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase"))
- out().info(_("Solver test case generated successfully at /var/log/zypper.solverTestCase."));
- else
- out().error(_("Error creating the solver test case."));
- }
- // commit
- // returns ZYPPER_EXIT_OK, ZYPPER_EXIT_ERR_ZYPP,
- // ZYPPER_EXIT_INF_REBOOT_NEEDED, or ZYPPER_EXIT_INF_RESTART_NEEDED
- else
- {
- solve_and_commit(*this);
- }
+ solve_and_commit(*this);
return;
}