diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-09-04 14:49:41 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-09-04 14:49:41 +0200 |
commit | 89e95aee05c7f2fde7eb11261df9697a4896b49b (patch) | |
tree | 51ab3d569d8ab1c8d3b25de1452eeb767770e0e7 /apt-pkg/cdrom.cc | |
parent | d7bc74a4e44c4ff97e70f15e19f86761687f2ca5 (diff) | |
parent | 92f212774bebbff6aabd3081910f570a77180911 (diff) |
merged lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/cdrom.cc')
-rw-r--r-- | apt-pkg/cdrom.cc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 699f66fb3..9a9a854bf 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -272,6 +272,29 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List) return true; } /*}}}*/ +// DropTranslation - Dump unwanted Translation-<lang> files /*{{{*/ +// --------------------------------------------------------------------- +/* Here we drop everything that is not configured in Acquire::Languages */ +bool pkgCdrom::DropTranslation(vector<string> &List) +{ + for (unsigned int I = 0; I < List.size(); I++) + { + const char *Start; + if ((Start = strstr(List[I].c_str(), "/Translation-")) == NULL) + continue; + Start += strlen("/Translation-"); + + if (APT::Configuration::checkLanguage(Start, true) == true) + continue; + + // not accepted -> Erase it + List.erase(List.begin() + I); + --I; // the next entry is at the same index after the erase + } + + return true; +} + /*}}}*/ // DropRepeats - Drop repeated files resulting from symlinks /*{{{*/ // --------------------------------------------------------------------- /* Here we go and stat every file that we found and strip dup inodes. */ @@ -363,6 +386,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List) string Word1 = string(*I,Space,SSpace-Space); string Prefix = string(*I,0,Space); + string Component = string(*I,SSpace); for (vector<string>::iterator J = List.begin(); J != I; ++J) { // Find a space.. @@ -377,9 +401,11 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List) continue; if (string(*J,Space2,SSpace2-Space2) != Word1) continue; - - *J += string(*I,SSpace); - *I = string(); + + string Component2 = string(*J, SSpace2) + " "; + if (Component2.find(Component + " ") == std::string::npos) + *J += Component; + I->clear(); } } @@ -711,6 +737,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ DropRepeats(SigList,"InRelease"); _error->RevertToStack(); DropRepeats(TransList,""); + if (_config->FindB("APT::CDROM::DropTranslation", true) == true) + DropTranslation(TransList); if(log != NULL) { msg.str(""); ioprintf(msg, _("Found %zu package indexes, %zu source indexes, " |