}
}
+// ----------------------------------------------------------------------------
+
+void remove_selections(Zypper & zypper)
+{
+ MIL << "Removing user selections from the solver pool" << endl;
+
+ DBG << "Removing user setToBeInstalled()/Removed()" << endl;
+
+ // iterate pool, searching for ResStatus::isByUser()
+ // TODO optimize: remember user selections and iterate by name
+ // TODO optimize: it seems this is actually needed only if the selection was
+ // not committed (user has chosen not to continue)
+ const ResPool & pool = God->pool();
+ cout << "pool size" << pool.size() << endl;
+ for (ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it)
+ if (it->status().isByUser())
+ {
+ DBG << "Removing user setToBeInstalled()/Removed()" << endl;
+ it->status().resetTransact(zypp::ResStatus::USER);
+ }
+
+ DBG << "Removing user addRequire() addConflict()" << endl;
+
+ Resolver_Ptr solver = God->resolver();
+ CapSet capSet = solver->getConflict();
+ for (CapSet::const_iterator it = capSet.begin(); it != capSet.end(); ++it)
+ {
+ DBG << "removing conflict: " << (*it) << endl;
+ solver->removeConflict(*it);
+ }
+ capSet = solver->getRequire();
+ for (CapSet::const_iterator it = capSet.begin(); it != capSet.end(); ++it)
+ {
+ DBG << "removing require: " << (*it) << endl;
+ solver->removeRequire(*it);
+ }
+
+ MIL << "DONE" << endl;
+}
+
+// ----------------------------------------------------------------------------
// debugging
static
const zypp::ResObject::Kind &kind,
const std::string &capstr );
+/**
+ * Reset all selections made by mark_* methods. Needed in the shell to reset
+ * selections after the install and remove commands.
+ */
+void remove_selections(Zypper & zypper);
+
int show_summary(Zypper & zypper);
//std::string calculate_token();
void Zypper::shellCleanup()
{
+ MIL << "Cleaning up for the next command." << endl;
+
+ switch(command().toEnum())
+ {
+ case ZypperCommand::INSTALL_e:
+ case ZypperCommand::REMOVE_e:
+ //case Zyppercommand::UPDATE_e: TODO once the update will take arguments
+ {
+ remove_selections(*this);
+ break;
+ }
+ default:;
+ }
+
// clear any previous arguments
_arguments.clear();
// clear command options
if (exiting())
return;
doCommand();
- setCommand(ZypperCommand::NONE);
}
catch (const AbortRequestException & ex)
{