Author: schubi2 Date: Tue Sep 11 17:25:16 2007 New Revision: 7191 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7191&view=rev Log: Update: rename language packages --> take that package which fits to the selected language Bug 308098 Modified: trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc Modified: trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc?rev=7191&r1=7190&r2=7191&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc (original) +++ trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc Tue Sep 11 17:25:16 2007 @@ -776,6 +776,60 @@ } } } + + if ( guess ) { + // Checking if the selected provider depends on language, if yes try to find out the + // correct language package + bool requested_locale_match = false; + CapSet freshens( guess->dep( Dep::FRESHENS ) ); + + // is this a language package ? + for (CapSet::const_iterator cit = freshens.begin(); cit != freshens.end(); ++cit) { + if (cit->refers() == ResTraits<Language>::kind) { + requested_locale_match = true; + break; + } + } + + if (requested_locale_match) { + // searching the best language + PoolItemOrderSet & gset( it->second ); + requested_locale_match = false; + + for ( PoolItemOrderSet::iterator git = gset.begin(); git != gset.end(); ++git ) { + PoolItem_Ref item (*git); + + if ( item.status().isToBeInstalled()) { + MIL << " ==> (pass 2: meanwhile set to install): " << item << endl; + if ( ! doesObsoleteItem (item, it->first ) ) { + it->first.status().setToBeUninstalled( ResStatus::APPL_HIGH ); + } + guess = PoolItem_Ref(); + break; + } else { + freshens = item->dep( Dep::FRESHENS ); + ZYpp::Ptr z = zypp::getZYpp(); + ZYpp::LocaleSet requested_locales = z->getRequestedLocales(); + + // try to find a match of the locale freshens with one of the requested locales + + for (CapSet::const_iterator cit = freshens.begin(); cit != freshens.end(); ++cit) { + if (cit->refers() == ResTraits<Language>::kind) { + string loc = cit->index(); + MIL << "Look for language fallback " << loc << ":" << item << endl; + if (requested_locales.find( Locale( loc ) ) != requested_locales.end()) { + MIL << "Locale '" << loc << "' is requested" << endl; + requested_locale_match = true; + guess = item; + break; + } + } + } + } + if (requested_locale_match) break; + } + } + } if ( guess ) { guess.status().setToBeInstalled( ResStatus::APPL_HIGH ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org