From 7e771c2729cb6f3d112093b29a1976f02a1c1213 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 3 Feb 2011 07:35:25 +0000 Subject: [PATCH] - if no args passed, load whole tree files Changed files: bin/pfa-lintpkg -> 1.2 --- bin/pfa-lintpkg | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/pfa-lintpkg b/bin/pfa-lintpkg index b89d153..a5ce67f 100644 --- a/bin/pfa-lintpkg +++ b/bin/pfa-lintpkg @@ -8,7 +8,7 @@ import ftptree 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) @@ -23,8 +23,18 @@ if not ftpio.lock(sys.argv[1], True): 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: @@ -61,12 +71,11 @@ def chunk(seq, size, pad=None): 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) -- 2.44.0