]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/acquire-worker.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 8 Aug 2007 17:28:43 +0000 (19:28 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 8 Aug 2007 17:28:43 +0000 (19:28 +0200)
  - only pass a hash if we actually got one from the method
* methods/copy.cc:
  - take hashes here too (*sigh*)

apt-pkg/acquire-worker.cc
methods/copy.cc

index 460f599611dba48868c515b7535ad6584fe95365..739c9e32ccacf1e4381e1872b3a3db61c3f3067a 100644 (file)
@@ -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
index d737e3c33cb851b646d726c24f00fad053098cce..8dd0bd3f5037334005f29709d19d50feec618348 100644 (file)
@@ -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;
 }