From f87fab03bade8a049b318df68dfa4c361fab944c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 10 Jun 2012 00:40:55 +0200 Subject: [PATCH] * apt-pkg/aptconfiguration.cc: - if APT::Languages=none save "none" in allCodes so that the detected configuration is cached as intended (Closes: #674690, LP: #1004947) --- apt-pkg/aptconfiguration.cc | 26 +++++++++++++++----------- debian/changelog | 3 +++ test/libapt/getlanguages_test.cc | 6 ++++-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index d763546f8..d31ccb642 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -234,17 +234,21 @@ std::vector const Configuration::getLanguages(bool const &All, // override the configuration settings vector of languages. string const forceLang = _config->Find("Acquire::Languages",""); if (forceLang.empty() == false) { - if (forceLang == "environment") { - codes = environment; - } else if (forceLang != "none") - codes.push_back(forceLang); - else //if (forceLang == "none") - builtin.clear(); - allCodes = codes; - for (std::vector::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); + if (forceLang == "none") { + codes.clear(); + allCodes.clear(); + allCodes.push_back("none"); + } else { + if (forceLang == "environment") + codes = environment; + else + codes.push_back(forceLang); + allCodes = codes; + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + } if (All == true) return allCodes; else diff --git a/debian/changelog b/debian/changelog index d8adba89a..adcf0d956 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,9 @@ apt (0.9.5.2) UNRELEASED; urgency=low - set pkgCacheGen::Essential to "all" again (Closes: #675449) * apt-pkg/algorithms.cc: - force install only for one essential package out of a group + * apt-pkg/aptconfiguration.cc: + - if APT::Languages=none save "none" in allCodes so that the detected + configuration is cached as intended (Closes: #674690, LP: #1004947) [ Justin B Rye ] * doc/apt-cdrom.8.xml: diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index 274cf4aa4..cef89bde6 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -144,7 +144,8 @@ int main(int argc,char *argv[]) _config->Set("Acquire::Languages", "none"); vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); _config->Set("Dir::State::lists", "/non-existing-dir"); @@ -168,7 +169,8 @@ int main(int argc,char *argv[]) _config->Set("Acquire::Languages", "none"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); //FIXME: Remove support for this deprecated setting -- 2.45.2