From: Stefan Schubert Date: Tue, 11 Sep 2007 15:25:16 +0000 (+0000) Subject: Update: rename language packages --> take that package which fits to the X-Git-Tag: BASE-SuSE-Linux-10_3-Branch~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abd83585f40d6ae588b79a7b9ab41ef6c5b58bc1;p=platform%2Fupstream%2Flibzypp.git Update: rename language packages --> take that package which fits to the selected language Bug 308098 --- diff --git a/zypp/solver/detail/ResolverUpgrade.cc b/zypp/solver/detail/ResolverUpgrade.cc index dcfffbd..8ccb73b 100644 --- a/zypp/solver/detail/ResolverUpgrade.cc +++ b/zypp/solver/detail/ResolverUpgrade.cc @@ -776,6 +776,60 @@ Resolver::doUpgrade( UpgradeStatistics & opt_stats_r ) } } } + + 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::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::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 );