* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/
@ 2016-01-21 19:42 Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-01-21 19:42 UTC (permalink / raw
To: gentoo-commits
commit: b7fbf992ef376e29fa26fe763806d7a4fc5a08e9
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: Thu Jan 21 19:28:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7fbf992
repoman: Create 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 | 8 ++++
.../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, 53 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 9747bf0..038cef3 100644
--- a/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/pym/repoman/modules/scan/ebuild/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'multicheck-module': {
+ 'name': "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 b00dbd9..6603bd2 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
@@ -293,7 +289,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])
@@ -322,21 +318,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] 5+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 77ca09470710db8cf98adfd3b2d39c546a03db67
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: Sat Jan 23 01:34:02 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=77ca0947
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 b00dbd9..6603bd2 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
@@ -293,7 +289,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])
@@ -322,21 +318,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] 5+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: d34c38f0f0354f6632616e36f422468341cd1e16
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: Fri Jan 29 04:52:59 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d34c38f0
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] 5+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 7d70b3ebb3a4614e13a7e15a96c6f57100b52cec
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: Sat Jan 30 07:50:20 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d70b3eb
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 dbbbb15..9fe5f26 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
@@ -294,7 +290,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])
@@ -323,21 +319,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] 5+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 581cfe406a41b63098b9d62cfb4aa8e6bd3404db
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: Sat Mar 12 17:57:38 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=581cfe40
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 | 39 ++++++++++++++++++++++
pym/repoman/scanner.py | 21 +-----------
7 files changed, 50 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 7894e2b..8cdc230 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..8b85abf
--- /dev/null
+++ b/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -0,0 +1,39 @@
+
+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 runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 359d9dd..fac2bf6 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
@@ -294,7 +290,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])
@@ -323,21 +319,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] 5+ messages in thread
end of thread, other threads:[~2016-03-12 18:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-30 8:00 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/, pym/repoman/modules/scan/ebuild/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2016-03-12 18:10 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox