Blame SOURCES/BZ-1349433-verifytree-handle-no-core-group.patch

5b4f08
commit b586ff502946fbd3271db8370cb546f696c51cfd
5b4f08
Author: Michal Domonkos <mdomonko@redhat.com>
5b4f08
Date:   Fri Oct 20 19:47:36 2017 +0200
5b4f08
5b4f08
    verifytree: handle no @core group gracefully. BZ 1349433
5b4f08
    
5b4f08
    It's not clear to me whether @core group is really mandatory, however
5b4f08
    let's make verifytree fail if it's not defined so that we don't change
5b4f08
    the return code to 0 for that case; we would return 1 previously (python
5b4f08
    traceback) and now we OR the BAD_COMPS flag which is 4 (still not 1 but
5b4f08
    at least non-zero).
5b4f08
5b4f08
diff --git a/verifytree.py b/verifytree.py
5b4f08
index 6a127cd..603a633 100755
5b4f08
--- a/verifytree.py
5b4f08
+++ b/verifytree.py
5b4f08
@@ -278,7 +278,14 @@ def main():
5b4f08
     elif not (retval & BAD_COMPS or opts.nocomps):
5b4f08
         print "Checking mandatory @core packages"
5b4f08
         group = my.comps.return_group('core')
5b4f08
-        for pname in group.mandatory_packages:
5b4f08
+        if group is not None:
5b4f08
+            pkgs = group.mandatory_packages
5b4f08
+        else:
5b4f08
+            print "  @core group not found"
5b4f08
+            retval = retval | BAD_COMPS
5b4f08
+            report('COMPS','FAILED')
5b4f08
+            pkgs = []
5b4f08
+        for pname in pkgs:
5b4f08
             # FIXME: this pulls from pkgSack, which (I guess) is populated 
5b4f08
             # based on the arch etc. of the current host.. so you can't check
5b4f08
             # the x86_64 repo from an i386 machine, f'rinstance.