[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2018-03-29 Thread Brian Dolbec
commit: e2e41bbd71c024ab34a87d5f6d9edea2e43fc713
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:46 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e2e41bbd

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/, ...

2018-03-29 Thread Brian Dolbec
commit: 287bab160e807b595fd12a606956644d7501ca48
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Aug 16 23:24:24 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:46 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=287bab16

repoman: Initial adding file/module/API version

 repoman/pym/repoman/config.py| 7 +--
 repoman/pym/repoman/main.py  | 3 +++
 repoman/pym/repoman/modules/linechecks/assignment/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/config.py | 2 +-
 repoman/pym/repoman/modules/linechecks/depend/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/deprecated/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/do/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/eapi/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/linechecks/emake/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/helpers/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/nested/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/patches/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/phases/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/portage/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/quotes/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/uri/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/use/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/useless/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/whitespace/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/workaround/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/depend/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/directories/__init__.py | 3 ++-
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/module.py   | 9 ++---
 repoman/pym/repoman/modules/scan/options/__init__.py | 3 ++-
 repoman/pym/repoman/qa_data.py   | 4 ++--
 repoman/pym/repoman/repos.py | 2 +-
 repoman/pym/repoman/scanner.py   | 3 ++-
 35 files changed, 76 insertions(+), 38 deletions(-)

diff --git a/repoman/pym/repoman/config.py b/repoman/pym/repoman/config.py
index 9da30ed9e..0f2358cd9 100644
--- a/repoman/pym/repoman/config.py
+++ b/repoman/pym/repoman/config.py
@@ -144,8 +144,11 @@ def load_config(conf_dirs, file_extensions=None, 
valid_versions=None):
 
if config:
if config['version'] not in valid_versions:
-   raise ConfigError("Invalid file version: %s in: 
%s\nPlease upgrade repoman: current valid versions: %s"
-   % (config['version'], filename, 
valid_versions))
+   raise ConfigError(
+   "Invalid file version: %s in: 
%s\nPlease upgrade to "
+   ">=app-portage/repoman-%s, current 
valid API versions: %s"
+   % (config['version'], filename,
+   config['repoman_version'], 
valid_versions))
result = merge_config(result, config)
 
return result

diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py
index c1e3b99fe..81e2ff61e 100755
--- a/repoman/pym/repoman/main.py
+++ b/repoman/pym/repoman/main.py
@@ -47,10 +47,12 @@ os.umask(0o22)
 LOGLEVEL = logging.WARNING
 portage.util.initialize_logger(LOGLEVEL)
 
+VALID_VERSIONS = [1,]
 
 def repoman_main(argv):
config_root = os.environ.get("PORTAGE_CONFIGROOT")
repoman_settings = portage.config(config_root=config_root, 
local_config=False)
+   repoman_settings.valid_versions = VALID_VERSIONS
 
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
repoman_settings.get('TERM') == 'dumb' or \
@@ -92,6 +94,7 @@ def repoman_main(argv):
config_root, portdir, portdir_overlay,
repoman_settings, vcs_settings, options, qadata)
repoman_settings = repo_settings.repoman_settings
+   

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2018-03-29 Thread Brian Dolbec
commit: d94b56361df9b6ccf27fd325cc50de9a35fac8e8
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Dec  5 19:29:26 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:47 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d94b5636

repoman scan/module.py: fix typo

 repoman/pym/repoman/modules/scan/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index fc0c66ccb..cebc0e708 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -85,7 +85,7 @@ class ModuleConfig(object):
