diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/algorithms.cc | 1 | ||||
-rw-r--r-- | apt-pkg/aptconfiguration.cc | 81 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 7 | ||||
-rw-r--r-- | apt-pkg/orderlist.cc | 34 |
4 files changed, 75 insertions, 48 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 961f5c2fa..9abb7a947 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1062,6 +1062,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) else if (TryFixByInstall == true && Start.TargetPkg()->CurrentVer == 0 && Cache[Start.TargetPkg()].Delete() == false && + (Flags[Start.TargetPkg()->ID] & ToRemove) != ToRemove && Cache.GetCandidateVer(Start.TargetPkg()).end() == false) { /* Before removing or keeping the package with the broken dependency diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 0e6c3657f..4b14e964a 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -170,17 +170,6 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, string const envShort = envLong.substr(0,lenShort); bool envLongIncluded = true; - // first cornercase: LANG=C, so we use only "en" Translation - if (envLong == "C") { - codes.push_back("en"); - allCodes = codes; - allCodes.insert(allCodes.end(), builtin.begin(), builtin.end()); - if (All == true) - return allCodes; - else - return codes; - } - // to save the servers from unneeded queries, we only try also long codes // for languages it is realistic to have a long code translation fileā¦ // TODO: Improve translation acquire system to drop them dynamic @@ -221,37 +210,41 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, // It is very likely we will need to environment codes later, // so let us generate them now from LC_MESSAGES and LANGUAGE std::vector<string> environment; - // take care of LC_MESSAGES - if (envLongIncluded == false) - environment.push_back(envLong); - environment.push_back(envShort); - // take care of LANGUAGE - const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE"); - string envLang = Locale == 0 ? language_env : *(Locale+1); - if (envLang.empty() == false) { - std::vector<string> env = VectorizeString(envLang,':'); - short addedLangs = 0; // add a maximum of 3 fallbacks from the environment - for (std::vector<string>::const_iterator e = env.begin(); - e != env.end() && addedLangs < 3; ++e) { - if (unlikely(e->empty() == true) || *e == "en") - continue; - if (*e == envLong || *e == envShort) - continue; - if (std::find(environment.begin(), environment.end(), *e) != environment.end()) - continue; - if (e->find('_') != string::npos) { - // Drop LongCodes here - ShortCodes are also included - string const shorty = e->substr(0, e->find('_')); - char const **n = needLong; - for (; *n != NULL; ++n) - if (shorty == *n) - break; - if (*n == NULL) + if (envShort != "C") { + // take care of LC_MESSAGES + if (envLongIncluded == false) + environment.push_back(envLong); + environment.push_back(envShort); + // take care of LANGUAGE + const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE"); + string envLang = Locale == 0 ? language_env : *(Locale+1); + if (envLang.empty() == false) { + std::vector<string> env = VectorizeString(envLang,':'); + short addedLangs = 0; // add a maximum of 3 fallbacks from the environment + for (std::vector<string>::const_iterator e = env.begin(); + e != env.end() && addedLangs < 3; ++e) { + if (unlikely(e->empty() == true) || *e == "en") + continue; + if (*e == envLong || *e == envShort) + continue; + if (std::find(environment.begin(), environment.end(), *e) != environment.end()) continue; + if (e->find('_') != string::npos) { + // Drop LongCodes here - ShortCodes are also included + string const shorty = e->substr(0, e->find('_')); + char const **n = needLong; + for (; *n != NULL; ++n) + if (shorty == *n) + break; + if (*n == NULL) + continue; + } + ++addedLangs; + environment.push_back(*e); } - ++addedLangs; - environment.push_back(*e); } + } else { + environment.push_back("en"); } // Support settings like Acquire::Translation=none on the command line to @@ -273,6 +266,16 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, return codes; } + // cornercase: LANG=C, so we use only "en" Translation + if (envShort == "C") { + allCodes = codes = environment; + allCodes.insert(allCodes.end(), builtin.begin(), builtin.end()); + if (All == true) + return allCodes; + else + return codes; + } + std::vector<string> const lang = _config->FindVector("Acquire::Languages"); // the default setting -> "environment, en" if (lang.empty() == true) { diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 22043db08..72bdd3199 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1448,8 +1448,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, VerIterator Ver(*this,*I); PkgIterator Pkg = Ver.ParentPkg(); - - + /* The List includes all packages providing this dependency, + even providers which are not installed, so skip them. */ + if (PkgState[Pkg->ID].InstallVer == 0) + continue; + if (PkgState[Pkg->ID].CandidateVer != *I && Start->Type == Dep::DpkgBreaks) MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps); diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 602b63d3b..a53854a26 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -967,13 +967,33 @@ bool pkgOrderList::DepRemove(DepIterator D) // start again in the or group and find something which will serve as replacement for (; F.end() == false && F != S; ++F) { - if (F.TargetPkg() == D.TargetPkg() || - IsFlag(F.TargetPkg(), InList) == false || - VisitNode(F.TargetPkg()) == false) - continue; - Flag(F.TargetPkg(), Immediate); - tryFixDeps = false; - break; + if (IsFlag(F.TargetPkg(), InList) == true && + IsFlag(F.TargetPkg(), AddPending) == false && + Cache[F.TargetPkg()].InstallVer != 0 && + VisitNode(F.TargetPkg()) == true) + { + Flag(F.TargetPkg(), Immediate); + tryFixDeps = false; + break; + } + else if (F.TargetPkg()->ProvidesList != 0) + { + pkgCache::PrvIterator Prv = F.TargetPkg().ProvidesList(); + for (; Prv.end() == false; ++Prv) + { + if (IsFlag(Prv.OwnerPkg(), InList) == true && + IsFlag(Prv.OwnerPkg(), AddPending) == false && + Cache[Prv.OwnerPkg()].InstallVer != 0 && + VisitNode(Prv.OwnerPkg()) == true) + { + Flag(Prv.OwnerPkg(), Immediate); + tryFixDeps = false; + break; + } + } + if (Prv.end() == false) + break; + } } if (tryFixDeps == false) break; |