[packages/rpm-build-tools] Feature: Remove "warning" lines from rpm-specdump output

glen glen at pld-linux.org
Wed Dec 1 12:34:30 CET 2021


commit 3e5d0ee427278c4c7de0bb065ccddaa3f676ec5a
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Dec 1 13:33:38 2021 +0200

    Feature: Remove "warning" lines from rpm-specdump output
    
    This prevents program stopping on such lines:
    
    warning: line 632: It's not recommended to have unversioned Obsoletes: Obsoletes:       php74-devel

 check-unused-files.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/check-unused-files.py b/check-unused-files.py
index e9edd05..83aab41 100755
--- a/check-unused-files.py
+++ b/check-unused-files.py
@@ -5,10 +5,22 @@ import sys
 import os
 import fnmatch
 
+def filterout_warnings(err, separator="\n"):
+    def filter():
+        for line in err.split(separator):
+            if line.startswith("warning: "):
+                continue
+            yield line
+
+    return separator.join(list(filter()))
+
 def specdump(spec):
     p = subprocess.Popen(['rpm-specdump', spec], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     (out, err) = p.communicate(None)
     p.wait()
+
+    err = filterout_warnings(err)
+
     return (out, err)
 
 if len(sys.argv) == 2:
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/3e5d0ee427278c4c7de0bb065ccddaa3f676ec5a



More information about the pld-cvs-commit mailing list