Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check debian packages for common problems.
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This file is part of Buildbot. Buildbot is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Portions Copyright Buildbot Team Members | ||
# Portions Copyright Marius Rieder <marius.rieder@durchmesser.ch> | ||
""" | ||
Steps specific to the dep package format. | ||
""" | ||
|
||
from lintian import DebLintian | ||
|
||
__all__ = ['DebLintian'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This program is free software; you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Portions Copyright Buildbot Team Members | ||
# Portions Copyright Marius Rieder <marius.rieder@durchmesser.ch> | ||
""" | ||
Steps and objects related to lintian | ||
""" | ||
|
||
from buildbot.steps.shell import Test | ||
from buildbot import config | ||
|
||
class DebLintian(Test): | ||
name = "lintian" | ||
description = ["Lintian running"] | ||
descriptionDone = ["Lintian"] | ||
|
||
warningPattern = '.*W: .*' | ||
|
||
fileloc = None | ||
|
||
def __init__(self, fileloc=None, **kwargs): | ||
""" | ||
Create the DebLintian object. | ||
@type fileloc: str | ||
@param fileloc: Location of the .deb or .changes to test. | ||
@type kwargs: dict | ||
@param kwargs: all other keyword arguments. | ||
""" | ||
Test.__init__(self, **kwargs) | ||
if fileloc: | ||
self.fileloc = fileloc | ||
|
||
if not self.fileloc: | ||
config.error("You must specify a fileloc") | ||
|
||
self.command = ["lintian", "-v", self.fileloc] | ||
|
||
def createSummary(self, log): | ||
""" | ||
Create nice summary logs. | ||
@param log: log to create summary off of. | ||
""" | ||
warnings = [] | ||
errors = [] | ||
for line in log.readlines(): | ||
if ' W: ' in line: | ||
warnings.append(line) | ||
elif ' E: ' in line: | ||
errors.append(line) | ||
|
||
if warnings: | ||
self.addCompleteLog('%d Warnings' % len(warnings), "".join(warnings)) | ||
if errors: | ||
self.addCompleteLog('%d Errors' % len(errors), "".join(errors)) |
44 changes: 44 additions & 0 deletions
44
master/buildbot/test/unit/test_steps_package_deb_lintian.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This file is part of Buildbot. Buildbot is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Buildbot Team Members | ||
|
||
from buildbot.status.results import SUCCESS | ||
from buildbot.steps.package.deb import lintian | ||
from buildbot.test.fake.remotecommand import ExpectShell | ||
from buildbot.test.util import steps | ||
from twisted.trial import unittest | ||
from buildbot import config | ||
|
||
class TestDebLintian(steps.BuildStepMixin, unittest.TestCase): | ||
|
||
def setUp(self): | ||
return self.setUpBuildStep() | ||
|
||
def tearDown(self): | ||
return self.tearDownBuildStep() | ||
|
||
def test_no_fileloc(self): | ||
self.assertRaises(config.ConfigErrors, lambda : | ||
lintian.DebLintian()) | ||
|
||
def test_success(self): | ||
self.setupStep(lintian.DebLintian('foo_0.23_i386.changes')) | ||
self.expectCommands( | ||
ExpectShell(workdir='wkdir', usePTY='slave-config', | ||
command=['lintian', '-v', 'foo_0.23_i386.changes']) | ||
+0) | ||
self.expectOutcome(result=SUCCESS, status_text=['Lintian']) | ||
return self.runStep() | ||
|
||
|