From 14cc21fc32e8e44d4278aaeaa5136e2b1bb66b1c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 4 Jan 2010 14:10:37 -0800 Subject: Add a lint function. Needs better error handling, will add a custom error class --- src/fedpkg/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fedpkg/__init__.py b/src/fedpkg/__init__.py index b84a85a..ceffbbc 100644 --- a/src/fedpkg/__init__.py +++ b/src/fedpkg/__init__.py @@ -178,6 +178,22 @@ class PackageModule: return f return None + def lint(self): + """Run rpmlint over a built srpm""" + + # Make sure we have a srpm to run on + srpm = "%s-%s-%s.src.rpm" % (self.module, self.ver, self.rel) + rpm = "%s-%s-%s.%s.rpm" % (self.module, self.ver, self.rel, + os.uname()[4]) + if not os.path.exists(os.path.join(self.path, srpm)) and not \ + os.path.exists(os.path.join(self.path, rpm)): + return "Need to build srpm and rpm first" + cmd = ['rpmlint', os.path.join(self.path, srpm), + os.path.join(self.path, rpm)] + output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate() + return output[0] + + def new_sources(self, files): """Replace source file(s) in the lookaside cache""" -- cgit