[yum-commits] Branch 'yum-3_2_X' - yum/packages.py

James Antill james at osuosl.org
Fri Feb 5 14:47:41 UTC 2010


 yum/packages.py |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c866d7022a98f3b20c26b83dcdec91fd1df0bd6b
Author: James Antill <james at and.org>
Date:   Thu Feb 4 15:51:23 2010 -0500

    Add a fast mode to pkg.verify(), don't verify the digest if others pass

diff --git a/yum/packages.py b/yum/packages.py
index 849b972..ba10136 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1348,7 +1348,7 @@ class YumInstalledPackage(YumHeaderPackage):
             self.yumdb_info = yumdb.get_package(self)
 
     def verify(self, patterns=[], deps=False, script=False,
-               fake_problems=True, all=False):
+               fake_problems=True, all=False, fast=False):
         """verify that the installed files match the packaged checksum
            optionally verify they match only if they are in the 'pattern' list
            returns a tuple """
@@ -1526,11 +1526,15 @@ class YumInstalledPackage(YumHeaderPackage):
                     prob.disk_value     = my_st.st_mode
                     problems.append(prob)
 
+                if fast and not problems and (my_st_size == size):
+                    vflags &= ~_RPMVERIFY_DIGEST
+
                 # Note that because we might get the _size_ from prelink,
                 # we need to do the checksum, even if we just throw it away,
                 # just so we get the size correct.
                 if (check_content and
-                    ((have_prelink and vflags & _RPMVERIFY_FILESIZE) or
+                    ((have_prelink and (vflags & _RPMVERIFY_FILESIZE) and
+                      (my_st_size != size)) or
                      (csum and vflags & _RPMVERIFY_DIGEST))):
                     try:
                         my_csum = misc.checksum(csum_type, fn)


More information about the Yum-commits mailing list