commit: 9fedd97887e6af9e54e02ea6ea10d6673a909dde
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 17:36:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 6 04:08:21 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fedd978
repoman: Migrate DescriptionChecks to the plugin system
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++++
.../scan/metadata}/description.py | 20 ++++++++++++++------
pym/repoman/scanner.py | 5 +----
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py
b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'description-metadata': {
+ 'name': "description",
+ 'class': "DescriptionChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/checks/ebuilds/variables/description.py
b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
- def __init__(self, qatracker):
+ def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
- self.qatracker = qatracker
+ self.qatracker = kwargs.get('qatracker')
- def check(self, pkg, ebuild):
+ def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
- self._checkTooLong(pkg, ebuild)
-
- def _checkTooLong(self, pkg, ebuild):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']),
max_desc_len))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.checkTooLong])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f56c5c..295d35e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
@@ -214,7 +213,6 @@ class Scanner(object):
self.modules[mod_class.__name__] =
mod_class(**self.kwargs)
# initialize our checks classes here before the big xpkg loop
- self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist,
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live',
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata',
'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+ ('description', 'DescriptionChecks'),
]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
print("Initializing class name:",
mod_class.__name__)
@@ -330,8 +329,6 @@ class Scanner(object):
print("**** finished plugin loop, continuing...")
- self.descriptioncheck.check(dynamic_data['pkg'],
dynamic_data['ebuild'])
-
self.modules['KeywordChecks'].check(
dynamic_data['pkg'], xpkg,
dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords,
dynamic_data['ebuild'].archs, self.changed,
dynamic_data['live_ebuild'],
self.repo_metadata['kwlist'], self.profiles)