summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/aptconfiguration.cc11
-rw-r--r--apt-pkg/aptconfiguration.h8
-rw-r--r--apt-pkg/cdrom.cc25
-rw-r--r--apt-pkg/cdrom.h1
4 files changed, 45 insertions, 0 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index d31ccb642..653775688 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -319,6 +319,17 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
return codes;
}
/*}}}*/
+// checkLanguage - are we interested in the given Language? /*{{{*/
+bool const Configuration::checkLanguage(std::string Lang, bool const All) {
+ // the empty Language is always interesting as it is the original
+ if (Lang.empty() == true)
+ return true;
+ // filenames are encoded, so undo this
+ Lang = SubstVar(Lang, "%5f", "_");
+ std::vector<std::string> const langs = getLanguages(All, true);
+ return (std::find(langs.begin(), langs.end(), Lang) != langs.end());
+}
+ /*}}}*/
// getArchitectures - Return Vector of prefered Architectures /*{{{*/
std::vector<std::string> const Configuration::getArchitectures(bool const &Cached) {
using std::string;
diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h
index e098d0fd6..516f451d9 100644
--- a/apt-pkg/aptconfiguration.h
+++ b/apt-pkg/aptconfiguration.h
@@ -67,6 +67,14 @@ public: /*{{{*/
std::vector<std::string> static const getLanguages(bool const &All = false,
bool const &Cached = true, char const ** const Locale = 0);
+ /** \brief Are we interested in the given Language?
+ *
+ * \param Lang is the language we want to check
+ * \param All defines if we check against all codes or only against used codes
+ * \return true if we are interested, false otherwise
+ */
+ bool static const Configuration::checkLanguage(std::string Lang, bool const All = false);
+
/** \brief Returns a vector of Architectures we support
*
* \param Cached saves the result so we need to calculated it only once
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 8e746ee30..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. */
@@ -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, "
diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h
index cedfccff7..4fc3d3928 100644
--- a/apt-pkg/cdrom.h
+++ b/apt-pkg/cdrom.h
@@ -60,6 +60,7 @@ class pkgCdrom /*{{{*/
unsigned int Depth = 0);
bool DropBinaryArch(std::vector<std::string> &List);
bool DropRepeats(std::vector<std::string> &List,const char *Name);
+ bool DropTranslation(std::vector<std::string> &List);
void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
bool WriteDatabase(Configuration &Cnf);
bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);