Author: lslezak Date: Fri Aug 15 15:04:39 2008 New Revision: 50120 URL: http://svn.opensuse.org/viewcvs/yast?rev=50120&view=rev Log: - ui::Selectable in Pkg::SourceMediaData(), improved Pkg::SourceProductData() Modified: branches/tmp/lslezak/pkg-bindings/src/Source_Get.cc Modified: branches/tmp/lslezak/pkg-bindings/src/Source_Get.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/pkg-bindings/src/Source_Get.cc?rev=50120&r1=50119&r2=50120&view=diff ============================================================================== --- branches/tmp/lslezak/pkg-bindings/src/Source_Get.cc (original) +++ branches/tmp/lslezak/pkg-bindings/src/Source_Get.cc Fri Aug 15 15:04:39 2008 @@ -209,20 +209,37 @@ bool found_resolvable = false; int max_medium = 1; - for (zypp::ResPool::const_iterator it = zypp_ptr()->pool().begin() - ; it != zypp_ptr()->pool().end() - ; ++it) + // search the maximum source number of a package in the repository + try { - if (it->resolvable()->repoInfo().alias() == alias) + for (zypp::ResPoolProxy::const_iterator it = zypp_ptr()->poolProxy().byKindBegin(zypp::ResKind::package); + it != zypp_ptr()->poolProxy().byKindEnd(zypp::ResKind::package); + ++it) { - int medium = it->resolvable()->mediaNr(); - - if (medium > max_medium) + // search in available products + for (zypp::ui::Selectable::available_iterator aval_it = (*it)->availableBegin(); + aval_it != (*it)->availableEnd(); + ++aval_it) { - max_medium = medium; + zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>(aval_it->resolvable()); + + if (pkg && pkg->repoInfo().alias() == alias) + { + found_resolvable = true; + + int medium = pkg->mediaNr(); + + if (medium > max_medium) + { + max_medium = medium; + } + } } } } + catch (...) + { + } if (found_resolvable) { @@ -276,6 +293,12 @@ { YCPMap ret; + YRepo_Ptr repo = logFindRepository(src_id->value()); + if (!repo) + return YCPVoid (); + + std::string alias = repo->repoInfo().alias(); + try { for (zypp::ResPoolProxy::const_iterator it = zypp_ptr()->poolProxy().byKindBegin(zypp::ResKind::product); @@ -285,12 +308,12 @@ zypp::Product::constPtr product = NULL; // search in available products - for (zypp::ui::Selectable::available_iterator inst_it = (*it)->availableBegin(); - inst_it != (*it)->availableEnd(); - ++inst_it) + for (zypp::ui::Selectable::available_iterator aval_it = (*it)->availableBegin(); + aval_it != (*it)->availableEnd(); + ++aval_it) { - zypp::Product::constPtr prod = boost::dynamic_pointer_cast<const zypp::Product>(inst_it->resolvable()); - if (product && logFindAlias(product->repoInfo().alias()) == static_cast<size_t>(src_id->value())) + zypp::Product::constPtr prod = boost::dynamic_pointer_cast<const zypp::Product>(aval_it->resolvable()); + if (product && product->repoInfo().alias() == alias) { product = prod; break; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org