File fix-diag-sortorder.diff of Package rpmlint.16849

--- a/Filter.py
+++ b/Filter.py
@@ -43,15 +43,15 @@ else:
 
 
 def printInfo(pkg, reason, *details):
-    _print("I", pkg, reason, details)
+    _print('I', pkg, reason, details)
 
 
 def printWarning(pkg, reason, *details):
-    _print("W", pkg, reason, details)
+    _print('W', pkg, reason, details)
 
 
 def printError(pkg, reason, *details):
-    _print("E", pkg, reason, details)
+    _print('E', pkg, reason, details)
 
 
 def _print(msgtype, pkg, reason, details):
@@ -111,8 +111,10 @@ def printDescriptions(reason):
 
 
 def _diag_sortkey(x):
-    xs = x.split()
-    return (xs[2], xs[1])
+    xs = x.split(maxsplit=2)
+    # Sort Category (Info/Warnings/Errors), Diagnostic, Name
+    # ['game.x86_64:', 'W:', 'call-to-mktemp /usr/games/lib/blub\n']
+    return (str('IWE'.find(xs[1][0])), xs[2], xs[0])
 
 
 def printAllReasons():
@@ -121,7 +123,7 @@ def printAllReasons():
         return False
 
     global _diagnostic
-    _diagnostic.sort(key=_diag_sortkey, reverse=True)
+    _diagnostic.sort(key=_diag_sortkey)
     last_reason = ''
     for diag in _diagnostic:
         if Config.info:
openSUSE Build Service is sponsored by