* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/ebuild/, pym/repoman/, pym/repoman/checks/ebuilds/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: f0ce32eac9289bfaca9bc0d9ff8f1eba19a5cdd8
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 04:44:05 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:24 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0ce32ea
repoman: Create a new MultiCheck class plugin
Move ebuilds/ checks.py and errors.py to the scan/ebuild plugin
Remove the checks_init from main(), initialize it in the MultiCheck
class where it is needed.
pym/repoman/checks/ebuilds/__init__.py | 0
pym/repoman/main.py | 2 -
pym/repoman/modules/scan/ebuild/__init__.py | 9 +++++
.../ebuilds => modules/scan/ebuild}/checks.py | 2 +-
.../ebuilds => modules/scan/ebuild}/errors.py | 0
pym/repoman/modules/scan/ebuild/multicheck.py | 43 ++++++++++++++++++++++
pym/repoman/scanner.py | 21 +----------
7 files changed, 54 insertions(+), 23 deletions(-)
diff --git a/pym/repoman/checks/ebuilds/__init__.py b/pym/repoman/checks/ebuilds/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8784685..890e034 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -26,7 +26,6 @@ from portage.util import formatter
from repoman.actions import Actions
from repoman.argparser import parse_args
-from repoman.checks.ebuilds.checks import checks_init
from repoman.qa_data import (
format_qa_output, format_qa_output_column, qahelp,
qawarnings, qacats)
@@ -65,7 +64,6 @@ def repoman_main(argv):
if options.experimental_inherit == 'y':
# This is experimental, so it's non-fatal.
qawarnings.add("inherit.missing")
- checks_init(experimental_inherit=True)
# Set this to False when an extraordinary issue (generally
# something other than a QA issue) makes it impossible to
diff --git a/pym/repoman/modules/scan/ebuild/__init__.py b/pym/repoman/modules/scan/ebuild/__init__.py
index a22e736..e712e4b 100644
--- a/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/pym/repoman/modules/scan/ebuild/__init__.py
@@ -28,6 +28,15 @@ module_spec = {
'func_desc': {
},
},
+ 'multicheck-module': {
+ 'name': "multicheck",
+ 'sourcefile': "multicheck",
+ 'class': "MultiCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_kwargs': {
+ },
+ },
}
}
diff --git a/pym/repoman/checks/ebuilds/checks.py b/pym/repoman/modules/scan/ebuild/checks.py
similarity index 99%
rename from pym/repoman/checks/ebuilds/checks.py
rename to pym/repoman/modules/scan/ebuild/checks.py
index 5420e51..be59b05 100644
--- a/pym/repoman/checks/ebuilds/checks.py
+++ b/pym/repoman/modules/scan/ebuild/checks.py
@@ -21,7 +21,7 @@ from portage.eapi import (
eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
eapi_exports_AA, eapi_has_pkg_pretend)
-import repoman.checks.ebuilds.errors as errors
+from . import errors
class LineCheck(object):
diff --git a/pym/repoman/checks/ebuilds/errors.py b/pym/repoman/modules/scan/ebuild/errors.py
similarity index 100%
rename from pym/repoman/checks/ebuilds/errors.py
rename to pym/repoman/modules/scan/ebuild/errors.py
diff --git a/pym/repoman/modules/scan/ebuild/multicheck.py b/pym/repoman/modules/scan/ebuild/multicheck.py
new file mode 100644
index 0000000..989d695
--- /dev/null
+++ b/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -0,0 +1,43 @@
+
+import io
+
+from portage import _encodings, _unicode_encode
+
+from .checks import run_checks, checks_init
+
+
+class MultiCheck(object):
+ '''Class to run multiple different checks on an ebuild'''
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.options = kwargs.get('options')
+ checks_init(self.options.experimental_inherit == 'y')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ try:
+ # All ebuilds should have utf_8 encoding.
+ f = io.open(
+ _unicode_encode(ebuild.full_path, encoding=_encodings['fs'],
+ errors='strict'),
+ mode='r', encoding=_encodings['repo.content'])
+ try:
+ for check_name, e in run_checks(f, pkg):
+ self.qatracker.add_error(
+ check_name, ebuild.relative_path + ': %s' % e)
+ finally:
+ f.close()
+ except UnicodeDecodeError:
+ # A file.UTF8 failure will have already been recorded.
+ pass
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 683d791..54aeb49 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
from __future__ import print_function, unicode_literals
import copy
-import io
import logging
from itertools import chain
from pprint import pformat
@@ -13,11 +12,8 @@ from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage import _encodings
-from portage import _unicode_encode
from portage.dep import Atom
from portage.output import green
-from repoman.checks.ebuilds.checks import run_checks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -296,7 +292,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
- ('mtime', 'MtimeChecks'),
+ ('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -325,21 +321,6 @@ class Scanner(object):
continue
# Syntax Checks
- try:
- # All ebuilds should have utf_8 encoding.
- f = io.open(
- _unicode_encode(
- dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['repo.content'])
- try:
- for check_name, e in run_checks(f, dynamic_data['pkg']):
- self.qatracker.add_error(
- check_name, dynamic_data['ebuild'].relative_path + ': %s' % e)
- finally:
- f.close()
- except UnicodeDecodeError:
- # A file.UTF8 failure will have already been recorded above.
- pass
if self.options.force:
# The dep_check() calls are the most expensive QA test. If --force
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-27 23:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 23:15 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/ebuild/, pym/repoman/, pym/repoman/checks/ebuilds/ Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox