X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e234fa49da6ae970227358a4275d9bf4344c21b5..0c1a7101fda38ad9e43ef4c6757bfc9c0191a30c:/apt-pkg/aptconfiguration.cc diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index a1379ce7d..44f1f318a 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -10,6 +10,7 @@ // Include Files /*{{{*/ #include #include +#include #include #include #include @@ -196,6 +197,9 @@ std::vector const Configuration::getLanguages(bool const &All, // it was undocumented and so it should be not very widthly used string const oldAcquire = _config->Find("APT::Acquire::Translation",""); if (oldAcquire.empty() == false && oldAcquire != "environment") { + // TRANSLATORS: the two %s are APT configuration options + _error->Notice("Option '%s' is deprecated. Please use '%s' instead, see 'man 5 apt.conf' for details.", + "APT::Acquire::Translation", "Acquire::Languages"); if (oldAcquire != "none") codes.push_back(oldAcquire); codes.push_back("en"); @@ -221,7 +225,7 @@ std::vector const Configuration::getLanguages(bool const &All, const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE"); string envLang = Locale == 0 ? language_env : *(Locale+1); if (envLang.empty() == false) { - std::vector env = ExplodeString(envLang,':'); + std::vector env = VectorizeString(envLang,':'); short addedLangs = 0; // add a maximum of 3 fallbacks from the environment for (std::vector::const_iterator e = env.begin(); e != env.end() && addedLangs < 3; ++e) { @@ -327,11 +331,24 @@ std::vector const Configuration::getArchitectures(bool const &Cache if (likely(Cached == true) && archs.empty() == false) return archs; - string const arch = _config->Find("APT::Architecture"); archs = _config->FindVector("APT::Architectures"); + string const arch = _config->Find("APT::Architecture"); + if (unlikely(arch.empty() == true)) + return archs; + if (archs.empty() == true || std::find(archs.begin(), archs.end(), arch) == archs.end()) archs.push_back(arch); + + // erase duplicates and empty strings + for (std::vector::reverse_iterator a = archs.rbegin(); + a != archs.rend(); ++a) { + if (a->empty() == true || std::find(a + 1, archs.rend(), *a) != archs.rend()) + archs.erase(a.base()-1); + if (a == archs.rend()) + break; + } + return archs; } /*}}}*/