Package buildbot :: Package steps :: Package package :: Package deb :: Module lintian
[frames] | no frames]

Source Code for Module buildbot.steps.package.deb.lintian

 1  # This program 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 Marius Rieder <marius.rieder@durchmesser.ch> 
16  """ 
17  Steps and objects related to lintian 
18  """ 
19   
20  from buildbot.steps.shell import ShellCommand 
21  from buildbot.status.results import SUCCESS, WARNINGS, FAILURE 
22  from buildbot import config 
23   
24 -class DebLintian(ShellCommand):
25 name = "lintian" 26 description = ["Lintian running"] 27 descriptionDone = ["Lintian"] 28 29 fileloc = None 30 suppressTags = [] 31 32 warnCount = 0 33 errCount = 0 34 35 flunkOnFailure=False 36 warnOnFailure=True 37
38 - def __init__(self, fileloc=None, suppressTags=None, **kwargs):
39 """ 40 Create the DebLintian object. 41 42 @type fileloc: str 43 @param fileloc: Location of the .deb or .changes to test. 44 @type suppressTags: list 45 @param suppressTags: List of tags to suppress. 46 @type kwargs: dict 47 @param kwargs: all other keyword arguments. 48 """ 49 ShellCommand.__init__(self, **kwargs) 50 if fileloc: 51 self.fileloc = fileloc 52 if suppressTags: 53 self.suppressTags = suppressTags 54 55 if not self.fileloc: 56 config.error("You must specify a fileloc") 57 58 self.command = ["lintian", "-v", self.fileloc] 59 60 if self.suppressTags: 61 for tag in self.suppressTags: 62 self.command += ['--suppress-tags', tag]
63
64 - def createSummary(self, log):
65 """ 66 Create nice summary logs. 67 68 @param log: log to create summary off of. 69 """ 70 warnings = [] 71 errors = [] 72 for line in log.readlines(): 73 if 'W: ' in line: 74 warnings.append(line) 75 elif 'E: ' in line: 76 errors.append(line) 77 78 if warnings: 79 self.addCompleteLog('%d Warnings' % len(warnings), "".join(warnings)) 80 self.warnCount = len(warnings) 81 if errors: 82 self.addCompleteLog('%d Errors' % len(errors), "".join(errors)) 83 self.errCount = len(errors)
84
85 - def evaluateCommand(self, cmd):
86 if ( cmd.rc != 0 or self.errCount): 87 return FAILURE 88 if self.warnCount: 89 return WARNINGS 90 return SUCCESS
91