Kaynağa Gözat

* methods/copy.cc:
- take hashes here too
* apt-pkg/acquire-worker.cc:
- only pass on computed hash if we recived one from the method

Michael Vogt 19 yıl önce
ebeveyn
işleme
73eb178891
3 değiştirilmiş dosya ile 15 ekleme ve 3 silme
  1. 3 1
      apt-pkg/acquire-worker.cc
  2. 5 1
      debian/changelog
  3. 7 1
      methods/copy.cc

+ 3 - 1
apt-pkg/acquire-worker.cc

@@ -273,7 +273,9 @@ bool pkgAcquire::Worker::RunMessages()
 	    if(!expectedHash.empty()) 
 	    {
 	       string hashTag = expectedHash.HashType()+"-Hash";
-	       RecivedHash = expectedHash.HashType() + ":" + LookupTag(Message, hashTag.c_str());
+	       string hashSum = LookupTag(Message, hashTag.c_str());
+	       if(!hashSum.empty())
+		  RecivedHash = expectedHash.HashType() + ":" + hashSum;
 	       if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
 	       {
 		  clog << "201 URI Done: " << Owner->DescURI() << endl

+ 5 - 1
debian/changelog

@@ -3,8 +3,12 @@ apt (0.7.6ubuntu4) gutsy; urgency=low
   * cmdline/apt-get.cc:
     - remove YnPrompt when a XS-Vcs- tag is found, improve the
       notice (LP: #129575)
+  * methods/copy.cc:
+    - take hashes here too
+  * apt-pkg/acquire-worker.cc:
+    - only pass on computed hash if we recived one from the method
 
- --
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 08 Aug 2007 19:30:29 +0200
 
 apt (0.7.6ubuntu3) gutsy; urgency=low
 

+ 7 - 1
methods/copy.cc

@@ -12,6 +12,8 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/fileutl.h>
 
 #include <sys/stat.h>
 #include <utime.h>
@@ -78,7 +80,11 @@ bool CopyMethod::Fetch(FetchItem *Itm)
       To.OpFail();
       return _error->Errno("utime",_("Failed to set modification time"));
    }
-   
+
+   Hashes Hash;
+   FileFd Fd(Res.Filename, FileFd::ReadOnly);
+   Hash.AddFD(Fd.Fd(), Fd.Size());
+   Res.TakeHashes(Hash);
    URIDone(Res);
    return true;
 }