if loop in self.controller.get_spec(mod, 
'module_runsIn'):
mlist.append(mod)
except InvalidModuleName:
-   logging.error("ModuleConfig; unkown module: %s, 
skipping", mod)
+   logging.error("ModuleConfig; unknown module: %s, 
skipping", mod)
 
logging.debug("ModuleConfig; mlist: %s", mlist)
return mlist



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/, repoman/pym/repoman/

2018-03-29 Thread Brian Dolbec
commit: dec86d1bc9b9f200ff95434e03208a9504b20d60
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:09:03 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:46 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dec86d1b

repoman: Convert multicheck module to the new linechecks sub-module

 repoman/pym/repoman/modules/scan/ebuild/__init__.py   |  2 +-
 repoman/pym/repoman/modules/scan/ebuild/multicheck.py | 10 +++---
 repoman/pym/repoman/scanner.py|  1 +
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py 
b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
index 3e1d31951..1d8ec1941 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
@@ -47,7 +47,7 @@ module_spec = {
'functions': ['check'],
'func_kwargs': {
},
-   'mod_kwargs': ['qatracker', 'options'
+   'mod_kwargs': ['qatracker', 'options', 'repo_settings', 
'linechecks',
],
'func_kwargs': {
'ebuild': (None, None),

diff --git a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py 
b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
index 9e36e2a68..94526ae9e 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -8,7 +8,7 @@ import io
 from portage import _encodings, _unicode_encode
 
 from repoman.modules.scan.scanbase import ScanBase
-from .checks import run_checks, checks_init
+from repoman.modules.linechecks.controller import LineCheckController
 
 
 class MultiCheck(ScanBase):
@@ -22,7 +22,11 @@ class MultiCheck(ScanBase):
'''
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
-   checks_init(self.options.experimental_inherit == 'y')
+   self.controller = LineCheckController(
+   kwargs.get('repo_settings'),
+   kwargs.get('linechecks')
+   )
+   self.controller.checks_init(self.options.experimental_inherit 
== 'y')
 
def check(self, **kwargs):
'''Check the ebuild for utf-8 encoding
@@ -40,7 +44,7 @@ class MultiCheck(ScanBase):
errors='strict'),
mode='r', encoding=_encodings['repo.content'])
try:
-   for check_name, e in run_checks(f, pkg):
+   for check_name, e in 
self.controller.run_checks(f, pkg):
self.qatracker.add_error(
check_name, 
ebuild.relative_path + ': %s' % e)
finally:

diff --git a/repoman/pym/repoman/scanner.py b/repoman/pym/repoman/scanner.py
index b3d030570..d61e50131 100644
--- a/repoman/pym/repoman/scanner.py
+++ b/repoman/pym/repoman/scanner.py
@@ -193,6 +193,7 @@ class Scanner(object):
"env": self.env,
"have": self.have,
"dev_keywords": self.dev_keywords,
+   "linechecks": self.moduleconfig.linechecks,
}
# initialize the plugin checks here
self.modules = {}



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2018-03-29 Thread Brian Dolbec
commit: 14f9b7d4d22a223eb54defb29e1fb2adc02fb111
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Dec  5 19:29:26 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 29 21:26:13 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=14f9b7d4

repoman scan/module.py: fix typo

 repoman/pym/repoman/modules/scan/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index fc0c66ccb..cebc0e708 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -85,7 +85,7 @@ class ModuleConfig(object):
if loop in self.controller.get_spec(mod, 
'module_runsIn'):
mlist.append(mod)
except InvalidModuleName:
-   logging.error("ModuleConfig; unkown module: %s, 
skipping", mod)
+   logging.error("ModuleConfig; unknown module: %s, 
skipping", mod)
 
logging.debug("ModuleConfig; mlist: %s", mlist)
return mlist



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2018-03-29 Thread Brian Dolbec
commit: 85df91ccfa0b13ab9ec856b28e92a4c76bcfe08d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 29 20:43:40 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=85df91cc

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/, repoman/pym/repoman/

2018-03-29 Thread Brian Dolbec
commit: cea895f75fe43e61042da591b1e77f9d0ea2c6ae
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:09:03 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 29 20:43:40 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cea895f7

repoman: Convert multicheck module to the new linechecks sub-module

 repoman/pym/repoman/modules/scan/ebuild/__init__.py   |  2 +-
 repoman/pym/repoman/modules/scan/ebuild/multicheck.py | 10 +++---
 repoman/pym/repoman/scanner.py|  1 +
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py 
b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
index 3e1d31951..1d8ec1941 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
@@ -47,7 +47,7 @@ module_spec = {
'functions': ['check'],
'func_kwargs': {
},
-   'mod_kwargs': ['qatracker', 'options'
+   'mod_kwargs': ['qatracker', 'options', 'repo_settings', 
'linechecks',
],
'func_kwargs': {
'ebuild': (None, None),

diff --git a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py 
b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
index 9e36e2a68..94526ae9e 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -8,7 +8,7 @@ import io
 from portage import _encodings, _unicode_encode
 
 from repoman.modules.scan.scanbase import ScanBase
-from .checks import run_checks, checks_init
+from repoman.modules.linechecks.controller import LineCheckController
 
 
 class MultiCheck(ScanBase):
@@ -22,7 +22,11 @@ class MultiCheck(ScanBase):
'''
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
-   checks_init(self.options.experimental_inherit == 'y')
+   self.controller = LineCheckController(
+   kwargs.get('repo_settings'),
+   kwargs.get('linechecks')
+   )
+   self.controller.checks_init(self.options.experimental_inherit 
== 'y')
 
def check(self, **kwargs):
'''Check the ebuild for utf-8 encoding
@@ -40,7 +44,7 @@ class MultiCheck(ScanBase):
errors='strict'),
mode='r', encoding=_encodings['repo.content'])
try:
-   for check_name, e in run_checks(f, pkg):
+   for check_name, e in 
self.controller.run_checks(f, pkg):
self.qatracker.add_error(
check_name, 
ebuild.relative_path + ': %s' % e)
finally:

diff --git a/repoman/pym/repoman/scanner.py b/repoman/pym/repoman/scanner.py
index b3d030570..d61e50131 100644
--- a/repoman/pym/repoman/scanner.py
+++ b/repoman/pym/repoman/scanner.py
@@ -193,6 +193,7 @@ class Scanner(object):
"env": self.env,
"have": self.have,
"dev_keywords": self.dev_keywords,
+   "linechecks": self.moduleconfig.linechecks,
}
# initialize the plugin checks here
self.modules = {}



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-12-05 Thread Brian Dolbec
commit: 6b501c4c9e2fd759d8b4a0b15ff1a47a0d7b0f9d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec  6 00:13:28 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6b501c4c

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-12-05 Thread Brian Dolbec
commit: 43981e36a7f0f49ecd25c89a341ffe69ff4dd09c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Dec  5 19:29:26 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec  6 00:13:29 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=43981e36

repoman scan/module.py: fix typo

 repoman/pym/repoman/modules/scan/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index fc0c66ccb..cebc0e708 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -85,7 +85,7 @@ class ModuleConfig(object):
if loop in self.controller.get_spec(mod, 
'module_runsIn'):
mlist.append(mod)
except InvalidModuleName:
-   logging.error("ModuleConfig; unkown module: %s, 
skipping", mod)
+   logging.error("ModuleConfig; unknown module: %s, 
skipping", mod)
 
logging.debug("ModuleConfig; mlist: %s", mlist)
return mlist



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/keywords/, repoman/pym/repoman/modules/scan/, ...

2017-12-05 Thread Brian Dolbec
commit: 970476a56456e2ac3613a51056b71e581ceba27d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Aug 16 23:24:24 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Dec  5 18:24:49 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=970476a5

repoman: Initial adding file/module/API version

 repoman/pym/repoman/config.py| 7 +--
 repoman/pym/repoman/main.py  | 3 +++
 repoman/pym/repoman/modules/linechecks/assignment/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/config.py | 2 +-
 repoman/pym/repoman/modules/linechecks/depend/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/deprecated/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/do/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/eapi/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/linechecks/emake/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/helpers/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/nested/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/patches/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/phases/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/portage/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/quotes/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/uri/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/use/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/useless/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/whitespace/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/workaround/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/depend/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/directories/__init__.py | 3 ++-
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/module.py   | 9 ++---
 repoman/pym/repoman/modules/scan/options/__init__.py | 3 ++-
 repoman/pym/repoman/qa_data.py   | 4 ++--
 repoman/pym/repoman/repos.py | 2 +-
 repoman/pym/repoman/scanner.py   | 3 ++-
 35 files changed, 76 insertions(+), 38 deletions(-)

diff --git a/repoman/pym/repoman/config.py b/repoman/pym/repoman/config.py
index f98130db3..dbf75237c 100644
--- a/repoman/pym/repoman/config.py
+++ b/repoman/pym/repoman/config.py
@@ -142,8 +142,11 @@ def load_config(conf_dirs, file_extensions=None, 
valid_versions=None):
 
if config:
if config['version'] not in valid_versions:
-   raise ConfigError("Invalid file version: %s in: 
%s\nPlease upgrade repoman: current valid versions: %s"
-   % (config['version'], filename, 
valid_versions))
+   raise ConfigError(
+   "Invalid file version: %s in: 
%s\nPlease upgrade to "
+   ">=app-portage/repoman-%s, current 
valid API versions: %s"
+   % (config['version'], filename,
+   config['repoman_version'], 
valid_versions))
result = merge_config(result, config)
 
return result

diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py
index c1e3b99fe..81e2ff61e 100755
--- a/repoman/pym/repoman/main.py
+++ b/repoman/pym/repoman/main.py
@@ -47,10 +47,12 @@ os.umask(0o22)
 LOGLEVEL = logging.WARNING
 portage.util.initialize_logger(LOGLEVEL)
 
+VALID_VERSIONS = [1,]
 
 def repoman_main(argv):
config_root = os.environ.get("PORTAGE_CONFIGROOT")
repoman_settings = portage.config(config_root=config_root, 
local_config=False)
+   repoman_settings.valid_versions = VALID_VERSIONS
 
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
repoman_settings.get('TERM') == 'dumb' or \
@@ -92,6 +94,7 @@ def repoman_main(argv):
config_root, portdir, portdir_overlay,
repoman_settings, vcs_settings, options, qadata)
repoman_settings = repo_settings.repoman_settings
+   

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-12-05 Thread Brian Dolbec
commit: dbae0587378b86266955f16849280d4674590063
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Dec  5 18:24:49 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dbae0587

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-11-26 Thread Brian Dolbec
commit: c6c72edf59e98cac6d5d51d3b7348b29c1f4057c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Nov 26 17:32:20 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c6c72edf

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-09-11 Thread Brian Dolbec
commit: f68c6bb2e4239e9fb041c2eb6c133fd7ab2ccd3e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 11 16:13:17 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f68c6bb2

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/, ...

2017-09-11 Thread Brian Dolbec
commit: e04fdbf1448a2353d1c20f26ab6039b0449aac7f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Aug 16 23:24:24 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 11 16:13:17 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e04fdbf1

repoman: Initial adding file/module/API version

 repoman/pym/repoman/config.py| 7 +--
 repoman/pym/repoman/main.py  | 3 +++
 repoman/pym/repoman/modules/linechecks/assignment/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/config.py | 2 +-
 repoman/pym/repoman/modules/linechecks/depend/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/deprecated/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/do/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/eapi/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/linechecks/emake/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/helpers/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/nested/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/patches/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/phases/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/portage/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/quotes/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/uri/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/use/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/useless/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/whitespace/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/workaround/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/depend/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/directories/__init__.py | 3 ++-
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/module.py   | 9 ++---
 repoman/pym/repoman/modules/scan/options/__init__.py | 3 ++-
 repoman/pym/repoman/qa_data.py   | 4 ++--
 repoman/pym/repoman/repos.py | 2 +-
 repoman/pym/repoman/scanner.py   | 3 ++-
 35 files changed, 76 insertions(+), 38 deletions(-)

diff --git a/repoman/pym/repoman/config.py b/repoman/pym/repoman/config.py
index f98130db3..dbf75237c 100644
--- a/repoman/pym/repoman/config.py
+++ b/repoman/pym/repoman/config.py
@@ -142,8 +142,11 @@ def load_config(conf_dirs, file_extensions=None, 
valid_versions=None):
 
if config:
if config['version'] not in valid_versions:
-   raise ConfigError("Invalid file version: %s in: 
%s\nPlease upgrade repoman: current valid versions: %s"
-   % (config['version'], filename, 
valid_versions))
+   raise ConfigError(
+   "Invalid file version: %s in: 
%s\nPlease upgrade to "
+   ">=app-portage/repoman-%s, current 
valid API versions: %s"
+   % (config['version'], filename,
+   config['repoman_version'], 
valid_versions))
result = merge_config(result, config)
 
return result

diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py
index c1e3b99fe..81e2ff61e 100755
--- a/repoman/pym/repoman/main.py
+++ b/repoman/pym/repoman/main.py
@@ -47,10 +47,12 @@ os.umask(0o22)
 LOGLEVEL = logging.WARNING
 portage.util.initialize_logger(LOGLEVEL)
 
+VALID_VERSIONS = [1,]
 
 def repoman_main(argv):
config_root = os.environ.get("PORTAGE_CONFIGROOT")
repoman_settings = portage.config(config_root=config_root, 
local_config=False)
+   repoman_settings.valid_versions = VALID_VERSIONS
 
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
repoman_settings.get('TERM') == 'dumb' or \
@@ -92,6 +94,7 @@ def repoman_main(argv):
config_root, portdir, portdir_overlay,
repoman_settings, vcs_settings, options, qadata)
repoman_settings = repo_settings.repoman_settings
+   

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-08-16 Thread Brian Dolbec
commit: a32f7ffe03fa30f1965627cb950a3db96e115801
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Aug 17 01:54:27 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Aug 17 01:57:47 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a32f7ffe

repoman: Add scan module API compatibility version checking

 repoman/pym/repoman/modules/scan/module.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index fc0c66ccb..ac9594a86 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -16,6 +16,7 @@ MODULES_PATH = os.path.dirname(__file__)
 # initial development debug info
 logging.debug("module path: %s", MODULES_PATH)
 
+MODULE_VERSIONS = [1,]
 
 class ModuleConfig(object):
'''Holds the scan modules configuration information and
@@ -29,7 +30,10 @@ class ModuleConfig(object):
self.configpaths = [os.path.join(path, 'repository.yaml') for 
path in configpaths]
logging.debug("ModuleConfig; configpaths: %s", self.configpaths)
 
-   self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
+   self.controller = Modules(path=MODULES_PATH,
+   
namepath="repoman.modules.scan",
+   
compat_versions=MODULE_VERSIONS
+   )
logging.debug("ModuleConfig; module_names: %s", 
self.controller.module_names)
 
self._configs = None



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-07-14 Thread Brian Dolbec
commit: 18a8f9d992bb108e4456d7797f2872884e3dc160
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 00:04:32 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:25:43 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=18a8f9d9

repoman: Move errors data to repo metadata/repoman/linechecks.yaml

 repoman/pym/repoman/modules/scan/ebuild/errors.py | 53 ---
 1 file changed, 53 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/errors.py 
b/repoman/pym/repoman/modules/scan/ebuild/errors.py
deleted file mode 100644
index 22547f4d5..0
--- a/repoman/pym/repoman/modules/scan/ebuild/errors.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Error Messages
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import unicode_literals
-
-COPYRIGHT_ERROR = (
-   'Invalid Gentoo Copyright on line: %d')
-LICENSE_ERROR = (
-   'Invalid Gentoo/GPL License on line: %d')
-ID_HEADER_ERROR = (
-   'Stale CVS header on line: %d')
-NO_BLANK_LINE_ERROR = (
-   'Non-blank line after header on line: %d')
-LEADING_SPACES_ERROR = (
-   'Ebuild contains leading spaces on line: %d')
-TRAILING_WHITESPACE_ERROR = (
-   'Trailing whitespace error on line: %d')
-READONLY_ASSIGNMENT_ERROR = (
-   'Ebuild contains assignment to read-only variable on line: %d')
-MISSING_QUOTES_ERROR = (
-   'Unquoted Variable on line: %d')
-NESTED_DIE_ERROR = (
-   'Ebuild calls die in a subshell on line: %d')
-PATCHES_ERROR = (
-   'PATCHES is not a bash array on line: %d')
-REDUNDANT_CD_S_ERROR = (
-   'Ebuild has redundant cd ${S} statement on line: %d')
-EMAKE_PARALLEL_DISABLED = (
-   'Upstream parallel compilation bug (ebuild calls emake -j1 on line: 
%d)')
-EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS = (
-   'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)')
-DEPRECATED_BINDNOW_FLAGS = (
-   'Deprecated bindnow-flags call on line: %d')
-EAPI_DEFINED_AFTER_INHERIT = (
-   'EAPI defined after inherit on line: %d')
-NO_AS_NEEDED = (
-   'Upstream asneeded linking bug (no-as-needed on line: %d)')
-PRESERVE_OLD_LIB = (
-   'Ebuild calls deprecated preserve_old_lib on line: %d')
-BUILT_WITH_USE = (
-   'built_with_use on line: %d')
-NO_OFFSET_WITH_HELPERS = (
-   "Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line 
:%d")
-SANDBOX_ADDPREDICT = (
-   'Ebuild calls addpredict on line: %d')
-USEQ_ERROR = (
-   'Ebuild calls deprecated useq function on line: %d')
-HASQ_ERROR = (
-   'Ebuild calls deprecated hasq function on line: %d')
-URI_HTTPS = (
-   'Ebuild uses http:// but should use https:// on line: %d')



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-07-14 Thread Brian Dolbec
commit: 5c167468437229a68d6d5fc84dd5e9f9dc2c9c1c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:28:03 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c167468

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1044 -
 1 file changed, 1044 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index de03bedd2..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-07-14 Thread Brian Dolbec
commit: ad4dedb929b147b19b55e0831d3ff52ce0d6f17d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 00:11:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:25:44 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad4dedb9

repoman: Update modules/scan/module.py for linechecks config addition

 repoman/pym/repoman/modules/scan/module.py | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index 57ba274a1..ba720386c 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -25,7 +25,7 @@ class ModuleConfig(object):
 
@param configpaths: ordered list of filepaths to load
'''
-   self.configpaths = [os.path.join(path, 'repository.yml') for 
path in configpaths]
+   self.configpaths = [os.path.join(path, 'repository.yaml') for 
path in configpaths]
logging.debug("ModuleConfig; configpaths: %s", self.configpaths)
 
self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
@@ -41,13 +41,17 @@ class ModuleConfig(object):
for loop in ['pkgs', 'ebuilds', 'final']:
logging.debug("ModuleConfig; Processing loop %s", loop)
setattr(self, '%s_loop' % loop, 
self._determine_list(loop))
+   self.linechecks = stack_lists(c['linechecks_modules'].split() 
for c in self._configs)
 
def load_configs(self, configpaths=None):
-   '''load the config files in order'''
+   '''load the config files in order
+
+   @param configpaths: ordered list of filepaths to load
+   '''
if configpaths:
self.configpaths = configpaths
elif not self.configpaths:
-   logging.error("ModuleConfig; Error: No repository.yml 
files defined")
+   logging.error("ModuleConfig; Error: No repository.yaml 
files defined")
configs = []
for path in self.configpaths:
logging.debug("ModuleConfig; Processing: %s", path)



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/, repoman/pym/repoman/

2017-07-14 Thread Brian Dolbec
commit: 720c6dc38b69e10477bd4bd8c08d85291e811432
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:09:03 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:25:45 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=720c6dc3

repoman: Convert multicheck module to the new linechecks sub-module

 repoman/pym/repoman/modules/scan/ebuild/__init__.py   |  2 +-
 repoman/pym/repoman/modules/scan/ebuild/multicheck.py | 10 +++---
 repoman/pym/repoman/scanner.py|  1 +
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py 
b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
index 3e1d31951..1d8ec1941 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
@@ -47,7 +47,7 @@ module_spec = {
'functions': ['check'],
'func_kwargs': {
},
-   'mod_kwargs': ['qatracker', 'options'
+   'mod_kwargs': ['qatracker', 'options', 'repo_settings', 
'linechecks',
],
'func_kwargs': {
'ebuild': (None, None),

diff --git a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py 
b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
index 9e36e2a68..94526ae9e 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -8,7 +8,7 @@ import io
 from portage import _encodings, _unicode_encode
 
 from repoman.modules.scan.scanbase import ScanBase
-from .checks import run_checks, checks_init
+from repoman.modules.linechecks.controller import LineCheckController
 
 
 class MultiCheck(ScanBase):
@@ -22,7 +22,11 @@ class MultiCheck(ScanBase):
'''
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
-   checks_init(self.options.experimental_inherit == 'y')
+   self.controller = LineCheckController(
+   kwargs.get('repo_settings'),
+   kwargs.get('linechecks')
+   )
+   self.controller.checks_init(self.options.experimental_inherit 
== 'y')
 
def check(self, **kwargs):
'''Check the ebuild for utf-8 encoding
@@ -40,7 +44,7 @@ class MultiCheck(ScanBase):
errors='strict'),
mode='r', encoding=_encodings['repo.content'])
try:
-   for check_name, e in run_checks(f, pkg):
+   for check_name, e in 
self.controller.run_checks(f, pkg):
self.qatracker.add_error(
check_name, 
ebuild.relative_path + ': %s' % e)
finally:

diff --git a/repoman/pym/repoman/scanner.py b/repoman/pym/repoman/scanner.py
index b3d030570..d61e50131 100644
--- a/repoman/pym/repoman/scanner.py
+++ b/repoman/pym/repoman/scanner.py
@@ -193,6 +193,7 @@ class Scanner(object):
"env": self.env,
"have": self.have,
"dev_keywords": self.dev_keywords,
+   "linechecks": self.moduleconfig.linechecks,
}
# initialize the plugin checks here
self.modules = {}



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-07-14 Thread Brian Dolbec
commit: f256db51d9b260223b2bfb2c542826cff2b4ffb9
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:10:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:08:28 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f256db51

repoman: Remove the no longer used modules/scan/ebuild/checks.py

 repoman/pym/repoman/modules/scan/ebuild/checks.py | 1039 -
 1 file changed, 1039 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py 
b/repoman/pym/repoman/modules/scan/ebuild/checks.py
deleted file mode 100644
index e6e5d78ba..0
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ /dev/null
@@ -1,1039 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Checks
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""This module contains functions used in Repoman to ascertain the quality
-and correctness of an ebuild."""
-
-from __future__ import unicode_literals
-
-from itertools import chain
-import operator
-import re
-import time
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage.eapi import (
-   eapi_supports_prefix, eapi_has_implicit_rdepend,
-   eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
-   eapi_exports_AA, eapi_has_pkg_pretend)
-
-from . import errors
-
-
-class LineCheck(object):
-   """Run a check on a line of an ebuild."""
-   """A regular expression to determine whether to ignore the line"""
-   ignore_line = False
-   """True if lines containing nothing more than comments with optional
-   leading whitespace should be ignored"""
-   ignore_comment = True
-
-   def new(self, pkg):
-   pass
-
-   def check_eapi(self, eapi):
-   """Returns if check should be run in the given EAPI (default: 
True)"""
-   return True
-
-   def check(self, num, line):
-   """Run the check on line and return error if there is one"""
-   if self.re.match(line):
-   return self.error
-
-   def end(self):
-   pass
-
-
-class PhaseCheck(LineCheck):
-   """ basic class for function detection """
-
-   func_end_re = re.compile(r'^\}$')
-   phases_re = re.compile('(%s)' % '|'.join((
-   'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-   'src_configure', 'src_compile', 'src_test', 'src_install',
-   'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
-   'pkg_config')))
-   in_phase = ''
-
-   def check(self, num, line):
-   m = self.phases_re.match(line)
-   if m is not None:
-   self.in_phase = m.group(1)
-   if self.in_phase != '' and self.func_end_re.match(line) is not 
None:
-   self.in_phase = ''
-
-   return self.phase_check(num, line)
-
-   def phase_check(self, num, line):
-   """ override this function for your checks """
-   pass
-
-
-class EbuildHeader(LineCheck):
-   """Ensure ebuilds have proper headers
-   Copyright header errors
-   CVS header errors
-   License header errors
-
-   Args:
-   modification_year - Year the ebuild was last modified
-   """
-
-   repoman_check_name = 'ebuild.badheader'
-
-   gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo 
Foundation$'
-   gentoo_license = (
-   '# Distributed under the terms'
-   ' of the GNU General Public License v2')
-   id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
-   blank_line_re = re.compile(r'^$')
-   ignore_comment = False
-
-   def new(self, pkg):
-   if pkg.mtime is None:
-   self.modification_year = r'2\d\d\d'
-   else:
-   self.modification_year = str(time.gmtime(pkg.mtime)[0])
-   self.gentoo_copyright_re = re.compile(
-   self.gentoo_copyright % self.modification_year)
-
-   def check(self, num, line):
-   if num > 2:
-   return
-   elif num == 0:
-   if not self.gentoo_copyright_re.match(line):
-   return errors.COPYRIGHT_ERROR
-   elif num == 1 and line.rstrip('\n') != self.gentoo_license:
-   return errors.LICENSE_ERROR
-   elif num == 2 and self.id_header_re.match(line):
-   return errors.ID_HEADER_ERROR
-   elif num == 2 and not self.blank_line_re.match(line):
-   return errors.NO_BLANK_LINE_ERROR
-
-
-class EbuildWhitespace(LineCheck):
-   """Ensure ebuilds have proper whitespacing"""
-
-   repoman_check_name = 'ebuild.minorsyn'
-
-   ignore_line 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-07-14 Thread Brian Dolbec
commit: 025a6565e69685bf6420246d52b402a6d62ccac1
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 00:11:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:08:27 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=025a6565

repoman: Update modules/scan/module.py for linechecks config addition

 repoman/pym/repoman/modules/scan/module.py | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index 57ba274a1..ba720386c 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -25,7 +25,7 @@ class ModuleConfig(object):
 
@param configpaths: ordered list of filepaths to load
'''
-   self.configpaths = [os.path.join(path, 'repository.yml') for 
path in configpaths]
+   self.configpaths = [os.path.join(path, 'repository.yaml') for 
path in configpaths]
logging.debug("ModuleConfig; configpaths: %s", self.configpaths)
 
self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
@@ -41,13 +41,17 @@ class ModuleConfig(object):
for loop in ['pkgs', 'ebuilds', 'final']:
logging.debug("ModuleConfig; Processing loop %s", loop)
setattr(self, '%s_loop' % loop, 
self._determine_list(loop))
+   self.linechecks = stack_lists(c['linechecks_modules'].split() 
for c in self._configs)
 
def load_configs(self, configpaths=None):
-   '''load the config files in order'''
+   '''load the config files in order
+
+   @param configpaths: ordered list of filepaths to load
+   '''
if configpaths:
self.configpaths = configpaths
elif not self.configpaths:
-   logging.error("ModuleConfig; Error: No repository.yml 
files defined")
+   logging.error("ModuleConfig; Error: No repository.yaml 
files defined")
configs = []
for path in self.configpaths:
logging.debug("ModuleConfig; Processing: %s", path)



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/

2017-07-14 Thread Brian Dolbec
commit: bddc8dfbb5103d1ea6cb25a97127480ca9daba34
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 00:04:32 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:08:27 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bddc8dfb

repoman: Move errors data to repo metadata/repoman/linechecks.yaml

 repoman/pym/repoman/modules/scan/ebuild/errors.py | 53 ---
 1 file changed, 53 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/ebuild/errors.py 
b/repoman/pym/repoman/modules/scan/ebuild/errors.py
deleted file mode 100644
index 22547f4d5..0
--- a/repoman/pym/repoman/modules/scan/ebuild/errors.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding:utf-8 -*-
-# repoman: Error Messages
-# Copyright 2007-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import unicode_literals
-
-COPYRIGHT_ERROR = (
-   'Invalid Gentoo Copyright on line: %d')
-LICENSE_ERROR = (
-   'Invalid Gentoo/GPL License on line: %d')
-ID_HEADER_ERROR = (
-   'Stale CVS header on line: %d')
-NO_BLANK_LINE_ERROR = (
-   'Non-blank line after header on line: %d')
-LEADING_SPACES_ERROR = (
-   'Ebuild contains leading spaces on line: %d')
-TRAILING_WHITESPACE_ERROR = (
-   'Trailing whitespace error on line: %d')
-READONLY_ASSIGNMENT_ERROR = (
-   'Ebuild contains assignment to read-only variable on line: %d')
-MISSING_QUOTES_ERROR = (
-   'Unquoted Variable on line: %d')
-NESTED_DIE_ERROR = (
-   'Ebuild calls die in a subshell on line: %d')
-PATCHES_ERROR = (
-   'PATCHES is not a bash array on line: %d')
-REDUNDANT_CD_S_ERROR = (
-   'Ebuild has redundant cd ${S} statement on line: %d')
-EMAKE_PARALLEL_DISABLED = (
-   'Upstream parallel compilation bug (ebuild calls emake -j1 on line: 
%d)')
-EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS = (
-   'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)')
-DEPRECATED_BINDNOW_FLAGS = (
-   'Deprecated bindnow-flags call on line: %d')
-EAPI_DEFINED_AFTER_INHERIT = (
-   'EAPI defined after inherit on line: %d')
-NO_AS_NEEDED = (
-   'Upstream asneeded linking bug (no-as-needed on line: %d)')
-PRESERVE_OLD_LIB = (
-   'Ebuild calls deprecated preserve_old_lib on line: %d')
-BUILT_WITH_USE = (
-   'built_with_use on line: %d')
-NO_OFFSET_WITH_HELPERS = (
-   "Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line 
:%d")
-SANDBOX_ADDPREDICT = (
-   'Ebuild calls addpredict on line: %d')
-USEQ_ERROR = (
-   'Ebuild calls deprecated useq function on line: %d')
-HASQ_ERROR = (
-   'Ebuild calls deprecated hasq function on line: %d')
-URI_HTTPS = (
-   'Ebuild uses http:// but should use https:// on line: %d')



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-07-10 Thread Brian Dolbec
commit: e06ba56d52350fc043459f56a62ce6434ce7b387
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 21:42:30 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 23:00:50 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e06ba56d

repoman: modules/scan/module.py: Prefix logging messages

Signed-off-by: Brian Dolbec  gentoo.org>

 repoman/pym/repoman/modules/scan/module.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index 8119bcec3..9b6222a6f 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -25,10 +25,11 @@ class ModuleConfig(object):
 
@param configpaths: ordered list of filepaths to load
'''
-   self.configpaths = configpaths
+   self.configpaths = [os.path.join(path, 'repository.yml') for 
path in configpaths]
+   logging.debug("ModuleConfig; configpaths: %s", self.configpaths)
 
self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
-   logging.debug("module_names: %s", self.controller.module_names)
+   logging.debug("ModuleConfig; module_names: %s", 
self.controller.module_names)
 
self._configs = None
self.enabled = []
@@ -41,7 +42,6 @@ class ModuleConfig(object):
logging.debug("ModuleConfig; Processing loop %s", loop)
setattr(self, '%s_loop' % loop, 
self._determine_list(loop))
 
-
def load_configs(self, configpaths=None):
'''load the config files in order'''
if configpaths:



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/

2017-07-10 Thread Brian Dolbec
commit: 19eb56c8a696d9b41b7a93bc4483d0e324eb8756
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 21:36:17 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 23:00:49 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=19eb56c8

repoman: modules/scan/metadata: Add missed mod_kwargs 'repo_settings'

Signed-off-by: Brian Dolbec  gentoo.org>

 repoman/pym/repoman/modules/scan/metadata/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/metadata/__init__.py 
b/repoman/pym/repoman/modules/scan/metadata/__init__.py
index 03548d164..2d111b4e0 100644
--- a/repoman/pym/repoman/modules/scan/metadata/__init__.py
+++ b/repoman/pym/repoman/modules/scan/metadata/__init__.py
@@ -75,7 +75,7 @@ module_spec = {
'functions': ['check'],
'func_desc': {
},
-   'mod_kwargs': ['qatracker',
+   'mod_kwargs': ['qatracker', 'repo_settings'
],
'func_kwargs': {
'ebuild': (None, None),



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/eclasses/, ...

2017-07-10 Thread Brian Dolbec
commit: 717d7a182820917e07c7fabf69aa3edcb8f55848
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 17:35:08 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:33 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=717d7a18

repoman: modules/scan/*: Add module_runsIn spec variable

This variable will be used to help determine which process loops
to run the modules in.  This is summary data taken from the runIn*()'s
defined in the target eclasses containing the checks.

 repoman/pym/repoman/modules/scan/depend/__init__.py  | 1 +
 repoman/pym/repoman/modules/scan/directories/__init__.py | 2 ++
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 2 ++
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 ++
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 1 +
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 
 repoman/pym/repoman/modules/scan/options/__init__.py | 1 +
 10 files changed, 16 insertions(+)

diff --git a/repoman/pym/repoman/modules/scan/depend/__init__.py 
b/repoman/pym/repoman/modules/scan/depend/__init__.py
index 6d1228601..bd6905c0b 100644
--- a/repoman/pym/repoman/modules/scan/depend/__init__.py
+++ b/repoman/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/directories/__init__.py 
b/repoman/pym/repoman/modules/scan/directories/__init__.py
index 47834cb40..18ca086ce 100644
--- a/repoman/pym/repoman/modules/scan/directories/__init__.py
+++ b/repoman/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'checkdirlist': (None, None),
'checkdir_relative': (None, None),
},
+   'module_runsIn': ['pkgs'],
},
'mtime-module': {
'name': "mtime",
@@ -42,6 +43,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/eapi/__init__.py 
b/repoman/pym/repoman/modules/scan/eapi/__init__.py
index 4c3dd6e8f..f6306b3e1 100644
--- a/repoman/pym/repoman/modules/scan/eapi/__init__.py
+++ b/repoman/pym/repoman/modules/scan/eapi/__init__.py
@@ -23,6 +23,7 @@ module_spec = {
'func_kwargs': {
'ebuild': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py 
b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
index 8666e78c2..3e1d31951 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
@@ -37,6 +37,7 @@ module_spec = {
'xpkg': (None, None),
'y_ebuild': (None, None),
},
+   'module_runsIn': ['pkgs', 'ebuilds'],
},
'multicheck-module': {
'name': "multicheck",
@@ -52,6 +53,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/eclasses/__init__.py 
b/repoman/pym/repoman/modules/scan/eclasses/__init__.py
index 01bd29adf..9b1f203ce 100644
--- a/repoman/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/repoman/pym/repoman/modules/scan/eclasses/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'xpkg': (None, None),
'y_ebuild': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
'ruby-module': {
'name': "ruby",
@@ -41,6 +42,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/fetch/__init__.py 
b/repoman/pym/repoman/modules/scan/fetch/__init__.py
index 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/, repoman/pym/repoman/

2017-07-10 Thread Brian Dolbec
commit: fd99fc9fb0e348b7151f867da8b2dcb2b305f173
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 17:39:04 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:33 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fd99fc9f

repoman: Create a new ModuleConfig class

This class will load the module configuration data from the target repo.
Move the Modules class handling code to this new class.
Update scanner.py to use the new ModuleConfig class for Modules class
calls.
Move the hard-coded loop lists to use the ModuleConfig instance
configure/dynamically determined lists.

TODO: add masters inheritance config stacking.

 repoman/pym/repoman/modules/scan/module.py | 84 ++
 repoman/pym/repoman/scanner.py | 83 -
 2 files changed, 118 insertions(+), 49 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
new file mode 100644
index 0..f7f135f73
--- /dev/null
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -0,0 +1,84 @@
+
+'''
+moudules/scan/module.py
+Module loading and run list generator
+'''
+
+import logging
+import os
+import yaml
+
+from portage.module import InvalidModuleName, Modules
+from portage.util import stack_lists
+
+MODULES_PATH = os.path.dirname(__file__)
+# initial development debug info
+logging.debug("module path: %s", MODULES_PATH)
+
+
+class ModuleConfig(object):
+   '''Holds the scan modules configuration information and
+   creates the ordered list of modulles to run'''
+
+   def __init__(self, configpaths):
+   '''Module init
+
+   @param configpaths: ordered list of filepaths to load
+   '''
+   self.configpaths = configpaths
+
+   self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
+   logging.debug("module_names: %s", self.controller.module_names)
+
+   self._configs = None
+   self.enabled = []
+   self.pkgs_loop = []
+   self.ebuilds_loop = []
+   self.final_loop = []
+   self.modules_forced = ['ebuild', 'mtime']
+   self.load_configs()
+   for loop in ['pkgs', 'ebuilds', 'final']:
+   logging.debug("ModuleConfig; Processing loop %s", loop)
+   setattr(self, '%s_loop' % loop, 
self._determine_list(loop))
+
+
+   def load_configs(self, configpaths=None):
+   '''load the config files in order'''
+   if configpaths:
+   self.configpaths = configpaths
+   elif not self.configpaths:
+   logging.error("ModuleConfig; Error: No repository.yml 
files defined")
+   configs = []
+   for path in self.configpaths:
+   logging.debug("ModuleConfig; Processing: %s", path)
+   if os.path.exists(path):
+   try:
+   with open(path, 'r') as inputfile:
+   
configs.append(yaml.safe_load(inputfile.read()))
+   except IOError as error:
+   logging,error("Failed to load file: 
%s", inputfile)
+   logging.exception(error)
+   logging.debug("ModuleConfig; completed : %s", path)
+   logging.debug("ModuleConfig; new _configs: %s", configs)
+   self._configs = configs
+
+   def _determine_list(self, loop):
+   '''Determine the ordered list from the config data and
+   the moule_runsIn value in the module_spec
+
+   @returns: list of modules
+   '''
+   lists = [c['modules'] for c in self._configs]
+   stacked = self.modules_forced + stack_lists(lists)
+   mlist = []
+   try:
+   for mod in stacked:
+   logging.debug("ModuleConfig; checking loop %s, 
module: %s, in: %s",
+   loop, mod, 
self.controller.get_spec(mod, 'module_runsIn'))
+   if loop in self.controller.get_spec(mod, 
'module_runsIn'):
+   mlist.append(mod)
+   except InvalidModuleName:
+   logging.error("ModuleConfig; unkown module: %s, 
skipping", mod)
+
+   logging.debug("ModuleConfig; mlist: %s", mlist)
+   return mlist

diff --git a/repoman/pym/repoman/scanner.py b/repoman/pym/repoman/scanner.py
index e13d4f68b..ffce701be 100644
--- a/repoman/pym/repoman/scanner.py
+++ b/repoman/pym/repoman/scanner.py
@@ -15,20 +15,10 @@ from repoman.modules.commit import repochecks
 from repoman.modules.commit import manifest
 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/

2017-07-10 Thread Brian Dolbec
commit: e6b7d178043426edeb277b8b391d1b50b4c59b84
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 21:36:17 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:34 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e6b7d178

repoman: modules/scan/metadata: Add missed mod_kwargs 'repo_settings'

Signed-off-by: Brian Dolbec  gentoo.org>

 repoman/pym/repoman/modules/scan/metadata/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/modules/scan/metadata/__init__.py 
b/repoman/pym/repoman/modules/scan/metadata/__init__.py
index 03548d164..2d111b4e0 100644
--- a/repoman/pym/repoman/modules/scan/metadata/__init__.py
+++ b/repoman/pym/repoman/modules/scan/metadata/__init__.py
@@ -75,7 +75,7 @@ module_spec = {
'functions': ['check'],
'func_desc': {
},
-   'mod_kwargs': ['qatracker',
+   'mod_kwargs': ['qatracker', 'repo_settings'
],
'func_kwargs': {
'ebuild': (None, None),



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/

2017-07-10 Thread Brian Dolbec
commit: 4f73aebefe23704e5758f08f8be3ae130015f271
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 21:42:30 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:34 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4f73aebe

repoman: modules/scan/module.py: Prefix logging messages

Signed-off-by: Brian Dolbec  gentoo.org>

 repoman/pym/repoman/modules/scan/module.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/module.py 
b/repoman/pym/repoman/modules/scan/module.py
index f7f135f73..5424fab65 100644
--- a/repoman/pym/repoman/modules/scan/module.py
+++ b/repoman/pym/repoman/modules/scan/module.py
@@ -25,10 +25,11 @@ class ModuleConfig(object):
 
@param configpaths: ordered list of filepaths to load
'''
-   self.configpaths = configpaths
+   self.configpaths = [os.path.join(path, 'repository.yml') for 
path in configpaths]
+   logging.debug("ModuleConfig; configpaths: %s", self.configpaths)
 
self.controller = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
-   logging.debug("module_names: %s", self.controller.module_names)
+   logging.debug("ModuleConfig; module_names: %s", 
self.controller.module_names)
 
self._configs = None
self.enabled = []
@@ -41,7 +42,6 @@ class ModuleConfig(object):
logging.debug("ModuleConfig; Processing loop %s", loop)
setattr(self, '%s_loop' % loop, 
self._determine_list(loop))
 
-
def load_configs(self, configpaths=None):
'''load the config files in order'''
if configpaths:



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/, ...

2017-07-10 Thread Brian Dolbec
commit: 6848f27e23b74625d5473c183dda226186e695a6
Author: Brian Dolbec  gaikai  com>
AuthorDate: Tue Jun 27 17:56:09 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 22:29:33 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6848f27e

repoman: Update modules for the new QAData class

Rather than direct import, now the QAData instance is accessed via
repo_settings.  Add repo_settings need to all modules requiring QAData
access.

 repoman/pym/repoman/modules/scan/depend/_depend_checks.py| 9 -
 repoman/pym/repoman/modules/scan/depend/profile.py   | 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/ebuild.py| 5 +++--
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 +-
 repoman/pym/repoman/modules/scan/eclasses/ruby.py| 5 +++--
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 ++--
 repoman/pym/repoman/modules/scan/metadata/description.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/ebuild_metadata.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/restrict.py| 4 ++--
 9 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py 
b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 11435f99e..cffacc55e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -9,7 +9,6 @@ from portage.dep import Atom
 from repoman.check_missingslot import check_missingslot
 # import our initialized portage instance
 from repoman._portage import portage
-from repoman.qa_data import suspect_virtual, suspect_rdepend
 
 def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
qatracker, relative_path):
@@ -51,7 +50,7 @@ def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
_traverse_tree(branch, 
in_any_of=in_any_of)
_traverse_tree(my_dep_tree, False)
 
-def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
'''Checks the ebuild dependencies for errors
 
@param pkg: Package in which we check (object).
@@ -111,11 +110,11 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
 
if pkg.category != "virtual":
if not is_blocker and \
-   atom.cp in suspect_virtual:
+   atom.cp in 
qadata.suspect_virtual:
qatracker.add_error(
'virtual.suspect', 
ebuild.relative_path +
": %s: consider using 
'%s' instead of '%s'" %
-   (mytype, 
suspect_virtual[atom.cp], atom))
+   (mytype, 
qadata.suspect_virtual[atom.cp], atom))
if not is_blocker and \

atom.cp.startswith("perl-core/"):

qatracker.add_error('dependency.perlcore',
@@ -141,7 +140,7 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
" wxwidgets.eclass" % 
(ebuild.relative_path, mytype))
elif runtime:
if not is_blocker and \
-   atom.cp in suspect_rdepend:
+   atom.cp in 
qadata.suspect_rdepend:
qatracker.add_error(
mytype + '.suspect',
ebuild.relative_path + 
": '%s'" % atom)

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py 
b/repoman/pym/repoman/modules/scan/depend/profile.py
index cf3d9a8f4..1adda44bb 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -63,7 +63,8 @@ class ProfileDependsChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
pkg = kwargs.get('pkg').get()
unknown_pkgs, baddepsyntax = _depend_checks(
-   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata)
+   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata,
+   self.repo_settings.qadata)
 
relevant_profiles = []
for keyword, arch, groups in _gen_arches(ebuild, self.options,

diff --git a/repoman/pym/repoman/modules/scan/ebuild/ebuild.py 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/ebuild/, ...

2017-07-10 Thread Brian Dolbec
commit: 0f7614d8152d8f1b30862d847afbac1ee4bd7de0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jul 10 17:35:08 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 17:50:19 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0f7614d8

repoman: modules/scan/*: Add module_runsIn spec variable

This variable will be used to help determine which process loops
to run the modules in.  This is summary data taken from the runIn*()'s
defined in the target eclasses containing the checks.

 repoman/pym/repoman/modules/scan/depend/__init__.py  | 1 +
 repoman/pym/repoman/modules/scan/directories/__init__.py | 2 ++
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 2 ++
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 ++
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 1 +
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 1 +
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 
 repoman/pym/repoman/modules/scan/options/__init__.py | 1 +
 10 files changed, 16 insertions(+)

diff --git a/repoman/pym/repoman/modules/scan/depend/__init__.py 
b/repoman/pym/repoman/modules/scan/depend/__init__.py
index 6d1228601..bd6905c0b 100644
--- a/repoman/pym/repoman/modules/scan/depend/__init__.py
+++ b/repoman/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/directories/__init__.py 
b/repoman/pym/repoman/modules/scan/directories/__init__.py
index 47834cb40..18ca086ce 100644
--- a/repoman/pym/repoman/modules/scan/directories/__init__.py
+++ b/repoman/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'checkdirlist': (None, None),
'checkdir_relative': (None, None),
},
+   'module_runsIn': ['pkgs'],
},
'mtime-module': {
'name': "mtime",
@@ -42,6 +43,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/eapi/__init__.py 
b/repoman/pym/repoman/modules/scan/eapi/__init__.py
index 4c3dd6e8f..f6306b3e1 100644
--- a/repoman/pym/repoman/modules/scan/eapi/__init__.py
+++ b/repoman/pym/repoman/modules/scan/eapi/__init__.py
@@ -23,6 +23,7 @@ module_spec = {
'func_kwargs': {
'ebuild': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/ebuild/__init__.py 
b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
index 8666e78c2..3e1d31951 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/__init__.py
@@ -37,6 +37,7 @@ module_spec = {
'xpkg': (None, None),
'y_ebuild': (None, None),
},
+   'module_runsIn': ['pkgs', 'ebuilds'],
},
'multicheck-module': {
'name': "multicheck",
@@ -52,6 +53,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/eclasses/__init__.py 
b/repoman/pym/repoman/modules/scan/eclasses/__init__.py
index 01bd29adf..9b1f203ce 100644
--- a/repoman/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/repoman/pym/repoman/modules/scan/eclasses/__init__.py
@@ -26,6 +26,7 @@ module_spec = {
'xpkg': (None, None),
'y_ebuild': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
'ruby-module': {
'name': "ruby",
@@ -41,6 +42,7 @@ module_spec = {
'ebuild': (None, None),
'pkg': (None, None),
},
+   'module_runsIn': ['ebuilds'],
},
}
 }

diff --git a/repoman/pym/repoman/modules/scan/fetch/__init__.py 
b/repoman/pym/repoman/modules/scan/fetch/__init__.py
index 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/eclasses/, ...

2017-07-10 Thread Brian Dolbec
commit: cda6c02a99e641c5c3a1997cafe9daaa9f24982d
Author: Brian Dolbec  gaikai  com>
AuthorDate: Tue Jun 27 17:56:09 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jul 10 17:50:19 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cda6c02a

repoman: Update modules for the new QAData class

Rather than direct import, now the QAData instance is accessed via
repo_settings.  Add repo_settings need to all modules requiring QAData
access.

 repoman/pym/repoman/modules/scan/depend/_depend_checks.py| 9 -
 repoman/pym/repoman/modules/scan/depend/profile.py   | 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/ebuild.py| 5 +++--
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 +-
 repoman/pym/repoman/modules/scan/eclasses/ruby.py| 5 +++--
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 ++--
 repoman/pym/repoman/modules/scan/metadata/description.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/ebuild_metadata.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/restrict.py| 4 ++--
 9 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py 
b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 11435f99e..cffacc55e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -9,7 +9,6 @@ from portage.dep import Atom
 from repoman.check_missingslot import check_missingslot
 # import our initialized portage instance
 from repoman._portage import portage
-from repoman.qa_data import suspect_virtual, suspect_rdepend
 
 def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
qatracker, relative_path):
@@ -51,7 +50,7 @@ def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
_traverse_tree(branch, 
in_any_of=in_any_of)
_traverse_tree(my_dep_tree, False)
 
-def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
'''Checks the ebuild dependencies for errors
 
@param pkg: Package in which we check (object).
@@ -111,11 +110,11 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
 
if pkg.category != "virtual":
if not is_blocker and \
-   atom.cp in suspect_virtual:
+   atom.cp in 
qadata.suspect_virtual:
qatracker.add_error(
'virtual.suspect', 
ebuild.relative_path +
": %s: consider using 
'%s' instead of '%s'" %
-   (mytype, 
suspect_virtual[atom.cp], atom))
+   (mytype, 
qadata.suspect_virtual[atom.cp], atom))
if not is_blocker and \

atom.cp.startswith("perl-core/"):

qatracker.add_error('dependency.perlcore',
@@ -141,7 +140,7 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
" wxwidgets.eclass" % 
(ebuild.relative_path, mytype))
elif runtime:
if not is_blocker and \
-   atom.cp in suspect_rdepend:
+   atom.cp in 
qadata.suspect_rdepend:
qatracker.add_error(
mytype + '.suspect',
ebuild.relative_path + 
": '%s'" % atom)

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py 
b/repoman/pym/repoman/modules/scan/depend/profile.py
index cf3d9a8f4..1adda44bb 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -63,7 +63,8 @@ class ProfileDependsChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
pkg = kwargs.get('pkg').get()
unknown_pkgs, baddepsyntax = _depend_checks(
-   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata)
+   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata,
+   self.repo_settings.qadata)
 
relevant_profiles = []
for keyword, arch, groups in _gen_arches(ebuild, self.options,

diff --git a/repoman/pym/repoman/modules/scan/ebuild/ebuild.py 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/depend/, ...

2017-06-27 Thread Brian Dolbec
commit: 76e8ccbb1d8863fb4e1f8ec2404b6e407c410e1c
Author: Brian Dolbec  gaikai  com>
AuthorDate: Tue Jun 27 17:56:09 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jun 27 22:05:14 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=76e8ccbb

repoman: Update modules for the new QAData class

Rather than direct import, now the QAData instance is accessed via
repo_settings.  Add repo_settings need to all modules requiring QAData
access.

 repoman/pym/repoman/modules/scan/depend/_depend_checks.py| 9 -
 repoman/pym/repoman/modules/scan/depend/profile.py   | 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/ebuild.py| 5 +++--
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 +-
 repoman/pym/repoman/modules/scan/eclasses/ruby.py| 5 +++--
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 ++--
 repoman/pym/repoman/modules/scan/metadata/description.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/ebuild_metadata.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/restrict.py| 4 ++--
 9 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py 
b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 11435f99e..cffacc55e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -9,7 +9,6 @@ from portage.dep import Atom
 from repoman.check_missingslot import check_missingslot
 # import our initialized portage instance
 from repoman._portage import portage
-from repoman.qa_data import suspect_virtual, suspect_rdepend
 
 def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
qatracker, relative_path):
@@ -51,7 +50,7 @@ def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
_traverse_tree(branch, 
in_any_of=in_any_of)
_traverse_tree(my_dep_tree, False)
 
-def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
'''Checks the ebuild dependencies for errors
 
@param pkg: Package in which we check (object).
@@ -111,11 +110,11 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
 
if pkg.category != "virtual":
if not is_blocker and \
-   atom.cp in suspect_virtual:
+   atom.cp in 
qadata.suspect_virtual:
qatracker.add_error(
'virtual.suspect', 
ebuild.relative_path +
": %s: consider using 
'%s' instead of '%s'" %
-   (mytype, 
suspect_virtual[atom.cp], atom))
+   (mytype, 
qadata.suspect_virtual[atom.cp], atom))
if not is_blocker and \

atom.cp.startswith("perl-core/"):

qatracker.add_error('dependency.perlcore',
@@ -141,7 +140,7 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
" wxwidgets.eclass" % 
(ebuild.relative_path, mytype))
elif runtime:
if not is_blocker and \
-   atom.cp in suspect_rdepend:
+   atom.cp in 
qadata.suspect_rdepend:
qatracker.add_error(
mytype + '.suspect',
ebuild.relative_path + 
": '%s'" % atom)

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py 
b/repoman/pym/repoman/modules/scan/depend/profile.py
index cf3d9a8f4..1adda44bb 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -63,7 +63,8 @@ class ProfileDependsChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
pkg = kwargs.get('pkg').get()
unknown_pkgs, baddepsyntax = _depend_checks(
-   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata)
+   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata,
+   self.repo_settings.qadata)
 
relevant_profiles = []
for keyword, arch, groups in _gen_arches(ebuild, self.options,

diff --git a/repoman/pym/repoman/modules/scan/ebuild/ebuild.py 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/depend/, ...

2017-06-27 Thread Brian Dolbec
commit: c3be69803b3fa4eb1cd532252b28d6a57952e246
Author: Brian Dolbec  gaikai  com>
AuthorDate: Tue Jun 27 17:56:09 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jun 27 21:32:53 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c3be6980

repoman: Update modules for the new QAData class

Rather than direct import, now the QAData instance is accessed via
repo_settings.  Add repo_settings need to all modules requiring QAData
access.

 repoman/pym/repoman/modules/scan/depend/_depend_checks.py| 9 -
 repoman/pym/repoman/modules/scan/depend/profile.py   | 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/ebuild.py| 5 +++--
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 +-
 repoman/pym/repoman/modules/scan/eclasses/ruby.py| 5 +++--
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 ++--
 repoman/pym/repoman/modules/scan/metadata/description.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/ebuild_metadata.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/restrict.py| 4 ++--
 9 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py 
b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 11435f99e..cffacc55e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -9,7 +9,6 @@ from portage.dep import Atom
 from repoman.check_missingslot import check_missingslot
 # import our initialized portage instance
 from repoman._portage import portage
-from repoman.qa_data import suspect_virtual, suspect_rdepend
 
 def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
qatracker, relative_path):
@@ -51,7 +50,7 @@ def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
_traverse_tree(branch, 
in_any_of=in_any_of)
_traverse_tree(my_dep_tree, False)
 
-def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
'''Checks the ebuild dependencies for errors
 
@param pkg: Package in which we check (object).
@@ -111,11 +110,11 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
 
if pkg.category != "virtual":
if not is_blocker and \
-   atom.cp in suspect_virtual:
+   atom.cp in 
qadata.suspect_virtual:
qatracker.add_error(
'virtual.suspect', 
ebuild.relative_path +
": %s: consider using 
'%s' instead of '%s'" %
-   (mytype, 
suspect_virtual[atom.cp], atom))
+   (mytype, 
qadata.suspect_virtual[atom.cp], atom))
if not is_blocker and \

atom.cp.startswith("perl-core/"):

qatracker.add_error('dependency.perlcore',
@@ -141,7 +140,7 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
" wxwidgets.eclass" % 
(ebuild.relative_path, mytype))
elif runtime:
if not is_blocker and \
-   atom.cp in suspect_rdepend:
+   atom.cp in 
qadata.suspect_rdepend:
qatracker.add_error(
mytype + '.suspect',
ebuild.relative_path + 
": '%s'" % atom)

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py 
b/repoman/pym/repoman/modules/scan/depend/profile.py
index cf3d9a8f4..1adda44bb 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -63,7 +63,8 @@ class ProfileDependsChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
pkg = kwargs.get('pkg').get()
unknown_pkgs, baddepsyntax = _depend_checks(
-   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata)
+   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata,
+   self.repo_settings.qadata)
 
relevant_profiles = []
for keyword, arch, groups in _gen_arches(ebuild, self.options,

diff --git a/repoman/pym/repoman/modules/scan/ebuild/ebuild.py 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/

2017-06-27 Thread Brian Dolbec
commit: 2ceec91cec02b94cad84fddaf29bbe884baa1b6d
Author: Louis Sautier  gmail  com>
AuthorDate: Mon Jun 19 12:31:50 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jun 27 21:29:30 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2ceec91c

Repoman: detect inconsistent metadata.xml indentation

 repoman/pym/repoman/modules/scan/metadata/pkgmetadata.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/repoman/pym/repoman/modules/scan/metadata/pkgmetadata.py 
b/repoman/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 92c74e6f8..6a0f501ec 100644
--- a/repoman/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/repoman/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -3,8 +3,10 @@
 '''Package Metadata Checks operations'''
 
 import sys
+import re
 
 from itertools import chain
+from collections import Counter
 
 try:
from lxml import etree
@@ -96,6 +98,14 @@ class PkgMetadata(ScanBase, USEFlagChecks):
self.muselist = frozenset(self.musedict)
return False
 
+   indentation_chars = Counter()
+   for l in etree.tostring(_metadata_xml).splitlines():
+   indentation_chars.update(re.match(b"\s*", l).group(0))
+   if len(indentation_chars) > 1:
+   self.qatracker.add_error("metadata.warning", 
"%s/metadata.xml: %s" %
+   (xpkg, "inconsistent use of tabs and spaces in 
indentation")
+   )
+
xml_encoding = _metadata_xml.docinfo.encoding
if xml_encoding.upper() != metadata_xml_encoding:
self.qatracker.add_error(



[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/scan/metadata/, ...

2017-06-27 Thread Brian Dolbec
commit: 882008b713238da4ba9483dab13069c5a80bc354
Author: Brian Dolbec  gaikai  com>
AuthorDate: Tue Jun 27 17:56:09 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Jun 27 19:51:21 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=882008b7

repoman: Update modules for the new QAData class

Rather than direct import, now the QAData instance is accessed via
repo_settings.  Add repo_settings need to all modules requiring QAData
access.

 repoman/pym/repoman/modules/scan/depend/_depend_checks.py| 9 -
 repoman/pym/repoman/modules/scan/depend/profile.py   | 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/ebuild.py| 5 +++--
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 2 +-
 repoman/pym/repoman/modules/scan/eclasses/ruby.py| 5 +++--
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 4 ++--
 repoman/pym/repoman/modules/scan/metadata/description.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/ebuild_metadata.py | 6 +++---
 repoman/pym/repoman/modules/scan/metadata/restrict.py| 4 ++--
 9 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py 
b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 11435f99e..cffacc55e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -9,7 +9,6 @@ from portage.dep import Atom
 from repoman.check_missingslot import check_missingslot
 # import our initialized portage instance
 from repoman._portage import portage
-from repoman.qa_data import suspect_virtual, suspect_rdepend
 
 def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
qatracker, relative_path):
@@ -51,7 +50,7 @@ def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
_traverse_tree(branch, 
in_any_of=in_any_of)
_traverse_tree(my_dep_tree, False)
 
-def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
'''Checks the ebuild dependencies for errors
 
@param pkg: Package in which we check (object).
@@ -111,11 +110,11 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
 
if pkg.category != "virtual":
if not is_blocker and \
-   atom.cp in suspect_virtual:
+   atom.cp in 
qadata.suspect_virtual:
qatracker.add_error(
'virtual.suspect', 
ebuild.relative_path +
": %s: consider using 
'%s' instead of '%s'" %
-   (mytype, 
suspect_virtual[atom.cp], atom))
+   (mytype, 
qadata.suspect_virtual[atom.cp], atom))
if not is_blocker and \

atom.cp.startswith("perl-core/"):

qatracker.add_error('dependency.perlcore',
@@ -141,7 +140,7 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, 
repo_metadata):
" wxwidgets.eclass" % 
(ebuild.relative_path, mytype))
elif runtime:
if not is_blocker and \
-   atom.cp in suspect_rdepend:
+   atom.cp in 
qadata.suspect_rdepend:
qatracker.add_error(
mytype + '.suspect',
ebuild.relative_path + 
": '%s'" % atom)

diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py 
b/repoman/pym/repoman/modules/scan/depend/profile.py
index cf3d9a8f4..1adda44bb 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -63,7 +63,8 @@ class ProfileDependsChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
pkg = kwargs.get('pkg').get()
unknown_pkgs, baddepsyntax = _depend_checks(
-   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata)
+   ebuild, pkg, self.portdb, self.qatracker, 
self.repo_metadata,
+   self.repo_settings.qadata)
 
relevant_profiles = []
for keyword, arch, groups in _gen_arches(ebuild, self.options,

diff --git a/repoman/pym/repoman/modules/scan/ebuild/ebuild.py