aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2018-03-29 17:41:17 -0700
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:13 -0700
commitbdb389a4c3beca541c07c0263a2fe7b4995a60c2 (patch)
treea6d4b6ac22a8e6fa494db1657ba245a6ebe7960b
parentqa_data.py: Initial move of all configurable data to the repo (diff)
downloadportage-bdb389a4c3beca541c07c0263a2fe7b4995a60c2.tar.gz
portage-bdb389a4c3beca541c07c0263a2fe7b4995a60c2.tar.bz2
portage-bdb389a4c3beca541c07c0263a2fe7b4995a60c2.zip
repoman: Move qa_data initialization and loading
Move the new QAData class instance init to repoman_main(). parse_args() remove unused qahelp parameter. qa_tracker.py: Add default qacats and qawarnings parameters as None. These will be assigned later due to circular init references. repos.py: Perform the QAData class loading and complete intialization assignments.
-rw-r--r--repoman/pym/repoman/argparser.py3
-rw-r--r--[-rwxr-xr-x]repoman/pym/repoman/main.py26
-rw-r--r--repoman/pym/repoman/qa_tracker.py10
-rw-r--r--repoman/pym/repoman/repos.py10
4 files changed, 29 insertions, 20 deletions
diff --git a/repoman/pym/repoman/argparser.py b/repoman/pym/repoman/argparser.py
index f32972288..48cb59eae 100644
--- a/repoman/pym/repoman/argparser.py
+++ b/repoman/pym/repoman/argparser.py
@@ -15,11 +15,10 @@ from portage import _unicode_decode
from portage import util
-def parse_args(argv, qahelp, repoman_default_opts):
+def parse_args(argv, repoman_default_opts):
"""Use a customized optionParser to parse command line arguments for repoman
Args:
argv - a sequence of command line arguments
- qahelp - a dict of qa warning to help message
Returns:
(opts, args), just like a call to parser.parse_args()
"""
diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py
index ccc735c7d..3b628de00 100755..100644
--- a/repoman/pym/repoman/main.py
+++ b/repoman/pym/repoman/main.py
@@ -29,9 +29,8 @@ from portage.util.futures.extendedfutures import (
from repoman.actions import Actions
from repoman.argparser import parse_args
-from repoman.qa_data import (
- format_qa_output, format_qa_output_column, qahelp,
- qawarnings, qacats)
+from repoman.qa_data import QAData
+from repoman.qa_data import format_qa_output, format_qa_output_column
from repoman.repos import RepoSettings
from repoman.scanner import Scanner
from repoman import utilities
@@ -60,7 +59,7 @@ def repoman_main(argv):
nocolor()
options, arguments = parse_args(
- sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
+ sys.argv, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
if options.version:
print("Repoman", VERSION, "(portage-%s)" % portage.VERSION)
@@ -73,10 +72,6 @@ def repoman_main(argv):
else:
logger.setLevel(LOGLEVEL)
- if options.experimental_inherit == 'y':
- # This is experimental, so it's non-fatal.
- qawarnings.add("inherit.missing")
-
# Set this to False when an extraordinary issue (generally
# something other than a QA issue) makes it impossible to
# commit (like if Manifest generation fails).
@@ -91,14 +86,21 @@ def repoman_main(argv):
# avoid a circular parameter repo_settings
vcs_settings = VCSSettings(options, repoman_settings)
+ qadata = QAData()
+ logging.debug("repoman_main: RepoSettings init")
repo_settings = RepoSettings(
config_root, portdir, portdir_overlay,
- repoman_settings, vcs_settings, options, qawarnings)
+ repoman_settings, vcs_settings, options, qadata)
repoman_settings = repo_settings.repoman_settings
# Now set repo_settings
vcs_settings.repo_settings = repo_settings
+ # set QATracker qacats, qawarnings
+ vcs_settings.qatracker.qacats = repo_settings.qadata.qacats
+ vcs_settings.qatracker.qawarnings = repo_settings.qadata.qawarnings
+ logging.debug("repoman_main: vcs_settings done")
+ logging.debug("repoman_main: qadata: %s", repo_settings.qadata)
if 'digest' in repoman_settings.features and options.digest != 'n':
options.digest = 'y'
@@ -133,11 +135,11 @@ def repoman_main(argv):
if options.mode == "manifest":
sys.exit(result['fail'])
- for x in qacats:
+ for x in qadata.qacats:
if x not in vcs_settings.qatracker.fails:
continue
result['warn'] = 1
- if x not in qawarnings:
+ if x not in qadata.qawarnings:
result['fail'] = 1
if result['fail'] or \
@@ -174,7 +176,7 @@ def repoman_main(argv):
format_output = format_outputs.get(
options.output_style, format_outputs['default'])
format_output(f, vcs_settings.qatracker.fails, result['full'],
- result['fail'], options, qawarnings)
+ result['fail'], options, qadata.qawarnings)
style_file.flush()
del console_writer, f, style_file
diff --git a/repoman/pym/repoman/qa_tracker.py b/repoman/pym/repoman/qa_tracker.py
index 9bfe0e241..faaf8e398 100644
--- a/repoman/pym/repoman/qa_tracker.py
+++ b/repoman/pym/repoman/qa_tracker.py
@@ -2,15 +2,15 @@
import logging
import sys
-from repoman.qa_data import qacats, qawarnings
-
class QATracker(object):
'''Track all occurrances of Q/A problems detected'''
- def __init__(self):
+ def __init__(self, qacats=None, qawarnings=None):
self.fails = {}
self.warns = {}
+ self.qacats = qacats
+ self.qawarnings = qawarnings
def add_error(self, detected_qa, info):
'''Add the Q/A error to the database of detected problems
@@ -18,7 +18,7 @@ class QATracker(object):
@param detected_qa: string, member of qa_data.qacats list
@param info: string, details of the detected problem
'''
- if detected_qa not in qacats:
+ if detected_qa not in self.qacats:
logging.error(
'QATracker: Exiting on error. Unknown detected_qa type passed '
'in to add_error(): %s, %s' % (detected_qa, info))
@@ -34,7 +34,7 @@ class QATracker(object):
@param detected_qa: string, member of qa_data.qawarnings list
@param info: string, details of the detected problem
'''
- if detected_qa not in qawarnings:
+ if detected_qa not in self.qawarnings:
logging.error(
'QATracker: Exiting on error. Unknown detected_qa type passed '
'in to add_warning(): %s, %s' % (detected_qa, info))
diff --git a/repoman/pym/repoman/repos.py b/repoman/pym/repoman/repos.py
index 6bf286002..b7c07bb94 100644
--- a/repoman/pym/repoman/repos.py
+++ b/repoman/pym/repoman/repos.py
@@ -28,7 +28,7 @@ class RepoSettings(object):
def __init__(
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
- qawarnings=None):
+ qadata=None):
self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
@@ -42,6 +42,14 @@ class RepoSettings(object):
except KeyError:
self._add_repo(config_root, portdir_overlay)
+ logging.debug("RepoSettings: init(); load qadata")
+ # load the repo specific configuration
+ self.qadata = qadata
+ if not self.qadata.load_repo_config(self.repodir, options):
+ logging.error("Aborting...")
+ sys.exit(1)
+ logging.debug("RepoSettings: qadata loaded: %s", qadata.no_exec)
+
self.root = self.repoman_settings['EROOT']
self.trees = {
self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}