Package buildbot :: Package steps :: Package package :: Package rpm :: Module rpmlint
[frames] | no frames]

Source Code for Module buildbot.steps.package.rpm.rpmlint

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Portions Copyright Buildbot Team Members 
15  # Portions Copyright Steve 'Ashcrow' Milner <smilner+buildbot@redhat.com> 
16  """ 
17  Steps and objects related to rpmlint. 
18  """ 
19   
20  from buildbot.steps.shell import Test 
21   
22   
23 -class RpmLint(Test):
24 """ 25 Rpmlint build step. 26 """ 27 28 name = "rpmlint" 29 30 description = ["Checking for RPM/SPEC issues"] 31 descriptionDone = ["Finished checking RPM/SPEC issues"] 32 33 fileloc = '.' 34 config = None 35
36 - def __init__(self, 37 fileloc=None, 38 config=None, 39 **kwargs):
40 """ 41 Create the Rpmlint object. 42 43 @type fileloc: str 44 @param fileloc: Location glob of the specs or rpms. 45 @type config: str 46 @param config: path to the rpmlint user config. 47 @type kwargs: dict 48 @param fileloc: all other keyword arguments. 49 """ 50 Test.__init__(self, **kwargs) 51 if fileloc: 52 self.fileloc = fileloc 53 if config: 54 self.config = config 55 56 self.command = ["rpmlint", "-i"] 57 if self.config: 58 self.command += ['-f', self.config] 59 self.command.append(self.fileloc)
60
61 - def createSummary(self, log):
62 """ 63 Create nice summary logs. 64 65 @param log: log to create summary off of. 66 """ 67 warnings = [] 68 errors = [] 69 for line in log.readlines(): 70 if ' W: ' in line: 71 warnings.append(line) 72 elif ' E: ' in line: 73 errors.append(line) 74 if warnings: 75 self.addCompleteLog('%d Warnings'%len(warnings), "".join(warnings)) 76 if errors: 77 self.addCompleteLog('%d Errors'%len(errors), "".join(errors))
78