public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/
Date: Tue, 27 Jun 2017 20:06:06 +0000 (UTC)	[thread overview]
Message-ID: <1498593081.da2a8745c7870c57c2b4025238c0b48acab09c5d.dolsen@gentoo> (raw)

commit:     da2a8745c7870c57c2b4025238c0b48acab09c5d
Author:     Brian Dolbec <bdolbec <AT> gaikai <DOT> com>
AuthorDate: Tue Jun 27 17:49:01 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jun 27 19:51:21 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=da2a8745

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.

 repoman/pym/repoman/argparser.py  |  3 +--
 repoman/pym/repoman/main.py       | 26 ++++++++++++++------------
 repoman/pym/repoman/qa_tracker.py | 10 +++++-----
 repoman/pym/repoman/repos.py      | 12 ++++++++++--
 4 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/repoman/pym/repoman/argparser.py b/repoman/pym/repoman/argparser.py
index 2d56a87e6..68701378f 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
old mode 100755
new mode 100644
index ccc735c7d..3b628de00
--- 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 39f53c180..cd917828d 100644
--- a/repoman/pym/repoman/repos.py
+++ b/repoman/pym/repoman/repos.py
@@ -27,7 +27,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
@@ -41,6 +41,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", qadata.no_exec)
+
 		self.root = self.repoman_settings['EROOT']
 		self.trees = {
 			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
@@ -60,7 +68,7 @@ class RepoSettings(object):
 				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
-			qawarnings.add("virtual.oldstyle")
+			qadata.qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit and options.mode in ("commit", "fix", "manifest"):
 			if vcs_settings.vcs:


             reply	other threads:[~2017-06-27 20:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 20:06 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-08-17  1:59 [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/ Brian Dolbec
2017-08-06  6:54 Michał Górny
2017-07-15  2:29 Brian Dolbec
2017-07-15  2:29 Brian Dolbec
2017-07-15  2:08 Brian Dolbec
2017-07-15  2:08 Brian Dolbec
2017-07-10 23:01 Brian Dolbec
2017-07-10 23:01 Brian Dolbec
2017-07-10 23:01 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 22:31 Brian Dolbec
2017-07-10 17:52 Brian Dolbec
2017-07-10 17:52 Brian Dolbec
2017-07-10 17:52 Brian Dolbec
2017-06-27 22:10 Brian Dolbec
2017-06-27 22:10 Brian Dolbec
2017-06-27 22:10 Brian Dolbec
2017-06-27 21:36 Brian Dolbec
2017-06-27 21:36 Brian Dolbec
2017-06-27 21:36 Brian Dolbec
2017-06-27 21:36 Brian Dolbec
2017-06-27 20:06 Brian Dolbec
2017-06-27 20:06 Brian Dolbec
2016-05-15 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-05-15 18:34 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-05-15  8:40 Brian Dolbec
2016-05-15  4:13 Brian Dolbec
2016-05-15  2:37 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498593081.da2a8745c7870c57c2b4025238c0b48acab09c5d.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox