]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - check-unused-files.py
clean-distfiles.sh: Add more files to cleanup, show report
[packages/rpm-build-tools.git] / check-unused-files.py
index c1ec3770c957fdee932517ae6fadf556ae4d1197..83aab415184dcc88a281d3e07e4805d0fa420c9e 100755 (executable)
@@ -5,6 +5,24 @@ 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:
     spec = sys.argv[1]
 else:
@@ -19,9 +37,7 @@ dir = os.path.dirname(spec)
 if dir == '':
     dir = '.'
 
-p = subprocess.Popen(['rpm-specdump', spec], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-(out, err) = p.communicate(None)
-p.wait()
+(out, err) = specdump(spec)
 if err:
     print >> sys.stderr, "%s: %s" % (sys.argv[0], err)
     sys.exit(1)
@@ -38,7 +54,7 @@ for l in out.split('\n'):
 obsolete = []
 
 # files to exclude
-exclude = ['log.*', '.#*', '*~', '*.orig', '*.sw?']
+exclude = ['log.*', '.#*', '*~', '*.orig', '*.sw?', '.bigfiles', 'sources']
 
 # read .gitignore, distfiles files are filled there
 if os.path.isfile('%s/.gitignore' % dir):
This page took 0.055461 seconds and 4 git commands to generate.