Author: lslezak Date: Thu Nov 8 14:06:41 2007 New Revision: 41882 URL: http://svn.opensuse.org/viewcvs/yast?rev=41882&view=rev Log: - fixed PkgTaboo() and PkgNeutral() - set all available instaces of the package (from all reposiories) (#297083) - 2.13.118 Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Package.cc Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION Thu Nov 8 14:06:41 2007 @@ -1 +1 @@ -2.13.117 +2.13.118 Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes Thu Nov 8 14:06:41 2007 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +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) +- 2.13.118 + +------------------------------------------------------------------- Wed Feb 21 16:13:53 CET 2007 - lslezak@suse.cz - reapply fix for #220195, the problem is fixed in Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Package.cc?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Package.cc (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Package.cc Thu Nov 8 14:06:41 2007 @@ -1794,12 +1794,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) @@ -1808,39 +1807,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) @@ -1849,24 +1860,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