Просмотр исходного кода

* apt-pkg/indexrecords.{cc,h}:
- add a constant Exists check for MetaKeys
* apt-pkg/acquire-item.cc:
- do not try PDiff if it is not listed in the Meta file

David Kalnischkies лет назад: 16
Родитель
Сommit
e1430400bf
4 измененных файлов с 20 добавлено и 6 удалено
  1. 8 5
      apt-pkg/acquire-item.cc
  2. 5 0
      apt-pkg/indexrecords.cc
  3. 2 0
      apt-pkg/indexrecords.h
  4. 5 1
      debian/changelog

+ 8 - 5
apt-pkg/acquire-item.cc

@@ -1105,13 +1105,16 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
             return;
          }
       }
-      
-      // Queue Packages file (either diff or full packages files, depending
-      // on the users option)
-      if(_config->FindB("Acquire::PDiffs",true) == true) 
+
+      /* Queue Packages file (either diff or full packages files, depending
+         on the users option) - we also check if the PDiff Index file is listed
+         in the Meta-Index file. Ideal would be if pkgAcqDiffIndex would test this
+         instead, but passing the required info to it is to much hassle */
+      if(_config->FindB("Acquire::PDiffs",true) == true && (verify == false ||
+	  MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true))
 	 new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description,
 			     (*Target)->ShortDesc, ExpectedIndexHash);
-      else 
+      else
 	 new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
 			    (*Target)->ShortDesc, ExpectedIndexHash);
    }

+ 5 - 0
apt-pkg/indexrecords.cc

@@ -31,6 +31,11 @@ const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey)
    return Entries[MetaKey];
 }
 
+bool indexRecords::Exists(string const &MetaKey) const
+{
+   return Entries.count(MetaKey) == 1;
+}
+
 bool indexRecords::Load(const string Filename)				/*{{{*/
 {
    FileFd Fd(Filename, FileFd::ReadOnly);

+ 2 - 0
apt-pkg/indexrecords.h

@@ -34,6 +34,8 @@ class indexRecords
 
    // Lookup function
    virtual const checkSum *Lookup(const string MetaKey);
+   /** \brief tests if a checksum for this file is available */
+   bool Exists(string const &MetaKey) const;
    std::vector<std::string> MetaKeys();
 
    virtual bool Load(string Filename);

+ 5 - 1
debian/changelog

@@ -12,8 +12,12 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low
     - try harder to find the other pseudo versions for autoremove multiarch
   * apt-pkg/aptconfiguration.cc:
     - remove duplicate architectures in getArchitectures()
+  * apt-pkg/indexrecords.{cc,h}:
+    - add a constant Exists check for MetaKeys
+  * apt-pkg/acquire-item.cc:
+    - do not try PDiff if it is not listed in the Meta file
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 28 May 2010 19:03:30 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 29 May 2010 12:03:20 +0200
 
 apt (0.7.26~exp5) experimental; urgency=low