]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cdrom.cc
merged lp:~mvo/apt/fix-tagfile-hash
[apt.git] / apt-pkg / cdrom.cc
index 8e746ee3013f16ad9ae4b02b521f3cc4f3368ccb..9a9a854bf67bf7a081b48efe855953f78183fe2e 100644 (file)
@@ -269,6 +269,29 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
       --I; // the next entry is at the same index after the erase
    }
    
+   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;
 }
                                                                        /*}}}*/
@@ -714,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, "