[BREAK] add possibility to download and use multiply
[ntk/apt.git] / apt-pkg / deb / debmetaindex.cc
index 9ac659f..8f28f05 100644 (file)
@@ -5,6 +5,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/error.h>
 
 using namespace std;
@@ -115,6 +116,13 @@ debReleaseIndex::debReleaseIndex(string URI,string Dist)
    this->Type = "deb";
 }
 
+debReleaseIndex::~debReleaseIndex()
+{
+   for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin();
+       I != SectionEntries.end(); I++)
+      delete *I;
+}
+
 vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const
 {
    vector <struct IndexTarget *>* IndexTargets = new vector <IndexTarget *>;
@@ -146,7 +154,16 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const
         new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
                         (*Target)->ShortDesc, HashString());
       }
+      // this is normally created in pkgAcqMetaSig, but if we run
+      // in --print-uris mode, we add it here
+      new pkgAcqMetaIndex(Owner, MetaIndexURI("Release"),
+                    MetaIndexInfo("Release"), "Release",
+                    MetaIndexURI("Release.gpg"), 
+                    ComputeIndexTargets(),
+                    new indexRecords (Dist));
+
    }
+
    new pkgAcqMetaSig(Owner, MetaIndexURI("Release.gpg"),
                     MetaIndexInfo("Release.gpg"), "Release.gpg",
                     MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release",
@@ -154,13 +171,19 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const
                     new indexRecords (Dist));
 
    // Queue the translations
+   std::vector<std::string> const lang = APT::Configuration::getLanguages(true);
    for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin(); 
        I != SectionEntries.end(); I++) {
 
       if((*I)->IsSrc)
         continue;
-      debTranslationsIndex i = debTranslationsIndex(URI,Dist,(*I)->Section);
-      i.GetIndexes(Owner);
+
+      for (vector<string>::const_iterator l = lang.begin();
+               l != lang.end(); l++)
+      {
+       debTranslationsIndex i = debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str());
+       i.GetIndexes(Owner);
+      }
    }
 
    return true;
@@ -186,6 +209,7 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles()
       return Indexes;
 
    Indexes = new vector <pkgIndexFile*>;
+   std::vector<std::string> const lang = APT::Configuration::getLanguages(true);
    for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin(); 
        I != SectionEntries.end(); I++) {
       if ((*I)->IsSrc)
@@ -193,7 +217,10 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles()
       else 
       {
          Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted()));
-        Indexes->push_back(new debTranslationsIndex(URI, Dist, (*I)->Section));
+
+        for (vector<string>::const_iterator l = lang.begin();
+               l != lang.end(); l++)
+           Indexes->push_back(new debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str()));
       }
    }