from common import checkdir
import ftpio
-if len(sys.argv) < 3:
+if len(sys.argv) < 2:
print >>sys.stderr, "ERR: not enough parameters given"
print >>sys.stderr, "rpmlint.py tree package1 [package2...]"
sys.exit(1)
files = []
try:
- tree = ftptree.FtpTree(sys.argv[1])
- tree.mark4moving(sys.argv[2:])
+ if len(sys.argv) < 3:
+ loadall = True
+ else:
+ loadall = False
+
+ # if no files specified, grab whole tree contents
+ tree = ftptree.FtpTree(sys.argv[1], loadall = loadall)
+ if loadall:
+ # this is hack, should be a param, not access private .loadedpkgs element
+ tree.mark4moving(tree.loadedpkgs)
+ else:
+ tree.mark4moving(sys.argv[2:])
files = tree.rpmfiles(debugfiles = False, sourcefiles = False)
except ftptree.SomeError:
yield seq[-mod:]
def rpmlint(files):
- print files
cmd = ['/usr/bin/rpmlint'] + files
rc = subprocess.call(cmd, stdin = subprocess.PIPE, stdout = sys.stdout, stderr = sys.stderr, close_fds = True)
return rc == 0
print "rpmlint of %d files from %d packages" % (len(files), len(tree.loadedpkgs))
for x in chunk(files, 512):
- print "rpmlint %d files" % len(x)
+ print "rpmlint %d of %d files" % (len(x), len(files))
rpmlint(x)