[zypp-commit] r7283 - in /trunk/zypper/src: zypper-misc.cc zypper.cc
Author: dmacvicar Date: Tue Sep 18 13:03:23 2007 New Revision: 7283 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7283&view=rev Log: - fix #309267, reinstalling installed resolvables Modified: trunk/zypper/src/zypper-misc.cc trunk/zypper/src/zypper.cc Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=7283&r1=7282&r2=7283&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Tue Sep 18 13:03:23 2007 @@ -273,15 +273,27 @@ 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; } } } Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=7283&r1=7282&r2=7283&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Tue Sep 18 13:03:23 2007 @@ -277,6 +277,7 @@ {"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'}, @@ -302,6 +303,7 @@ "-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" @@ -1077,6 +1079,8 @@ gSettings.license_auto_agree = true; } + + if (command == ZypperCommand::REMOVE) { if (ghelp || arguments.size() < 1) { cerr << specific_help; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org