[yast-commit] r41885 - in /trunk/pkg-bindings: package/yast2-pkg-bindings.changes src/Package.cc
Author: lslezak Date: Thu Nov 8 14:12:02 2007 New Revision: 41885 URL: http://svn.opensuse.org/viewcvs/yast?rev=41885&view=rev Log: - fixed PkgTaboo() and PkgNeutral() - set all available instaces of the package (from all reposiories) (#297083) Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Package.cc 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=41885&r1=41884&r2=41885&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Nov 8 14:12:02 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Nov 8 13:44:29 CET 2007 - lslezak@suse.cz + +- fixed PkgTaboo() and PkgNeutral() - set all available instaces + of the package (from all reposiories) (#297083) + +------------------------------------------------------------------- Thu Oct 11 15:59:43 CEST 2007 - lslezak@suse.cz - fixed Pkg::SourceLoad() - don't load resolvables from Modified: trunk/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Package.cc?rev=41885&r1=41884&r2=41885&view=diff ============================================================================== --- trunk/pkg-bindings/src/Package.cc (original) +++ trunk/pkg-bindings/src/Package.cc Thu Nov 8 14:12:02 2007 @@ -1843,12 +1843,11 @@ /** @builtin PkgTaboo - @short Set package to taboo + @short Set package to taboo (sets all instances of the package - all versions, from all repositories) @param string package @return boolean */ -#warning This is bogus, as we have multiple matching packages YCPValue PkgModuleFunctions::PkgTaboo (const YCPString& p) @@ -1857,39 +1856,51 @@ 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::resfilter::ByKind(zypp::ResTraitszypp::Package::kind) - ); - - // remove the transactions, lock the status - return YCPBoolean( (it != zypp_ptr()->pool().byNameEnd(name)) - && it->status().resetTransact(whoWantsIt) - // lock the package at the USER level (bug #186205) - && it->status().resetTransact(zypp::ResStatus::USER) - && it->status().setLock(true, zypp::ResStatus::USER) - ); + bool found = false; + + for (zypp::ResPool::byName_iterator it = zypp_ptr()->pool().byNameBegin(name); + it != zypp_ptr()->pool().byNameEnd(name); ++it) + { + // is it a package? + // installed package cannot be set to taboo + if (zypp::isKindzypp::Package(it->resolvable()) && !it->status().isInstalled()) + { + found = true; + + bool res = it->status().resetTransact(whoWantsIt) + // lock the package at the USER level (bug #186205) + && it->status().resetTransact(zypp::ResStatus::USER) + && it->status().setLock(true, zypp::ResStatus::USER); + + ret = ret && res; + } + } + + if (!found) + { + ret = false; + } } catch (...) { + ret = false; } - return YCPBoolean (false); + return YCPBoolean(ret); } /** @builtin PkgNeutral - @short Set package to neutral (drop install/delete flags) + @short Set package to neutral (drop install/delete flags) (sets all instances of the package - all versions, from all repositories) @param string package @return boolean */ -#warning This is bogus, as we have multiple matching packages YCPValue PkgModuleFunctions::PkgNeutral (const YCPString& p) @@ -1898,24 +1909,34 @@ 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::resfilter::ByKind(zypp::ResTraitszypp::Package::kind) - ); - - // reset all transactions - return YCPBoolean( (it != zypp_ptr()->pool().byNameEnd(name)) - && it->status().resetTransact(whoWantsIt) ); + bool found = false; + + for (zypp::ResPool::byName_iterator it = zypp_ptr()->pool().byNameBegin(name); + it != zypp_ptr()->pool().byNameEnd(name); ++it) + { + // is it a package? + if (zypp::isKindzypp::Package(it->resolvable())) + { + found = true; + ret = it->status().resetTransact(whoWantsIt) && ret; + } + } + + if (!found) + { + ret = false; + } } catch (...) { + ret = false; } - return YCPBoolean (false); + return YCPBoolean(ret); } -- 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