]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debmetaindex.cc
merged from mvo
[apt.git] / apt-pkg / deb / debmetaindex.cc
index 7f15fd2e1f17ea4ddd41d2b6cd135a2bf9c03390..f3ab6960cd67d42b32f8e5c37629c88f0e551dce 100644 (file)
@@ -1,9 +1,5 @@
 // ijones, walters
 
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/debmetaindex.h"
-#endif
-
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/strutl.h>
@@ -119,6 +115,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 *>;
@@ -148,15 +151,34 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const
       vector <struct IndexTarget *> *targets = ComputeIndexTargets();
       for (vector <struct IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); Target++) {
         new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
-                        (*Target)->ShortDesc, "");
+                        (*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",
                     ComputeIndexTargets(),
                     new indexRecords (Dist));
 
+   // Queue the translations
+   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);
+   }
+
    return true;
 }
 
@@ -165,6 +187,10 @@ bool debReleaseIndex::IsTrusted() const
    string VerifiedSigFile = _config->FindDir("Dir::State::lists") +
       URItoFileName(MetaIndexURI("Release")) + ".gpg";
    
+   if(_config->FindB("APT::Authentication::TrustCDROM", false))
+      if(URI.substr(0,strlen("cdrom:")) == "cdrom:")
+        return true;
+   
    if (FileExists(VerifiedSigFile))
       return true;
    return false;
@@ -181,8 +207,10 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles()
       if ((*I)->IsSrc)
          Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted()));
       else 
+      {
          Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted()));
-      Indexes->push_back(new debTranslationsIndex(URI,Dist,(*I)->Section));
+        Indexes->push_back(new debTranslationsIndex(URI, Dist, (*I)->Section));
+      }
    }
 
    return Indexes;
@@ -212,7 +240,7 @@ class debSLTypeDebian : public pkgSourceList::Type
         // This check insures that there will be only one Release file
         // queued for all the Packages files and Sources files it
         // corresponds to.
-        if ((*I)->GetType() == "deb")
+               if (strcmp((*I)->GetType(), "deb") == 0)
         {
            debReleaseIndex *Deb = (debReleaseIndex *) (*I);
            // This check insures that there will be only one Release file