This is ugly.  We want to verify downloaded packages ASAP, so right after 
download.
But the checksum has to be read from sqlite DB, which does not play with 
threading.
So we add caching, and preload it.
---
 yum/__init__.py |    1 +
 yum/packages.py |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 7b2483f..cfb2901 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1962,6 +1962,7 @@ class YumBase(depsolve.Depsolve):
                     self.verbose_logger.debug(_("using local copy of %s") 
%(po,))
                     continue
                         
+            po.returnIdSum() # preload checksum
             remote_pkgs.append(po)
             remote_size += po.size
             
diff --git a/yum/packages.py b/yum/packages.py
index 5ef9951..429ee55 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -364,9 +364,12 @@ class PackageObject(object):
     checksums = property(fget=lambda self: self.returnChecksums())
     
     def returnIdSum(self):
+        if hasattr(self, '_idSum'):
+            return self._idSum
         for (csumtype, csum, csumid) in self.checksums:
             if csumid:
-                return (csumtype, csum)
+                self._idSum = csumtype, csum
+                return self._idSum
 
 
 _not_found_repo = FakeRepository('-')
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to