Commit a6c45fd6 authored by Clément Schreiner's avatar Clément Schreiner
Browse files

Update ubuntuversion to the new API.

parent d59ea249
......@@ -37,13 +37,24 @@ __license__ = 'MIT'
import logging
from debexpo.plugins import BasePlugin
from debexpo.plugins.api import *
from debexpo.lib import constants
log = logging.getLogger(__name__)
class UbuntuVersionPlugin(BasePlugin):
@test_result
class UbuntuVersionTest(PluginResult):
in_ubuntu = bool_field('in_ubuntu')
def __str__(self):
return 'The uploaded package {verb} "ubuntu" in the version'.format(
'has' if self.in_ubuntu else 'does not have')
class UbuntuVersionPlugin(QAPlugin):
@importercmd
def test_ubuntu_version(self):
"""
Checks whether the word "ubuntu" exists in the package name.
......@@ -51,10 +62,13 @@ class UbuntuVersionPlugin(BasePlugin):
log.debug('Checking whether the package version contains the word "ubuntu"')
if 'ubuntu' in self.changes['Version']:
log.error('Package has ubuntu in the version')
self._new_result(Test, in_ubuntu=True,
severity=constants.PLUGIN_SEVERITY_CRITICAL)
else:
log.debug('Package does not have ubuntu in the version')
# This isn't even worth setting an outcome.
else:
log.error('Package has ubuntu in the version')
self.failed('The uploaded package has "ubuntu" in the version', None, constants.PLUGIN_SEVERITY_CRITICAL)
plugin = UbuntuVersionPlugin
models = [UbuntuVersionTest]
template = 'default'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment