]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - check-unused-files.py
- php-pear-PEAR_Command_Packaging
[packages/rpm-build-tools.git] / check-unused-files.py
index 8e62ea95528455a6f5aa8ca56d2c7d1ddf2f7d32..68d19416c1f8e93927093c4405a81ee164d9fd35 100644 (file)
@@ -5,11 +5,11 @@ import sys
 import os
 import fnmatch
 
-if len(sys.argv) != 2:
-    print >> sys.stderr, "Usage: %s <spec>" % sys.argv[0]
-    sys.exit(1)
-
-spec = sys.argv[1]
+if len(sys.argv) == 2:
+    spec = sys.argv[1]
+else:
+    # try autodetecting
+    spec = "%s.spec" % os.path.basename(os.getcwd())
 
 if not os.path.isfile(spec):
     print >> sys.stderr, "%s: %s doesn't exist!" % (sys.argv[0], spec)
@@ -37,20 +37,29 @@ for l in out.split('\n'):
 
 obsolete = []
 
+# files to exclude
+exclude = ['log.*', '.#*', '*~', '*.orig', '*.sw?']
+
+# read .cvsignore, distfiles files are filled there
+if os.path.isfile('%s/.cvsignore' % dir):
+    f = open('%s/.cvsignore' % dir , 'r')
+    for l in f.readlines():
+        exclude.append(l.rstrip())
+
 def blacklisted(file):
     if file == os.path.basename(spec):
         return True
 
-    if file in [ '.', '..', 'CVS', '.cvsignore', 'dropin', 'md5', 'adapter', 'builder',
-            'relup.sh', 'compile.sh', 'repackage.sh', 'pearize.sh', 'rsync.sh', 'TODO']:
+    if file in [ '.', '..', 'CVS', 'TODO']:
         return True
 
-    for pat in ['log.*', '.#*', '*~', '*.orig', '*.sw?']:
+    for pat in exclude:
         if fnmatch.fnmatch(file, pat):
             return True
 
     return False
 
+
 for file in os.listdir(dir):
     file = os.path.basename(file)
     if blacklisted(file):
This page took 0.318331 seconds and 4 git commands to generate.