Explorar el Código

* Add hash support to copy method. Thanks Anders Kaseorg by the patch
(closes: #436055)

Otavio Salvador hace 19 años
padre
commit
ded1499981
Se han modificado 2 ficheros con 11 adiciones y 1 borrados
  1. 6 1
      debian/changelog
  2. 5 0
      methods/copy.cc

+ 6 - 1
debian/changelog

@@ -1,5 +1,6 @@
 apt (0.7.7) UNRELEASED; urgency=low
 
+  [ Michael Vogt ]
   * apt-inst/contrib/extracttar.cc:
     - fix fd leak for zero size files (thanks to Bill Broadley for
       reporting this bug)
@@ -20,7 +21,11 @@ apt (0.7.7) UNRELEASED; urgency=low
   [ Program translations ]
     - French updated
 
- -- Michael Vogt <michael.vogt@ubuntu.com>  Thu, 02 Aug 2007 11:55:54 +0200
+  [ Otavio Salvador ]
+  * Add hash support to copy method. Thanks Anders Kaseorg by the patch
+    (closes: #436055)
+
+ -- Otavio Salvador <otavio@debian.org>  Mon, 06 Aug 2007 10:44:53 -0300
 
 apt (0.7.6) unstable; urgency=low
 

+ 5 - 0
methods/copy.cc

@@ -12,6 +12,7 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
 
 #include <sys/stat.h>
 #include <utime.h>
@@ -79,6 +80,10 @@ bool CopyMethod::Fetch(FetchItem *Itm)
       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;
 }