]> git.saurik.com Git - apt.git/commitdiff
Merge remote-tracking branch 'upstream/debian/experimental' into feature/acq-trans
authorMichael Vogt <mvo@ubuntu.com>
Tue, 23 Sep 2014 13:47:44 +0000 (15:47 +0200)
committerMichael Vogt <mvo@ubuntu.com>
Tue, 23 Sep 2014 13:47:44 +0000 (15:47 +0200)
Conflicts:
apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
methods/copy.cc
test/integration/test-hashsum-verification

1  2 
apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
methods/copy.cc

index 1fa7971c54cba862d32de53e23c39fc2a848aff4,bbdd3897ab60eb869e0b1a7dac058ff637bf656b..e8b0e25def18c20a8e6cca55b0a884b8f3428085
@@@ -1065,9 -1136,9 +1065,10 @@@ void pkgAcqIndex::Done(string Message,u
     {
        if (ExpectedHashes.usable() && ExpectedHashes != Hashes)
        {
+          Desc.URI = RealURI;
         RenameOnError(HashSumMismatch);
         printHashSumComparision(RealURI, ExpectedHashes, Hashes);
 +         Failed(Message, Cfg);
           return;
        }
  
           }
        }
         
 -      // Done, move it into position
 -      string FinalFile = GetFinalFilename(RealURI, compExt);
 -      Rename(DestFile,FinalFile);
 -      chmod(FinalFile.c_str(),0644);
 -
 -      /* We restore the original name to DestFile so that the clean operation
 -         will work OK */
 -      DestFile = _config->FindDir("Dir::State::lists") + "partial/";
 -      DestFile += URItoFileName(RealURI);
 -      if (_config->FindB("Acquire::GzipIndexes",false) && compExt == "gz")
 -         DestFile += ".gz";
 +      // FIXME: can we void the "Erase" bool here as its very non-local?
 +      std::string CompressedFile = _config->FindDir("Dir::State::lists") + "partial/";
 +      CompressedFile += URItoFileName(RealURI);
        // Remove the compressed version.
        if (Erase == true)
 -       unlink(DestFile.c_str());
 +       unlink(CompressedFile.c_str());
 +
 +      // Done, queue for rename on transaction finished
 +      PartialFile = DestFile;
 +      DestFile = GetFinalFilename(RealURI, compExt);
  
        return;
     }
        Erase = true;
     else
        Local = true;
-    
+    // do not reverify cdrom sources as apt-cdrom may rewrite the Packages
+    // file when its doing the indexcopy
+    if (RealURI.substr(0,6) == "cdrom:" &&
+        StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+       return;
+    // The files timestamp matches, for non-local URLs reverify the local
+    // file, for local file, uncompress again to ensure the hashsum is still
+    // matching the Release file
+    if (!Local && StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+    {
 -      ReverifyAfterIMS(FileName);
++      ReverifyAfterIMS();
+       return;
+    }
     string decompProg;
  
-    // If we enable compressed indexes and already have gzip, keep it
-    if (_config->FindB("Acquire::GzipIndexes",false) && compExt == "gz" && !Local) {
-       // Done, queue for rename on transaction finished
-       PartialFile = DestFile;
-       DestFile = GetFinalFilename(RealURI, compExt);
+    // If we enable compressed indexes, queue for hash verification
+    if (_config->FindB("Acquire::GzipIndexes",false) && compExt == "gz" && !Local) 
+    {
+       DestFile = _config->FindDir("Dir::State::lists");
+       DestFile += URItoFileName(RealURI) + ".gz";
+       Decompression = true;
+       Desc.URI = "copy:" + FileName;
+       QueueURI(Desc);
        return;
      }
  
Simple merge
diff --cc methods/copy.cc
index 8c797ff1fd6a183fd9aa0a59a55697bb241dad84,b78053d364724bba2030206a1e417be4eee4b068..30a3f4a5197da6a4f8b554c392b53f77ad50f158
@@@ -70,15 -70,15 +70,23 @@@ bool CopyMethod::Fetch(FetchItem *Itm
     Res.LastModified = Buf.st_mtime;
     Res.IMSHit = false;      
     URIStart(Res);
 +
 +   // when the files are identical, just compute the hashes
 +   if(File == Itm->DestFile)
 +   {
 +      CalculateHashes(Res);
 +      URIDone(Res);
 +      return true;
 +   }
     
+    // just calc the hashes if the source and destination are identical
+    if (File == Itm->DestFile)
+    {
+       CalculateHashes(Res);
+       URIDone(Res);
+       return true;
+    }
     // See if the file exists
     FileFd From(File,FileFd::ReadOnly);
     FileFd To(Itm->DestFile,FileFd::WriteAtomic);