if (installer.installed_item &&
installer.installed_item.resolvable()->edition() == installer.item.resolvable()->edition() &&
- installer.installed_item.resolvable()->arch() == installer.item.resolvable()->arch()) {
+ installer.installed_item.resolvable()->arch() == installer.item.resolvable()->arch() &&
+ ( ! copts.count("force") ) )
+ {
+ // if it is needed install anyway, even if it is installed
+ if ( installer.item.status().isNeeded() )
+ {
+ installer.item.status().setTransact( true, zypp::ResStatus::USER );
+ }
+
cout_n << format(_("skipping %s '%s' (already installed)")) % kind_to_string_localized(kind,1) % name << endl;
}
else {
+
// TODO don't use setToBeInstalled for this purpose but higher level solver API
bool result = installer.item.status().setToBeInstalled( zypp::ResStatus::USER );
- if (!result) {
- cerr << format(_("Failed to add '%s' to the list of packages to be installed.")) % name << endl;
- ERR << "Could not set " << name << " as to-be-installed" << endl;
+ if (!result)
+ {
+ // this is because the resolvable is installed and we are forcing.
+ installer.item.status().setTransact( true, zypp::ResStatus::USER );
+ //cerr << format(_("Failed to add '%s' to the list of packages to be installed.")) % name << endl;
+ //ERR << "Could not set " << name << " as to-be-installed" << endl;
}
}
}
{"type", required_argument, 0, 't'},
// the default (ignored)
{"name", no_argument, 0, 'n'},
+ {"force", no_argument, 0, 'f'},
{"capability", no_argument, 0, 'C'},
// rug compatibility, we have global --non-interactive
{"no-confirm", no_argument, 0, 'y'},
"-r, --repo <alias> Install resolvables only from repository specified by alias.\n"
"-t, --type <type> Type of resolvable (package, patch, pattern, product) (default: package)\n"
"-n, --name Select resolvables by plain name, not by capability\n"
+ "-f, --force Install even if the item is already installed (reinstall)\n"
"-l, --auto-agree-with-licenses Automatically say 'yes' to third party license confirmation prompt.\n"
" See 'man zypper' for more details.\n"
" --debug-solver Create solver test case for debugging\n"
gSettings.license_auto_agree = true;
}
+
+
if (command == ZypperCommand::REMOVE) {
if (ghelp || arguments.size() < 1) {
cerr << specific_help;