From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-856617-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 4CEFE1388BF
	for <garchives@archives.gentoo.org>; Mon, 11 Jan 2016 08:02:18 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E44F021C041;
	Mon, 11 Jan 2016 08:02:04 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id BF9E421C03E
	for <gentoo-commits@lists.gentoo.org>; Mon, 11 Jan 2016 08:02:02 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E0D4A340871
	for <gentoo-commits@lists.gentoo.org>; Mon, 11 Jan 2016 08:02:01 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 41D56EE4
	for <gentoo-commits@lists.gentoo.org>; Mon, 11 Jan 2016 08:01:58 +0000 (UTC)
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" <dolsen@gentoo.org>
Message-ID: <1452499219.426eea99b36a01760c8b3c541623fbd307779f22.dolsen@gentoo>
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/repoman/main.py pym/repoman/scanner.py
X-VCS-Directories: pym/repoman/
X-VCS-Committer: dolsen
X-VCS-Committer-Name: Brian Dolbec
X-VCS-Revision: 426eea99b36a01760c8b3c541623fbd307779f22
X-VCS-Branch: repoman
Date: Mon, 11 Jan 2016 08:01:58 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 16eb1b2f-c2b8-4ba6-a803-99da0db2823d
X-Archives-Hash: 028f0d1fa7c03d3d726d5b2f36de2e1e

commit:     426eea99b36a01760c8b3c541623fbd307779f22
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 05:33:17 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:19 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=426eea99

repoman: Enable verbosity option to be useful for setting the logging level

Verbosity option was not being used internally.
Convert debug print's added to proper debug messages.

 pym/repoman/main.py    | 13 ++++++++++---
 pym/repoman/scanner.py | 35 +++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8784685..d43a688 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -19,7 +19,6 @@ from portage import os
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import util
 from portage.output import create_color_func, nocolor
 from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import formatter
@@ -38,13 +37,14 @@ from repoman.modules.vcs.settings import VCSSettings
 if sys.hexversion >= 0x3000000:
 	basestring = str
 
-util.initialize_logger()
-
 bad = create_color_func("BAD")
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
+LOGLEVEL = logging.WARNING
+portage.util.initialize_logger(LOGLEVEL)
+
 
 def repoman_main(argv):
 	config_root = os.environ.get("PORTAGE_CONFIGROOT")
@@ -62,6 +62,13 @@ def repoman_main(argv):
 		print("Portage", portage.VERSION)
 		sys.exit(0)
 
+	logger = logging.getLogger()
+
+	if options.verbosity > 0:
+		logger.setLevel(LOGLEVEL - 10 * options.verbosity)
+	else:
+		logger.setLevel(LOGLEVEL)
+
 	if options.experimental_inherit == 'y':
 		# This is experimental, so it's non-fatal.
 		qawarnings.add("inherit.missing")

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 50dd259..2620df3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,13 @@ from portage.module import Modules
 
 MODULES_PATH = os.path.join(os.path.dirname(__file__), "modules", "scan")
 # initial development debug info
-#print("module path:", path)
+logging.debug("module path: %s", MODULES_PATH)
 
 MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
 
-# initial development debug info
-#print(module_controller.module_names)
 MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
+# initial development debug info
+logging.debug("module_names: %s", MODULE_NAMES)
 
 
 class Scanner(object):
@@ -197,7 +197,7 @@ class Scanner(object):
 		for mod in ['manifests', 'isebuild', 'keywords', 'files', 'vcsstatus',
 					'fetches', 'pkgmetadata']:
 			mod_class = MODULE_CONTROLLER.get_class(mod)
-			print("Initializing class name:", mod_class.__name__)
+			logging.debug("Initializing class name: %s", mod_class.__name__)
 			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
 
 		# initialize our checks classes here before the big xpkg loop
@@ -207,7 +207,7 @@ class Scanner(object):
 		for xpkg in self.effective_scanlist:
 			xpkg_continue = False
 			# ebuilds and digests added to cvs respectively.
-			logging.info("checking package %s" % xpkg)
+			logging.info("checking package %s", xpkg)
 			# save memory by discarding xmatch caches from previous package(s)
 			self.caches['arch_xmatch'].clear()
 			self.eadded = []
@@ -235,7 +235,7 @@ class Scanner(object):
 			# need to set it up for ==> self.modules or some other ordered list
 			for mod in ['Manifests', 'IsEbuild', 'KeywordChecks', 'FileChecks',
 						'VCSStatus', 'FetchChecks', 'PkgMetadata']:
-				print("scan_pkgs(): module:", mod)
+				logging.debug("scan_pkgs; module: %s", mod)
 				do_it, functions = self.modules[mod].runInPkgs
 				if do_it:
 					for func in functions:
@@ -299,7 +299,7 @@ class Scanner(object):
 				logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])
 				if do_it:
 					for func in functions:
-						print("\tRunning function:", func)
+						logging.debug("\tRunning function: %s", func)
 						rdata = func(**dynamic_data)
 						if rdata.get('continue', False):
 							# If we can't access all the metadata then it's totally unsafe to
@@ -308,14 +308,17 @@ class Scanner(object):
 							# metadata leads to false positives for several checks, and false
 							# positives confuse users.
 							y_ebuild_continue = True
+							# logging.debug("\t>>> Continuing")
 							break
-						#print("rdata:", rdata)
+						# logging.debug("rdata: %s", rdata)
 						dynamic_data.update(rdata)
-						#print("dynamic_data", dynamic_data)
+						# logging.debug("dynamic_data: %s", dynamic_data)
 
 			if y_ebuild_continue:
 				continue
 
+			logging.debug("Finished ebuild plugin loop, continuing...")
+
 		# Final checks
 		# initialize per pkg plugin final checks here
 		# need to set it up for ==> self.modules_list or some other ordered list
@@ -323,22 +326,22 @@ class Scanner(object):
 		for mod in [('unused', 'UnusedChecks')]:
 			if mod[0]:
 				mod_class = MODULE_CONTROLLER.get_class(mod[0])
-				print("Initializing class name:", mod_class.__name__)
+				logging.debug("Initializing class name: %s", mod_class.__name__)
 				self.modules[mod[1]] = mod_class(**self.kwargs)
-			print("scan_ebuilds final checks: module:", mod[1])
+			logging.debug("scan_ebuilds final checks: module: %s", mod[1])
 			do_it, functions = self.modules[mod[1]].runInFinal
-			# print("do_it", do_it, "functions", functions)
+			logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])
 			if do_it:
 				for func in functions:
-					print("\tRunning function:", func)
+					logging.debug("\tRunning function: %s", func)
 					rdata = func(**dynamic_data)
 					if rdata.get('continue', False):
 						xpkg_complete = True
-						print("\t>>> Continuing")
+						# logging.debug("\t>>> Continuing")
 						break
-					#print("rdata:", rdata)
+					# logging.debug("rdata: %s", rdata)
 					dynamic_data.update(rdata)
-					#print("dynamic_data", dynamic_data)
+					# logging.debug("dynamic_data: %s", dynamic_data)
 
 		if xpkg_complete:
 			return