summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-10-05 23:00:47 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-10-05 23:00:47 +0200
commitd073d7db69eddd2d9c22e8ded7c6b871bca1716a (patch)
treeb8244eb97f78e96e34cf1fc5f1c0b19ec4bd5ab3 /apt-pkg
parent061c58b61ab5aae4689386bd2ab1e36e71470dfc (diff)
cherrypick from my apt/experimental branch
* apt-pkg/deb/debmetaindex.cc: - none is a separator, not a language: no need for Index (Closes: #624218) * apt-pkg/aptconfiguration.cc: - do not builtin languages only if none is forced (Closes: #643787)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/aptconfiguration.cc6
-rw-r--r--apt-pkg/deb/debmetaindex.cc8
2 files changed, 10 insertions, 4 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 6ec5fa03a..bc385b2dc 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -140,7 +140,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
string const name = Ent->d_name;
size_t const foundDash = name.rfind("-");
- size_t const foundUnderscore = name.rfind("_");
+ size_t const foundUnderscore = name.rfind("_", foundDash);
if (foundDash == string::npos || foundUnderscore == string::npos ||
foundDash <= foundUnderscore ||
name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation")
@@ -151,7 +151,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
// Skip unusual files, like backups or that alike
string::const_iterator s = c.begin();
for (;s != c.end(); ++s) {
- if (isalpha(*s) == 0)
+ if (isalpha(*s) == 0 && *s != '_')
break;
}
if (s != c.end())
@@ -232,6 +232,8 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
codes = environment;
} else if (forceLang != "none")
codes.push_back(forceLang);
+ else //if (forceLang == "none")
+ builtin.clear();
allCodes = codes;
for (std::vector<string>::const_iterator b = builtin.begin();
b != builtin.end(); ++b)
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index f6c50742e..22effdc8f 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -9,6 +9,7 @@
#include <apt-pkg/error.h>
#include <set>
+#include <algorithm>
using namespace std;
@@ -195,7 +196,11 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
}
}
- std::vector<std::string> const lang = APT::Configuration::getLanguages(true);
+ std::vector<std::string> lang = APT::Configuration::getLanguages(true);
+ std::vector<std::string>::iterator lend = std::remove(lang.begin(), lang.end(), "none");
+ if (lend != lang.end())
+ lang.erase(lend);
+
if (lang.empty() == true)
return IndexTargets;
@@ -207,7 +212,6 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
s != sections.end(); ++s) {
for (std::vector<std::string>::const_iterator l = lang.begin();
l != lang.end(); ++l) {
- if (*l == "none") continue;
IndexTarget * Target = new OptionalIndexTarget();
Target->ShortDesc = "Translation-" + *l;
Target->MetaKey = TranslationIndexURISuffix(l->c_str(), *s);