[yast-commit] r41887 - in /trunk/pkg-bindings: VERSION package/yast2-pkg-bindings.changes src/Package.cc
Author: lslezak Date: Thu Nov 8 14:51:52 2007 New Revision: 41887 URL: http://svn.opensuse.org/viewcvs/yast?rev=41887&view=rev Log: - fixed PkgDelete() - mark all installed instances for removal - 2.16.2 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Package.cc Modified: trunk/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/VERSION?rev=41887&r1=41886&r2=41887&view=diff ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Thu Nov 8 14:51:52 2007 @@ -1 +1 @@ -2.16.1 +2.16.2 Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=41887&r1=41886&r2=41887&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Nov 8 14:51:52 2007 @@ -3,6 +3,8 @@ - fixed PkgTaboo() and PkgNeutral() - set all available instaces of the package (from all reposiories) (#297083) +- fixed PkgDelete() - mark all installed instances for removal +- 2.16.2 ------------------------------------------------------------------- Thu Oct 11 15:59:43 CEST 2007 - lslezak@suse.cz Modified: trunk/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Package.cc?rev=41887&r1=41886&r2=41887&view=diff ============================================================================== --- trunk/pkg-bindings/src/Package.cc (original) +++ trunk/pkg-bindings/src/Package.cc Thu Nov 8 14:51:52 2007 @@ -1801,12 +1801,11 @@ /** @builtin PkgDelete - @short Select package for deletion + @short Select package for deletion (deletes all installed instances of the package) @param string package @return boolean */ -#warning This is bogus, as we have multiple matching (kernel) packages YCPValue PkgModuleFunctions::PkgDelete (const YCPString& p) @@ -1815,31 +1814,36 @@ if (name.empty()) return YCPBoolean (false); + bool ret = true; + try { - // find the package - zypp::ResPool::byName_iterator it = std::find_if ( - zypp_ptr()->pool().byNameBegin(name) - , zypp_ptr()->pool().byNameEnd(name) - , zypp::functor::chain ( - zypp::resfilter::ByInstalled (), - zypp::resfilter::ByKind( zypp::ResTraitszypp::Package::kind ) - ) - ); + bool found = false; + for (zypp::ResPool::byName_iterator it = zypp_ptr()->pool().byNameBegin(name); + it != zypp_ptr()->pool().byNameEnd(name); ++it) + { + // is it an installed package? + if (zypp::isKindzypp::Package(it->resolvable()) && it->status().isInstalled()) + { + found = true; + ret = it->status().setToBeUninstalled(whoWantsIt) && ret; + } + } - // set the status to uninstalled - return YCPBoolean( (it != zypp_ptr()->pool().byNameEnd(name)) - && it->status().setToBeUninstalled(whoWantsIt) ); + if (!found) + { + ret = false; + } } catch (...) { + ret = false; } - return YCPBoolean (false); + return YCPBoolean(ret); } - /** @builtin PkgTaboo -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org