[yum-git] yum/packages.py

James Antill james at linux.duke.edu
Sat Mar 1 19:40:47 UTC 2008


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

New commits:
commit d5211a87a2e9a267ef44759363f07be6f0aa8ba0
Author: James Antill <james at and.org>
Date:   Sat Mar 1 14:39:57 2008 -0500

    Allow other callers than yum-verify to turn fake-problems off

diff --git a/yum/packages.py b/yum/packages.py
index 424103f..1565a44 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -898,7 +898,7 @@ class YumInstalledPackage(YumHeaderPackage):
         fakerepo = _installed_repo
         YumHeaderPackage.__init__(self, fakerepo, hdr)
         
-    def verify(self, patterns=[], all=False):
+    def verify(self, patterns=[], fake_problems=True, all=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 """
@@ -965,18 +965,21 @@ class YumInstalledPackage(YumHeaderPackage):
                     ftypes.append("state=" + statemap[state])
                 else:
                     ftypes.append("state=<unknown>")
-                results[fn] = [_PkgVerifyProb('state',
-                                              'state is not normal',
-                                              ftypes)]
+                if fake_problems:
+                    results[fn] = [_PkgVerifyProb('state',
+                                                  'state is not normal',
+                                                  ftypes)]
                 continue
 
-            if flags & rpm.RPMFILE_MISSINGOK:
+            if flags & rpm.RPMFILE_MISSINGOK and fake_problems:
                 results[fn] = [_PkgVerifyProb('missingok', 'missing but ok',
                                               ftypes)]
+            if flags & rpm.RPMFILE_MISSINGOK and not all:
                 continue # rpm just skips missing ok, so we do too
 
-            if flags & rpm.RPMFILE_GHOST:
+            if flags & rpm.RPMFILE_GHOST and fake_problems:
                 results[fn] = [_PkgVerifyProb('ghost', 'ghost file',ftypes)]
+            if flags & rpm.RPMFILE_GHOST and not all:
                 continue
 
             # do check of file status on system



More information about the Yum-cvs-commits mailing list