glsa-check: hide non-vuln glsas in quiet mode
authorvapier <vapier@gentoo.org>
Sun, 7 Mar 2010 01:37:57 +0000 (01:37 -0000)
committervapier <vapier@gentoo.org>
Sun, 7 Mar 2010 01:37:57 +0000 (01:37 -0000)
svn path=/trunk/gentoolkit/; revision=750

bin/glsa-check

index ab83471bd3d2a802ea36dc5c4f9551819d05bfda..78fa86b29b3ca9e195387b3b3d4626aa45b4315b 100755 (executable)
@@ -259,10 +259,14 @@ if mode in ["dump", "fix", "inject", "pretend"]:
                if mode == "dump":
                        myglsa.dump()
                elif mode == "fix":
-                       sys.stdout.write("Fixing GLSA "+myid+"\n")
+                       if not quiet:
+                               sys.stdout.write("Fixing GLSA "+myid+"\n")
                        if not myglsa.isVulnerable():
-                               sys.stdout.write(">>> no vulnerable packages installed\n")
+                               if not quiet:
+                                       sys.stdout.write(">>> no vulnerable packages installed\n")
                        else:
+                               if quiet:
+                                       sys.stdout.write("Fixing GLSA "+myid+"\n")
                                mergelist = myglsa.getMergeList(least_change=least_change)
                                if mergelist == []:
                                        sys.stdout.write(">>> cannot fix GLSA, no unaffected packages available\n")
@@ -284,10 +288,14 @@ if mode in ["dump", "fix", "inject", "pretend"]:
                                if len(mergelist):
                                        sys.stdout.write("\n")
                elif mode == "pretend":
-                       sys.stdout.write("Checking GLSA "+myid+"\n")
+                       if not quiet:
+                               sys.stdout.write("Checking GLSA "+myid+"\n")
                        if not myglsa.isVulnerable():
-                               sys.stdout.write(">>> no vulnerable packages installed\n")
+                               if not quiet:
+                                       sys.stdout.write(">>> no vulnerable packages installed\n")
                        else:
+                               if quiet:
+                                       sys.stdout.write("Checking GLSA "+myid+"\n")
                                mergedict = {}
                                for (vuln, update) in myglsa.getAffectionTable(least_change=least_change):
                                        mergedict.setdefault(update, []).append(vuln)
@@ -307,7 +315,6 @@ if mode in ["dump", "fix", "inject", "pretend"]:
                                if no_upgrades:
                                        sys.stdout.write(">>> No upgrade path exists for these packages:\n")
                                        sys.stdout.write("     " + red(", ".join(no_upgrades)) + "\n")
-                       sys.stdout.write("\n")
                elif mode == "inject":
                        sys.stdout.write("injecting " + myid + "\n")
                        myglsa.inject()