public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     e409bc3aa41c61f50cd8712d36f7b8b097112283
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e409bc3a

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

---
 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 3b5296b..47ada0c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -135,6 +135,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-05-03  9:33 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-05-03  9:33 UTC (permalink / raw
  To: gentoo-commits

commit:     c26a6f10faed17ba08bbed946e50b8492ed975e0
Author:     Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Mon Jan 25 20:37:13 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue May  3 09:15:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c26a6f10

repoman: Remove No longer used repoman._xml module

 pym/repoman/_xml.py | 105 ----------------------------------------------------
 1 file changed, 105 deletions(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
deleted file mode 100644
index 33a536a..0000000
--- a/pym/repoman/_xml.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding:utf-8 -*-
-
-from __future__ import print_function, unicode_literals
-
-import sys
-import xml
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-from portage import os
-from portage.output import red
-from portage.process import find_binary
-
-from repoman.metadata import fetch_metadata_xsd
-from repoman._subprocess import repoman_getstatusoutput
-
-
-class _XMLParser(xml.etree.ElementTree.XMLParser):
-
-	def __init__(self, data, **kwargs):
-		xml.etree.ElementTree.XMLParser.__init__(self, **kwargs)
-		self._portage_data = data
-		if hasattr(self, 'parser'):
-			self._base_XmlDeclHandler = self.parser.XmlDeclHandler
-			self.parser.XmlDeclHandler = self._portage_XmlDeclHandler
-			self._base_StartDoctypeDeclHandler = \
-				self.parser.StartDoctypeDeclHandler
-			self.parser.StartDoctypeDeclHandler = \
-				self._portage_StartDoctypeDeclHandler
-
-	def _portage_XmlDeclHandler(self, version, encoding, standalone):
-		if self._base_XmlDeclHandler is not None:
-			self._base_XmlDeclHandler(version, encoding, standalone)
-		self._portage_data["XML_DECLARATION"] = (version, encoding, standalone)
-
-	def _portage_StartDoctypeDeclHandler(
-		self, doctypeName, systemId, publicId, has_internal_subset):
-		if self._base_StartDoctypeDeclHandler is not None:
-			self._base_StartDoctypeDeclHandler(
-				doctypeName, systemId, publicId, has_internal_subset)
-		self._portage_data["DOCTYPE"] = (doctypeName, systemId, publicId)
-
-
-class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
-	"""
-	Implements doctype() as required to avoid deprecation warnings with
-	>=python-2.7.
-	"""
-	def doctype(self, name, pubid, system):
-		pass
-
-
-class XmlLint(object):
-
-	def __init__(self, options, repoman_settings, metadata_xsd=None):
-		self.metadata_xsd = (metadata_xsd or
-			os.path.join(repoman_settings["DISTDIR"], 'metadata.xsd'))
-		self.options = options
-		self.repoman_settings = repoman_settings
-		self._is_capable = metadata_xsd is not None
-		self.binary = None
-		self._check_capable()
-
-	def _check_capable(self):
-		if self.options.mode == "manifest":
-			return
-		self.binary = find_binary('xmllint')
-		if not self.binary:
-			print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
-		elif not self._is_capable:
-			if not fetch_metadata_xsd(self.metadata_xsd, self.repoman_settings):
-				sys.exit(1)
-			# this can be problematic if xmllint changes their output
-			self._is_capable = True
-
-	@property
-	def capable(self):
-		return self._is_capable
-
-	def check(self, checkdir, repolevel):
-		'''Runs checks on the package metadata.xml file
-
-		@param checkdir: string, path
-		@param repolevel: integer
-		@return boolean, False == bad metadata
-		'''
-		if not self.capable:
-			if self.options.xml_parse or repolevel == 3:
-				print("%s sorry, xmllint is needed.  failing\n" % red("!!!"))
-				sys.exit(1)
-			return True
-		# xmlint can produce garbage output even on success, so only dump
-		# the ouput when it fails.
-		st, out = repoman_getstatusoutput(
-			self.binary + " --nonet --noout --schema %s %s" % (
-				portage._shell_quote(self.metadata_xsd),
-				portage._shell_quote(
-					os.path.join(checkdir, "metadata.xml"))))
-		if st != os.EX_OK:
-			print(red("!!!") + " metadata.xml is invalid:")
-			for z in out.splitlines():
-				print(red("!!! ") + z)
-			return False
-		return True


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2016-04-29 17:24 Brian Dolbec
  2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2016-04-29 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     dc684ee6e4b1f0b8bef7babdf13a1143046c87c5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:20:45 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 14:50:41 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dc684ee6

repoman/scanner.py: Mark self.ext_futures private

 pym/repoman/scanner.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a5c54b1..f1a0231 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -200,7 +200,7 @@ class Scanner(object):
 		}
 		# initialize the plugin checks here
 		self.modules = {}
-		self.ext_futures = {}
+		self._ext_futures = {}
 		self.pkg_level_futures = None
 
 	def set_kwargs(self, mod):
@@ -232,10 +232,10 @@ class Scanner(object):
 			logging.debug("set_func_kwargs(); adding: %s, %s",
 				key, func_kwargs[key])
 			if func_kwargs[key][0] in ['Future', 'ExtendedFuture']:
-				if key not in self.ext_futures:
+				if key not in self._ext_futures:
 					logging.debug(
 						"Adding a new key: %s to the ExtendedFuture dict", key)
-					self.ext_futures[key] = func_kwargs[key]
+					self._ext_futures[key] = func_kwargs[key]
 				self._set_future(dynamic_data, key, func_kwargs[key])
 			else:  # builtin python data type
 				dynamic_data[key] = DATA_TYPES[func_kwargs[key][0]]()
@@ -249,9 +249,9 @@ class Scanner(object):
 
 		@param dynamic_data: dictionary
 		'''
-		for key in list(self.ext_futures):
+		for key in list(self._ext_futures):
 			if key not in self.pkg_level_futures:
-				self._set_future(dynamic_data, key, self.ext_futures[key])
+				self._set_future(dynamic_data, key, self._ext_futures[key])
 
 	@staticmethod
 	def _set_future(dynamic_data, key, data):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2016-04-29 17:24 Brian Dolbec
  2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2016-04-29 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     5cb92a836ed539b7dd5952b7404b5c7f473b844a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:22:37 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 14:50:41 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5cb92a83

repoman/scanner.py: Clean up some debug prints

 pym/repoman/scanner.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index f1a0231..e5e5717 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -260,17 +260,14 @@ class Scanner(object):
 		@param dynamic_data: dictionary
 		@param key: tuple of (dictionary-key, default-value)
 		'''
-		#print("***", key, data)
 		if data[0] in ['Future', 'ExtendedFuture']:
 			if data[1] in ['UNSET']:
-				#print("adding unset default")
 				dynamic_data[key] = ExtendedFuture()
 			else:
 				if data[1] in DATA_TYPES:
 					default = DATA_TYPES[data[1]]()
 				else:
 					default = data[1]
-				#print("adding default:", default)
 				dynamic_data[key] = ExtendedFuture(default)
 
 	def scan_pkgs(self, can_force):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2016-04-29 17:24 Brian Dolbec
  2016-04-26 14:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2016-04-29 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     67b7d60d949002ecf72a13dcda81e34362df8c2c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 26 14:09:39 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 14:09:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=67b7d60d

repoman, scanner.py: Remove  a rebase error duplicate line.

 pym/repoman/scanner.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 23d666d..6ded7ee 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -233,8 +233,6 @@ class Scanner(object):
 		for key in new:
 			logging.debug("set_func_kwargs(); adding: %s, %s",
 				key, func_kwargs[key])
-			logging.debug("set_func_kwargs(); adding: %s, %s",
-				key, func_kwargs[key])
 			if func_kwargs[key][0] in ['Future', 'ExtendedFuture']:
 				if key not in self.ext_futures:
 					logging.debug(


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-28 15:05 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-28 15:05 UTC (permalink / raw
  To: gentoo-commits

commit:     e5d298ccb05b630f17035f31a79c2fe55b90bf07
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:12:53 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 14:48:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5d298cc

repoman/scanner.py: Make some variables  local instead of classwide

Some were not needed outside of __init__.
Some are included  self.kwargs.
Several classwide variables repolevel, reposplit, categories are accessed
outside of the scanner class.  So therefore can not be made local.

 pym/repoman/scanner.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d966513..a5c54b1 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -107,13 +107,13 @@ class Scanner(object):
 		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
 		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
 
-		self.profiles = setup_profile(profile_list)
+		profiles = setup_profile(profile_list)
 
-		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+		check_profiles(profiles, self.repo_settings.repoman_settings.archlist())
 
 		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
 
-		self.dev_keywords = dev_profile_keywords(self.profiles)
+		self.dev_keywords = dev_profile_keywords(profiles)
 
 		self.qatracker = self.vcs_settings.qatracker
 
@@ -123,7 +123,7 @@ class Scanner(object):
 		if self.vcs_settings.vcs is None:
 			self.options.echangelog = 'n'
 
-		self.checks = {}
+		checks = {}
 		# The --echangelog option causes automatic ChangeLog generation,
 		# which invalidates changelog.ebuildadded and changelog.missing
 		# checks.
@@ -135,7 +135,7 @@ class Scanner(object):
 		# TODO: shouldn't this just be switched on the repo, iso the VCS?
 		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
 		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
-		self.checks['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+		checks['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
 
 		if self.options.mode == "manifest" or self.options.quiet:
 			pass
@@ -170,7 +170,7 @@ class Scanner(object):
 
 		# Disable the "self.modules['Ebuild'].notadded" check when not in commit mode and
 		# running `svn status` in every package dir will be too expensive.
-		self.checks['ebuild_notadded'] = not \
+		checks['ebuild_notadded'] = not \
 			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
 
 		self.effective_scanlist = scanlist
@@ -188,9 +188,9 @@ class Scanner(object):
 			"options": self.options,
 			"metadata_xsd": metadata_xsd,
 			"uselist": uselist,
-			"checks": self.checks,
+			"checks": checks,
 			"repo_metadata": self.repo_metadata,
-			"profiles": self.profiles,
+			"profiles": profiles,
 			"include_arches": self.include_arches,
 			"caches": self.caches,
 			"repoman_incrementals": self.repoman_incrementals,
@@ -291,7 +291,7 @@ class Scanner(object):
 			checkdirlist = os.listdir(checkdir)
 
 			# Run the status check
-			if self.checks['ebuild_notadded']:
+			if self.kwargs['checks']['ebuild_notadded']:
 				self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
 
 			dynamic_data = {
@@ -350,7 +350,7 @@ class Scanner(object):
 			ebuildlist = sorted(pkgs.values())
 			ebuildlist = [pkg.pf for pkg in ebuildlist]
 
-			if self.checks['changelog'] and "ChangeLog" not in checkdirlist:
+			if self.kwargs['checks']['changelog'] and "ChangeLog" not in checkdirlist:
 				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 
 			changelog_path = os.path.join(checkdir_relative, "ChangeLog")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-27  5:22 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-27  5:22 UTC (permalink / raw
  To: gentoo-commits

commit:     5b1499d1c8a15cfcbf51fe55bf412f3d0583c41d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:20:45 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Apr 27 05:20:40 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5b1499d1

repoman/scanner.py: Mark self.ext_futures private

 pym/repoman/scanner.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46e9d85..ab1339a 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -200,7 +200,7 @@ class Scanner(object):
 		}
 		# initialize the plugin checks here
 		self.modules = {}
-		self.ext_futures = {}
+		self._ext_futures = {}
 		self.pkg_level_futures = None
 
 	def set_kwargs(self, mod):
@@ -232,10 +232,10 @@ class Scanner(object):
 			logging.debug("set_func_kwargs(); adding: %s, %s",
 				key, func_kwargs[key])
 			if func_kwargs[key][0] in ['Future', 'ExtendedFuture']:
-				if key not in self.ext_futures:
+				if key not in self._ext_futures:
 					logging.debug(
 						"Adding a new key: %s to the ExtendedFuture dict", key)
-					self.ext_futures[key] = func_kwargs[key]
+					self._ext_futures[key] = func_kwargs[key]
 				self._set_future(dynamic_data, key, func_kwargs[key])
 			else:  # builtin python data type
 				dynamic_data[key] = DATA_TYPES[func_kwargs[key][0]]()
@@ -249,9 +249,9 @@ class Scanner(object):
 
 		@param dynamic_data: dictionary
 		'''
-		for key in list(self.ext_futures):
+		for key in list(self._ext_futures):
 			if key not in self.pkg_level_futures:
-				self._set_future(dynamic_data, key, self.ext_futures[key])
+				self._set_future(dynamic_data, key, self._ext_futures[key])
 
 	@staticmethod
 	def _set_future(dynamic_data, key, data):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-27  5:22 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-27  5:22 UTC (permalink / raw
  To: gentoo-commits

commit:     125d92736ef9c87077cf32b8fb254fef4a52fbc1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:12:53 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Apr 27 05:20:31 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=125d9273

repoman/scanner.py: Make some variables  local instead of classwide

Some were not needed outside of __init__.
Some are included  self.kwargs.

 pym/repoman/scanner.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d966513..46e9d85 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -75,11 +75,11 @@ class Scanner(object):
 			self.portdb._aux_cache_keys.update(
 				["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
 
-		self.reposplit = myreporoot.split(os.path.sep)
-		self.repolevel = len(self.reposplit)
+		reposplit = myreporoot.split(os.path.sep)
+		self.repolevel = len(reposplit)
 
 		if self.options.mode == 'commit':
-			repochecks.commit_check(self.repolevel, self.reposplit)
+			repochecks.commit_check(self.repolevel, reposplit)
 			repochecks.conflict_check(self.vcs_settings, self.options)
 
 		# Make startdir relative to the canonical repodir, so that we can pass
@@ -107,13 +107,13 @@ class Scanner(object):
 		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
 		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
 
-		self.profiles = setup_profile(profile_list)
+		profiles = setup_profile(profile_list)
 
-		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+		check_profiles(profiles, self.repo_settings.repoman_settings.archlist())
 
-		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
+		scanlist = scan(self.repolevel, reposplit, startdir, self.categories, self.repo_settings)
 
-		self.dev_keywords = dev_profile_keywords(self.profiles)
+		self.dev_keywords = dev_profile_keywords(profiles)
 
 		self.qatracker = self.vcs_settings.qatracker
 
@@ -123,7 +123,7 @@ class Scanner(object):
 		if self.vcs_settings.vcs is None:
 			self.options.echangelog = 'n'
 
-		self.checks = {}
+		checks = {}
 		# The --echangelog option causes automatic ChangeLog generation,
 		# which invalidates changelog.ebuildadded and changelog.missing
 		# checks.
@@ -135,7 +135,7 @@ class Scanner(object):
 		# TODO: shouldn't this just be switched on the repo, iso the VCS?
 		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
 		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
-		self.checks['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+		checks['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
 
 		if self.options.mode == "manifest" or self.options.quiet:
 			pass
@@ -170,14 +170,14 @@ class Scanner(object):
 
 		# Disable the "self.modules['Ebuild'].notadded" check when not in commit mode and
 		# running `svn status` in every package dir will be too expensive.
-		self.checks['ebuild_notadded'] = not \
+		checks['ebuild_notadded'] = not \
 			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
 
 		self.effective_scanlist = scanlist
 		if self.options.if_modified == "y":
 			self.effective_scanlist = sorted(vcs_files_to_cps(
 				chain(self.changed.changed, self.changed.new, self.changed.removed),
-				self.repolevel, self.reposplit, self.categories))
+				self.repolevel, reposplit, self.categories))
 
 		# Create our kwargs dict here to initialize the plugins with
 		self.kwargs = {
@@ -188,9 +188,9 @@ class Scanner(object):
 			"options": self.options,
 			"metadata_xsd": metadata_xsd,
 			"uselist": uselist,
-			"checks": self.checks,
+			"checks": checks,
 			"repo_metadata": self.repo_metadata,
-			"profiles": self.profiles,
+			"profiles": profiles,
 			"include_arches": self.include_arches,
 			"caches": self.caches,
 			"repoman_incrementals": self.repoman_incrementals,
@@ -291,7 +291,7 @@ class Scanner(object):
 			checkdirlist = os.listdir(checkdir)
 
 			# Run the status check
-			if self.checks['ebuild_notadded']:
+			if self.kwargs['checks']['ebuild_notadded']:
 				self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
 
 			dynamic_data = {
@@ -350,7 +350,7 @@ class Scanner(object):
 			ebuildlist = sorted(pkgs.values())
 			ebuildlist = [pkg.pf for pkg in ebuildlist]
 
-			if self.checks['changelog'] and "ChangeLog" not in checkdirlist:
+			if self.kwargs['checks']['changelog'] and "ChangeLog" not in checkdirlist:
 				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 
 			changelog_path = os.path.join(checkdir_relative, "ChangeLog")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-27  5:22 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-27  5:22 UTC (permalink / raw
  To: gentoo-commits

commit:     8618be15d921e2de7abbdfe1a67c7b9c1ff224bd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 03:22:37 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Apr 27 05:20:40 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8618be15

repoman/scanner.py: Clean up some debug prints

 pym/repoman/scanner.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ab1339a..c2e64a5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -260,17 +260,14 @@ class Scanner(object):
 		@param dynamic_data: dictionary
 		@param key: tuple of (dictionary-key, default-value)
 		'''
-		#print("***", key, data)
 		if data[0] in ['Future', 'ExtendedFuture']:
 			if data[1] in ['UNSET']:
-				#print("adding unset default")
 				dynamic_data[key] = ExtendedFuture()
 			else:
 				if data[1] in DATA_TYPES:
 					default = DATA_TYPES[data[1]]()
 				else:
 					default = data[1]
-				#print("adding default:", default)
 				dynamic_data[key] = ExtendedFuture(default)
 
 	def scan_pkgs(self, can_force):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-26 18:08 Zac Medico
  0 siblings, 0 replies; 216+ messages in thread
From: Zac Medico @ 2016-04-26 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     8443e66ae5ffce5fb0daa73a3eeb0b18077ee942
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 26 18:07:48 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 18:07:48 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8443e66a

Scanner: remove self.pkgs attribute

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6ded7ee..d966513 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -179,8 +179,6 @@ class Scanner(object):
 				chain(self.changed.changed, self.changed.new, self.changed.removed),
 				self.repolevel, self.reposplit, self.categories))
 
-		self.pkgs = None
-
 		# Create our kwargs dict here to initialize the plugins with
 		self.kwargs = {
 			"repo_settings": self.repo_settings,
@@ -348,8 +346,8 @@ class Scanner(object):
 				continue
 
 			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
-			self.pkgs = dynamic_data['pkgs'].get()
-			ebuildlist = sorted(self.pkgs.values())
+			pkgs = dynamic_data['pkgs'].get()
+			ebuildlist = sorted(pkgs.values())
 			ebuildlist = [pkg.pf for pkg in ebuildlist]
 
 			if self.checks['changelog'] and "ChangeLog" not in checkdirlist:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-25 15:32 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-25 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     fa237acb3e15d18877237f034194cf879e879170
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 19:57:08 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa237acb

XmlLint: remove incorred self._is_capable setting

This setting interferred with the fix for bug 567746.

 pym/repoman/_xml.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index f7ff9fb..d55dda5 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,7 +60,6 @@ class XmlLint(object):
 		self.repoman_settings = repoman_settings
 		self._is_capable = metadata_dtd is not None
 		self.binary = None
-		self._is_capable = False
 		self._check_capable()
 
 	def _check_capable(self):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-25 15:32 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-25 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     edd6f6cd73839dad09ce7c65c09ac38c30e6b5eb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 23:29:20 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=edd6f6cd

repoman: Limit the kwargs passed to the module's __init__()

This has the benefit of forcing the module to declare what data it requires.
Rather than possibly silently fail.

 pym/repoman/scanner.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e9a8e20..5ac519e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -202,7 +202,18 @@ class Scanner(object):
 					'fetches', 'pkgmetadata']:
 			mod_class = MODULE_CONTROLLER.get_class(mod)
 			logging.debug("Initializing class name: %s", mod_class.__name__)
-			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
+			self.modules[mod_class.__name__] = mod_class(**self.set_kwargs(mod))
+
+	def set_kwargs(self, mod):
+		'''Creates a limited set of kwargs to pass to the module's __init__()
+
+		@param mod: module name string
+		@returns: dictionary
+		'''
+		kwargs = {}
+		for key in MODULE_CONTROLLER.modules[mod]['mod_kwargs']:
+			kwargs[key] = self.kwargs[key]
+		return kwargs
 
 	def scan_pkgs(self, can_force):
 		for xpkg in self.effective_scanlist:
@@ -295,7 +306,7 @@ class Scanner(object):
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
 					logging.debug("Initializing class name: %s", mod_class.__name__)
-					self.modules[mod[1]] = mod_class(**self.kwargs)
+					self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 				logging.debug("scan_ebuilds: module: %s", mod[1])
 				do_it, functions = self.modules[mod[1]].runInEbuilds
 				logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])
@@ -329,7 +340,7 @@ class Scanner(object):
 			if mod[0]:
 				mod_class = MODULE_CONTROLLER.get_class(mod[0])
 				logging.debug("Initializing class name: %s", mod_class.__name__)
-				self.modules[mod[1]] = mod_class(**self.kwargs)
+				self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 			logging.debug("scan_ebuilds final checks: module: %s", mod[1])
 			do_it, functions = self.modules[mod[1]].runInFinal
 			logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-25 15:32 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-25 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     32399303c9c8b8965c9cd8a10fd6c87542d01bc3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 07:47:49 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=32399303

repoman/actions.py: fix copyright update (bug 405017)

The Actions.perform method failed to update copyright for new and
changed files with --echangelog=n, so fix it to handle this case.

X-Gentoo-Bug: 405017
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=405017

 pym/repoman/actions.py   | 9 +++++++++
 pym/repoman/utilities.py | 7 -------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index c0cd5cc..643e24c 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -9,6 +9,7 @@ import platform
 import signal
 import sys
 import tempfile
+import time
 from itertools import chain
 
 from _emerge.UserQuery import UserQuery
@@ -22,6 +23,7 @@ from portage.output import (
 from portage.package.ebuild.digestgen import digestgen
 from portage.util import writemsg_level
 
+from repoman.copyrights import update_copyright
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
 from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -111,6 +113,13 @@ class Actions(object):
 
 		commitmessage = commitmessage.rstrip()
 
+		# Update copyright for new and changed files
+		year = time.strftime('%Y', time.gmtime())
+		for fn in chain(mynew, mychanged):
+			if fn.endswith('.diff') or fn.endswith('.patch'):
+				continue
+			update_copyright(fn, year, pretend=self.options.pretend)
+
 		myupdates, broken_changelog_manifests = self.changelogs(
 					myupdates, mymanifests, myremoved, mychanged, myautoadd,
 					mynew, commitmessage)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 47b5aab..8a757dc 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -395,13 +395,6 @@ def UpdateChangeLog(
 	year = time.strftime('%Y', gmtime)
 	date = time.strftime('%d %b %Y', gmtime)
 
-	# check modified files and the ChangeLog for copyright updates
-	# patches and diffs (identified by .patch and .diff) are excluded
-	for fn in chain(new, changed):
-		if fn.endswith('.diff') or fn.endswith('.patch'):
-			continue
-		update_copyright(os.path.join(pkgdir, fn), year, pretend=pretend)
-
 	cl_path = os.path.join(pkgdir, 'ChangeLog')
 	clold_lines = []
 	clnew_lines = []


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-21 16:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-21 16:54 UTC (permalink / raw
  To: gentoo-commits

commit:     96dc91e77da08c7ba30974ee65c9f3ae876e5b39
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 23:29:20 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 16:51:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=96dc91e7

repoman: Limit the kwargs passed to the module's __init__()

This has the benefit of forcing the module to declare what data it requires.
Rather than possibly silently fail.

 pym/repoman/scanner.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e9a8e20..5ac519e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -202,7 +202,18 @@ class Scanner(object):
 					'fetches', 'pkgmetadata']:
 			mod_class = MODULE_CONTROLLER.get_class(mod)
 			logging.debug("Initializing class name: %s", mod_class.__name__)
-			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
+			self.modules[mod_class.__name__] = mod_class(**self.set_kwargs(mod))
+
+	def set_kwargs(self, mod):
+		'''Creates a limited set of kwargs to pass to the module's __init__()
+
+		@param mod: module name string
+		@returns: dictionary
+		'''
+		kwargs = {}
+		for key in MODULE_CONTROLLER.modules[mod]['mod_kwargs']:
+			kwargs[key] = self.kwargs[key]
+		return kwargs
 
 	def scan_pkgs(self, can_force):
 		for xpkg in self.effective_scanlist:
@@ -295,7 +306,7 @@ class Scanner(object):
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
 					logging.debug("Initializing class name: %s", mod_class.__name__)
-					self.modules[mod[1]] = mod_class(**self.kwargs)
+					self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 				logging.debug("scan_ebuilds: module: %s", mod[1])
 				do_it, functions = self.modules[mod[1]].runInEbuilds
 				logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])
@@ -329,7 +340,7 @@ class Scanner(object):
 			if mod[0]:
 				mod_class = MODULE_CONTROLLER.get_class(mod[0])
 				logging.debug("Initializing class name: %s", mod_class.__name__)
-				self.modules[mod[1]] = mod_class(**self.kwargs)
+				self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 			logging.debug("scan_ebuilds final checks: module: %s", mod[1])
 			do_it, functions = self.modules[mod[1]].runInFinal
 			logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-21 16:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-21 16:54 UTC (permalink / raw
  To: gentoo-commits

commit:     cce21fdf368e1c605f8ad4a2291df3f6fceb44a3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 19:57:08 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 16:51:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cce21fdf

XmlLint: remove incorred self._is_capable setting

This setting interferred with the fix for bug 567746.

 pym/repoman/_xml.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index f7ff9fb..d55dda5 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,7 +60,6 @@ class XmlLint(object):
 		self.repoman_settings = repoman_settings
 		self._is_capable = metadata_dtd is not None
 		self.binary = None
-		self._is_capable = False
 		self._check_capable()
 
 	def _check_capable(self):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-21 16:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-21 16:54 UTC (permalink / raw
  To: gentoo-commits

commit:     9e04f437f9397309905eb88cf4e5da2052a60da3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 07:47:49 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 16:49:29 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e04f437

repoman/actions.py: fix copyright update (bug 405017)

The Actions.perform method failed to update copyright for new and
changed files with --echangelog=n, so fix it to handle this case.

X-Gentoo-Bug: 405017
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=405017

 pym/repoman/actions.py   | 9 +++++++++
 pym/repoman/utilities.py | 7 -------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index c0cd5cc..643e24c 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -9,6 +9,7 @@ import platform
 import signal
 import sys
 import tempfile
+import time
 from itertools import chain
 
 from _emerge.UserQuery import UserQuery
@@ -22,6 +23,7 @@ from portage.output import (
 from portage.package.ebuild.digestgen import digestgen
 from portage.util import writemsg_level
 
+from repoman.copyrights import update_copyright
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
 from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -111,6 +113,13 @@ class Actions(object):
 
 		commitmessage = commitmessage.rstrip()
 
+		# Update copyright for new and changed files
+		year = time.strftime('%Y', time.gmtime())
+		for fn in chain(mynew, mychanged):
+			if fn.endswith('.diff') or fn.endswith('.patch'):
+				continue
+			update_copyright(fn, year, pretend=self.options.pretend)
+
 		myupdates, broken_changelog_manifests = self.changelogs(
 					myupdates, mymanifests, myremoved, mychanged, myautoadd,
 					mynew, commitmessage)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 47b5aab..8a757dc 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -395,13 +395,6 @@ def UpdateChangeLog(
 	year = time.strftime('%Y', gmtime)
 	date = time.strftime('%d %b %Y', gmtime)
 
-	# check modified files and the ChangeLog for copyright updates
-	# patches and diffs (identified by .patch and .diff) are excluded
-	for fn in chain(new, changed):
-		if fn.endswith('.diff') or fn.endswith('.patch'):
-			continue
-		update_copyright(os.path.join(pkgdir, fn), year, pretend=pretend)
-
 	cl_path = os.path.join(pkgdir, 'ChangeLog')
 	clold_lines = []
 	clnew_lines = []


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-21 16:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-21 16:54 UTC (permalink / raw
  To: gentoo-commits

commit:     dd1070496dde6e68b9fe47bd23a3a6bfd076dc90
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 16:49:27 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd107049

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-17 15:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-04-17 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     890f4f45fd9bdad86ce0aa5abb2afc8ef20acf48
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 23:29:20 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Apr 16 23:38:31 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=890f4f45

repoman: Limit the kwargs passed to the module's __init__()

This has the benefit of forcing the module to declare what data it requires.
Rather than possibly silently fail.

 pym/repoman/scanner.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e9a8e20..d01277e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -202,7 +202,18 @@ class Scanner(object):
 					'fetches', 'pkgmetadata']:
 			mod_class = MODULE_CONTROLLER.get_class(mod)
 			logging.debug("Initializing class name: %s", mod_class.__name__)
-			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
+			self.modules[mod_class.__name__] = mod_class(**self.set_kwargs(mod))
+
+	def set_kwargs(self, mod):
+		'''Creates a limited set or kwargs to pass to the module's __init__()
+
+		@param mod: module name string
+		@returns: dictionary
+		'''
+		kwargs = {}
+		for key in MODULE_CONTROLLER.modules[mod]['mod_kwargs']:
+			kwargs[key] = self.kwargs[key]
+		return kwargs
 
 	def scan_pkgs(self, can_force):
 		for xpkg in self.effective_scanlist:
@@ -295,7 +306,7 @@ class Scanner(object):
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
 					logging.debug("Initializing class name: %s", mod_class.__name__)
-					self.modules[mod[1]] = mod_class(**self.kwargs)
+					self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 				logging.debug("scan_ebuilds: module: %s", mod[1])
 				do_it, functions = self.modules[mod[1]].runInEbuilds
 				logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])
@@ -329,7 +340,7 @@ class Scanner(object):
 			if mod[0]:
 				mod_class = MODULE_CONTROLLER.get_class(mod[0])
 				logging.debug("Initializing class name: %s", mod_class.__name__)
-				self.modules[mod[1]] = mod_class(**self.kwargs)
+				self.modules[mod[1]] = mod_class(**self.set_kwargs(mod))
 			logging.debug("scan_ebuilds final checks: module: %s", mod[1])
 			do_it, functions = self.modules[mod[1]].runInFinal
 			logging.debug("do_it: %s, functions: %s", do_it, [x.__name__ for x in functions])


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-04-16 20:00 Zac Medico
  0 siblings, 0 replies; 216+ messages in thread
From: Zac Medico @ 2016-04-16 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     494d6401dd25ff4a49eac86f772bce09fc9a61f1
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 19:57:08 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Apr 16 20:00:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=494d6401

XmlLint: remove incorred self._is_capable setting

This setting interferred with the fix for bug 567746.

 pym/repoman/_xml.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index f7ff9fb..d55dda5 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,7 +60,6 @@ class XmlLint(object):
 		self.repoman_settings = repoman_settings
 		self._is_capable = metadata_dtd is not None
 		self.binary = None
-		self._is_capable = False
 		self._check_capable()
 
 	def _check_capable(self):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-15 19:00 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-15 19:00 UTC (permalink / raw
  To: gentoo-commits

commit:     e9b63ed5c5e9f169c333b1d98613ec574ad946c8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 07:47:49 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Mar 15 18:57:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e9b63ed5

repoman/actions.py: fix copyright update (bug 405017)

The Actions.perform method failed to update copyright for new and
changed files with --echangelog=n, so fix it to handle this case.

X-Gentoo-Bug: 405017
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=405017

 pym/repoman/actions.py   | 9 +++++++++
 pym/repoman/utilities.py | 7 -------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index c0cd5cc..643e24c 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -9,6 +9,7 @@ import platform
 import signal
 import sys
 import tempfile
+import time
 from itertools import chain
 
 from _emerge.UserQuery import UserQuery
@@ -22,6 +23,7 @@ from portage.output import (
 from portage.package.ebuild.digestgen import digestgen
 from portage.util import writemsg_level
 
+from repoman.copyrights import update_copyright
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
 from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -111,6 +113,13 @@ class Actions(object):
 
 		commitmessage = commitmessage.rstrip()
 
+		# Update copyright for new and changed files
+		year = time.strftime('%Y', time.gmtime())
+		for fn in chain(mynew, mychanged):
+			if fn.endswith('.diff') or fn.endswith('.patch'):
+				continue
+			update_copyright(fn, year, pretend=self.options.pretend)
+
 		myupdates, broken_changelog_manifests = self.changelogs(
 					myupdates, mymanifests, myremoved, mychanged, myautoadd,
 					mynew, commitmessage)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 47b5aab..8a757dc 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -395,13 +395,6 @@ def UpdateChangeLog(
 	year = time.strftime('%Y', gmtime)
 	date = time.strftime('%d %b %Y', gmtime)
 
-	# check modified files and the ChangeLog for copyright updates
-	# patches and diffs (identified by .patch and .diff) are excluded
-	for fn in chain(new, changed):
-		if fn.endswith('.diff') or fn.endswith('.patch'):
-			continue
-		update_copyright(os.path.join(pkgdir, fn), year, pretend=pretend)
-
 	cl_path = os.path.join(pkgdir, 'ChangeLog')
 	clold_lines = []
 	clnew_lines = []


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-12 18:10 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     26b72f2f66f25481c9b388a3da78a822c1a67ac2
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: Sat Mar 12 17:57:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=26b72f2f

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 2f717e2..3d23725 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-12 18:10 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     6d6aea01d653b89528ed951e8ac50a60f70c7c20
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6d6aea01

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-12 18:10 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
  To: gentoo-commits

commit:     df63aa82642b47dc81770d22634c49afe1104c81
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=df63aa82

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1086a75..04dc86e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-11  0:41 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-11  0:41 UTC (permalink / raw
  To: gentoo-commits

commit:     d102ba3153bfd511b23e081f3c2277afb620a4b5
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 10 23:47:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d102ba31

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-11  0:41 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-11  0:41 UTC (permalink / raw
  To: gentoo-commits

commit:     b718d9b22d54906d028c4e28471da5012e96d88f
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: Thu Mar 10 23:47:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b718d9b2

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 2f717e2..3d23725 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-11  0:41 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-11  0:41 UTC (permalink / raw
  To: gentoo-commits

commit:     bad9232e3d85b901a33dfb88cf9d49fbe915a275
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 10 23:47:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bad9232e

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1086a75..04dc86e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-07 21:53 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     89abcf8e4a66a51bb7b621769889ec5ebb64cacd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 21:20:54 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=89abcf8e

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 467e6e1..9b42696 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-07 21:53 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     83303ff0602a1022df7e7d88d2686b5f1805fadf
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 21:21:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=83303ff0

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-03-07 21:53 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     2ee1570a70dcad357b65d49cf229bd089a0e279b
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 Mar  7 21:21:33 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2ee1570a

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 da9dcac..1b49061 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-02-01  7:55 Zac Medico
  0 siblings, 0 replies; 216+ messages in thread
From: Zac Medico @ 2016-02-01  7:55 UTC (permalink / raw
  To: gentoo-commits

commit:     a6a50adf336ca98044f0f981fad77efde078daef
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 07:47:49 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb  1 07:54:15 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a6a50adf

repoman/actions.py: fix copyright update (bug 405017)

The Actions.perform method failed to update copyright for new and
changed files with --echangelog=n, so fix it to handle this case.

X-Gentoo-Bug: 405017
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=405017

 pym/repoman/actions.py   | 9 +++++++++
 pym/repoman/utilities.py | 7 -------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index fbcef6e..1660381 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -11,6 +11,7 @@ import signal
 import subprocess
 import sys
 import tempfile
+import time
 from itertools import chain
 
 from _emerge.UserQuery import UserQuery
@@ -26,6 +27,7 @@ from portage.process import find_binary, spawn
 from portage.util import writemsg_level
 
 from repoman._subprocess import repoman_getstatusoutput
+from repoman.copyrights import update_copyright
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
 from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -114,6 +116,13 @@ class Actions(object):
 
 		commitmessage = commitmessage.rstrip()
 
+		# Update copyright for new and changed files
+		year = time.strftime('%Y', time.gmtime())
+		for fn in chain(mynew, mychanged):
+			if fn.endswith('.diff') or fn.endswith('.patch'):
+				continue
+			update_copyright(fn, year, pretend=self.options.pretend)
+
 		myupdates, broken_changelog_manifests = self.changelogs(
 					myupdates, mymanifests, myremoved, mychanged, myautoadd,
 					mynew, commitmessage)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 47b5aab..8a757dc 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -395,13 +395,6 @@ def UpdateChangeLog(
 	year = time.strftime('%Y', gmtime)
 	date = time.strftime('%d %b %Y', gmtime)
 
-	# check modified files and the ChangeLog for copyright updates
-	# patches and diffs (identified by .patch and .diff) are excluded
-	for fn in chain(new, changed):
-		if fn.endswith('.diff') or fn.endswith('.patch'):
-			continue
-		update_copyright(os.path.join(pkgdir, fn), year, pretend=pretend)
-
 	cl_path = os.path.join(pkgdir, 'ChangeLog')
 	clold_lines = []
 	clnew_lines = []


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-02-01  7:21 Zac Medico
  0 siblings, 0 replies; 216+ messages in thread
From: Zac Medico @ 2016-02-01  7:21 UTC (permalink / raw
  To: gentoo-commits

commit:     37e0e67a673286f519a689586087960505898c43
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  1 07:19:49 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb  1 07:19:49 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=37e0e67a

repoman/actions: fix headerstring UnboundLocalError

 pym/repoman/actions.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index d7f343b..fbcef6e 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -566,6 +566,7 @@ class Actions(object):
 
 
 	def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
+		headerstring = None
 		if self.vcs_settings.vcs == 'cvs':
 			headerstring = "'\$(Header|Id).*\$'"
 		elif self.vcs_settings.vcs == "svn":
@@ -606,10 +607,11 @@ class Actions(object):
 
 				headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
 
-			myout = repoman_getstatusoutput(
-				"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-			if myout[0] == 0:
-				myheaders.append(myfile)
+			if headerstring is not None:
+				myout = repoman_getstatusoutput(
+					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
+				if myout[0] == 0:
+					myheaders.append(myfile)
 
 		print("%s have headers that will change." % green(str(len(myheaders))))
 		print(


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-31 20:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     014910ba6d7db13763d5de1bf1a4f7d9eb59d38c
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:24 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=014910ba

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-31 20:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     d3eaf1d45b306ff1835c12e1005e04a207fbca86
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: Sat Jan 30 20:25:24 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d3eaf1d4

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 da9dcac..1b49061 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-31 20:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     8f86d04ffd500acb7edb72b8900a8506c6048e1a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8f86d04f

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 467e6e1..9b42696 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  8:00 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     e7c06075a76b572006f3d6e83ec50001db2e1f59
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e7c06075

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  8:00 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     9ff97354f8b8666b1b391422e43618cf55894d7e
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: Sat Jan 30 07:50:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ff97354

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4dd5408..8623812 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  8:00 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     024d955e3f0fdab6942aaeb323e1e90051028b54
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:19 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=024d955e

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 804a3f2..c8539cb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  6:58 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  6:58 UTC (permalink / raw
  To: gentoo-commits

commit:     2918b96c51f63a80cc71b81829b6178fbd8df204
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 06:51:58 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2918b96c

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  6:58 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  6:58 UTC (permalink / raw
  To: gentoo-commits

commit:     0664515fa7da71204eafdb832e9be74edfee0be9
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: Sat Jan 30 06:51:58 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0664515f

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4dd5408..8623812 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):
@@ -200,7 +200,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)
 
 	def scan_pkgs(self, can_force):
@@ -208,7 +208,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 = []
@@ -236,7 +236,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:
@@ -300,7 +300,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
@@ -309,14 +309,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
@@ -324,22 +327,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-30  6:58 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-30  6:58 UTC (permalink / raw
  To: gentoo-commits

commit:     76925cef8f8adfacea258c2110450fdfd985c1b9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 06:33:56 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=76925cef

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 804a3f2..c8539cb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-29  5:01 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-29  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     4a00a46a7c311c94a064ca6cebdfff909611e465
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:53:00 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4a00a46a

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-29  5:01 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-29  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     b4ba99b7bee8417b9ade9b3c2f32f89d5ab01382
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: Fri Jan 29 04:53:00 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4ba99b7

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 e486282..e286a81 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):
@@ -200,7 +200,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
@@ -210,7 +210,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 = []
@@ -238,7 +238,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:
@@ -302,7 +302,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
@@ -311,14 +311,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
@@ -326,22 +329,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-29  5:01 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-29  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     12346b41156e10b5fa0fb773d1d74309581e0e6a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:58 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=12346b41

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bec943d..b330fe0 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-27 23:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     a6ace81fe795174b65cc13c54c1d46ab19c257f9
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: Wed Jan 27 22:44:25 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a6ace81f

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 e486282..e286a81 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):
@@ -200,7 +200,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
@@ -210,7 +210,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 = []
@@ -238,7 +238,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:
@@ -302,7 +302,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
@@ -311,14 +311,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
@@ -326,22 +329,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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-27 23:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     5512df3af943c4f5c086a43874b1459ec270b785
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5512df3a

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-27 23:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     9e5d6da80f4f9d903f11319c00fd449ebb8c4942
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:23 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e5d6da8

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bec943d..b330fe0 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -286,7 +286,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -327,8 +327,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -538,7 +536,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-23  1:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-23  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     4b1a24644a94f5d2aebe27572e0b4c374ab19f57
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: Sat Jan 23 01:38:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4b1a2464

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4cc2e67..c30c94e 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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-23  1:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-23  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     c8c9c3d59737ef226494e8e8d013d2cf614e98b1
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:38:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c8c9c3d5

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-23  1:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-23  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     5b06bca70834c10867e8ca98dc65d1b6ef973c39
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:30:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5b06bca7

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-22 20:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     1390734ebb6c31de12e5aeef74128eb3c54febf3
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:15 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1390734e

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f1fa53a..e95ad41 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -19,6 +19,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -143,7 +144,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-22 20:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     c4f6dc3e269cc247889777f72bcb757a86cece68
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: Fri Jan 22 18:44:14 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c4f6dc3e

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4cc2e67..c30c94e 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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-22 20:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     9530916467ff83ea1aa1947db35752cb7daca4d1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:13 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=95309164

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-21 19:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-21 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     89539c68bed5af5a2e2abbf46e64a5dac55cbf4c
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 19:28:20 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=89539c68

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 70c07a8..63e78b2 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -17,6 +17,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -141,7 +142,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-21 19:42 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-21 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     285f9674b1433fd04fdbd6d253668433b4d6be7c
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: Thu Jan 21 19:28:20 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=285f9674

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4cc2e67..c30c94e 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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-21 19:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-21 19:15 UTC (permalink / raw
  To: gentoo-commits

commit:     188ae7b6a4d1e01f061b6516bd79fff40ce0e004
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:51:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 18:53:52 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=188ae7b6

metadata.py: Resolve error when moving metadata.dtd

If DISTDIR and PORTDIR/metadata/dtd live on different filesystems,
os.rename() will fail. Use shutil.move() instead.

 pym/repoman/metadata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 70c07a8..63e78b2 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -17,6 +17,7 @@ from repoman._portage import portage
 
 from portage import exception
 from portage import os
+from portage import shutil
 from portage.output import green
 
 if sys.hexversion >= 0x3000000:
@@ -141,7 +142,7 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
 			except portage.exception.PortageException:
 				pass
 
-			os.rename(metadata_dtd_tmp, metadata_dtd)
+			shutil.move(metadata_dtd_tmp, metadata_dtd)
 		finally:
 			try:
 				os.unlink(metadata_dtd_tmp)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-21 18:30 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
  To: gentoo-commits

commit:     bb2c1e312b681386cc9a4100dea2384e26d71066
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 00:35:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bb2c1e31

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-21 18:30 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
  To: gentoo-commits

commit:     5f7e7ec3861e74073277d43bf5a5ecdb220df132
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: Thu Jan 21 02:53:44 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5f7e7ec3

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 890e034..6921005 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
@@ -37,13 +36,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")
@@ -61,6 +61,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 4cc2e67..c30c94e 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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-18 19:23 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
  To: gentoo-commits

commit:     a7fcddb10817b1dc3dc834125c097a51aa23c6d4
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 18 19:20:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7fcddb1

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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-18 19:23 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
  To: gentoo-commits

commit:     a4c362af74e3f3060a1421566cb14d1307972889
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a4c362af

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-11  8:01 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-11  8:01 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-11  8:01 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-11  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     d688d3bd8f6c8dd18add3b77a9a9662c5367bc1f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d688d3bd

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-11  6:31 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     06dd8b268827accbc089fa198845e57f0a8a21d5
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: Sun Jan 10 22:59:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=06dd8b26

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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-11  6:31 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     2e37f83673e8da4fd0ce97c49fc23d527abb2589
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 01:41:02 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e37f836

repoman/metdata.py: Update metdata.dtd url

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

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 70c07a8..f54c5a4 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -29,7 +29,7 @@ metadata_xml_encoding = 'UTF-8'
 metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
 	% (metadata_xml_encoding,)
 metadata_doctype_name = 'pkgmetadata'
-metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
+metadata_dtd_uri = 'https://www.gentoo.org/dtd/metadata.dtd'
 # force refetch if the local copy creation time is older than this
 metadata_dtd_ctime_interval = 60 * 60 * 24 * 7  # 7 days
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-11  6:31 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     356bea8d0bf0ecb98216532921239ebaea777da5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:36 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=356bea8d

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10 20:17 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     4eade71285b32b32f4ee590ae74cbba2f68c116a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 01:41:02 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4eade712

repoman/metdata.py: Update metdata.dtd url

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

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 70c07a8..f54c5a4 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -29,7 +29,7 @@ metadata_xml_encoding = 'UTF-8'
 metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
 	% (metadata_xml_encoding,)
 metadata_doctype_name = 'pkgmetadata'
-metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
+metadata_dtd_uri = 'https://www.gentoo.org/dtd/metadata.dtd'
 # force refetch if the local copy creation time is older than this
 metadata_dtd_ctime_interval = 60 * 60 * 24 * 7  # 7 days
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10 20:17 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     bb0cafd73c2bb39f45929d15354ef29cebb262c6
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: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bb0cafd7

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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10 20:17 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b014aa2a3c56bd03e82e795f6064f3a7ba81c5e8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b014aa2a

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10  3:26 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10  3:26 UTC (permalink / raw
  To: gentoo-commits

commit:     7e9737c24de6c9f548d1bc7ea90573ff955ca767
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 01:41:02 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7e9737c2

repoman/metdata.py: Update metdata.dtd url

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

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 70c07a8..f54c5a4 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -29,7 +29,7 @@ metadata_xml_encoding = 'UTF-8'
 metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
 	% (metadata_xml_encoding,)
 metadata_doctype_name = 'pkgmetadata'
-metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
+metadata_dtd_uri = 'https://www.gentoo.org/dtd/metadata.dtd'
 # force refetch if the local copy creation time is older than this
 metadata_dtd_ctime_interval = 60 * 60 * 24 * 7  # 7 days
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10  3:26 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10  3:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9ac49c16de562debc7ecd6f7155fef20cc320803
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: Sun Jan 10 03:23:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ac49c16

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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-10  3:26 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-10  3:26 UTC (permalink / raw
  To: gentoo-commits

commit:     2bd3c35cb00033f17b4426e75a30f2d7e73173c3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 21:55:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:51 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2bd3c35c

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/scanner.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6d5416b..d5faded 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -283,7 +283,7 @@ class Scanner(object):
 	def _scan_ebuilds(self, ebuildlist, dynamic_data):
 		xpkg = dynamic_data['xpkg']
 		# detect unused local USE-descriptions
-		used_useflags = set()
+		dynamic_data['used_useflags'] = set()
 
 		for y_ebuild in ebuildlist:
 			dynamic_data['y_ebuild'] = y_ebuild
@@ -324,8 +324,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
-
 			# license checks
 			if not dynamic_data['badlicsyntax']:
 				self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -535,7 +533,7 @@ class Scanner(object):
 		# check if there are unused local USE-descriptions in metadata.xml
 		# (unless there are any invalids, to avoid noise)
 		if dynamic_data['allvalid']:
-			for myflag in dynamic_data['muselist'].difference(used_useflags):
+			for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
 				self.qatracker.add_error(
 					"metadata.warning",
 					"%s/metadata.xml: unused local USE-description: '%s'"


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-06  4:21 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-06  4:21 UTC (permalink / raw
  To: gentoo-commits

commit:     b8183b8bd1f106e58080b2871f4b3f6e6aaf67f5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 19:04:36 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan  6 04:08:25 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b8183b8b

repoman/main.py: Enable verbosity option to be useful for setting the logging level

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

 pym/repoman/main.py    | 13 ++++++++++---
 pym/repoman/scanner.py | 44 ++++++++++++++++++++++----------------------
 2 files changed, 32 insertions(+), 25 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 cfc6802..c4979b8 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):
@@ -196,10 +196,10 @@ class Scanner(object):
 		self.modules = {}
 		pkg_modules = ['manifests', 'isebuild', 'keywords', 'files',
 						'vcsstatus', 'fetches', 'pkgmetadata']
-		print("Initializing pkg class names:", pkg_modules)
+		logging.debug("Initializing pkg class names: %s", pkg_modules)
 		for mod in pkg_modules:
 			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)
 
 	def scan_pkgs(self, can_force):
@@ -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:
@@ -294,14 +294,14 @@ class Scanner(object):
 				]:
 				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: module:", mod[1])
+				logging.debug("scan_ebuilds: module: %s", mod[1])
 				do_it, functions = self.modules[mod[1]].runInEbuilds
-				# 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['continue']:
 							# If we can't access all the metadata then it's totally unsafe to
@@ -310,16 +310,16 @@ class Scanner(object):
 							# metadata leads to false positives for several checks, and false
 							# positives confuse users.
 							y_ebuild_continue = 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 y_ebuild_continue:
 				continue
 
-			print("**** finished ebuild plugin loop, continuing...")
+			logging.debug("Finished ebuild plugin loop, continuing...")
 
 		# Final checks
 		# initialize per pkg plugin final checks here
@@ -328,22 +328,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['continue']:
 						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


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2016-01-06  4:21 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2016-01-06  4:21 UTC (permalink / raw
  To: gentoo-commits

commit:     e644cc33ab94e0465eba5ec8032e7cb070cb5f83
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:27:42 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan  6 04:08:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e644cc33

scanner.py: Rename emodules back to modules

Need this for classes that span both with functions to run in both pkg and ebuilds levels.

 pym/repoman/scanner.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 295d35e..a6a89eb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -301,9 +301,10 @@ class Scanner(object):
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
 				('description', 'DescriptionChecks'),
 				]:
-				mod_class = MODULE_CONTROLLER.get_class(mod[0])
-				print("Initializing class name:", mod_class.__name__)
-				self.modules[mod[1]] = mod_class(**self.kwargs)
+				if mod[0]:
+					mod_class = MODULE_CONTROLLER.get_class(mod[0])
+					print("Initializing class name:", mod_class.__name__)
+					self.modules[mod[1]] = mod_class(**self.kwargs)
 				print("scan_ebuilds: module:", mod[1])
 				do_it, functions = self.modules[mod[1]].runInEbuilds
 				# print("do_it", do_it, "functions", functions)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-12-30 23:38 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-12-30 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     0a58076e2ced55ca8549e2a296d3e69c3a9bbf62
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 29 23:18:38 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Dec 29 23:18:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0a58076e

repoman/repos.py: Fix typo

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

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

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 9a62e05..ca72ac5 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -22,7 +22,7 @@ bad = portage.output.create_color_func("BAD")
 
 
 class RepoSettings(object):
-	'''Holds out repo specific settings'''
+	'''Holds our repo specific settings'''
 
 	def __init__(
 		self, config_root, portdir, portdir_overlay,


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     a0849ae0b37956da75b517b8d0b38c839261f4ba
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:26:39 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a0849ae0

repoman/actions.py: Splitout clear_attic()

 pym/repoman/actions.py | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 974de62..5b55ff8 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -166,23 +166,7 @@ class Actions(object):
 		# inside the $Header path. This code detects the problem and corrects it
 		# so that the Manifest will generate correctly. See bug #169500.
 		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+		self.clear_attic(myheaders)
 
 		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
@@ -817,3 +801,23 @@ class Actions(object):
 			print(
 				"* Files with headers will"
 				" cause the manifests to be changed and committed separately.")
+
+
+	def clear_attic(self, myheaders):
+		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
+		attic_str = b'/Attic/'
+		attic_replace = b'/'
+		for x in myheaders:
+			f = open(
+				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
+				mode='rb')
+			mylines = f.readlines()
+			f.close()
+			modified = False
+			for i, line in enumerate(mylines):
+				if cvs_header_re.match(line) is not None and \
+					attic_str in line:
+					mylines[i] = line.replace(attic_str, attic_replace)
+					modified = True
+			if modified:
+				portage.util.write_atomic(x, b''.join(mylines), mode='wb')


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     458d0ca69f6e1d9fb0b673e48d86211a591581ee
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:25:28 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=458d0ca6

repoman/actions.py: Split out the changelog code to it's own function

 pym/repoman/actions.py | 191 +++++++++++++++++++++++++------------------------
 1 file changed, 99 insertions(+), 92 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index e9bf147..d70dd82 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -132,102 +132,14 @@ class Actions(object):
 				print("* no commit message?  aborting commit.")
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
+
+		myupdates, broken_changelog_manifests = self.changelogs(
+					myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, commitmessage)
 
 		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
-		broken_changelog_manifests = []
-		if self.options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=self.repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = self.repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if self.scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if self.scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in self.scanner.changed.changelogs
-				if changelog_modified and self.options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and self.options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=self.options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if self.options.ask and not self.options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					self.repoman_settings["O"] = checkdir
-					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [self.vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if self.options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
 		if self.vcs_settings.vcs not in ('cvs', 'svn'):
@@ -800,3 +712,98 @@ class Actions(object):
 				commit_footer += ", unsigned Manifest commit"
 			commit_footer += ")"
 		return commit_footer
+
+
+	def changelogs(self, myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, changelog_msg):
+		broken_changelog_manifests = []
+		if self.options.echangelog in ('y', 'force'):
+			logging.info("checking for unmodified ChangeLog files")
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, mymanifests, myremoved),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				catdir, pkgdir = x.split("/")
+				checkdir = self.repo_settings.repodir + "/" + x
+				checkdir_relative = ""
+				if self.scanner.repolevel < 3:
+					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+				if self.scanner.repolevel < 2:
+					checkdir_relative = os.path.join(catdir, checkdir_relative)
+				checkdir_relative = os.path.join(".", checkdir_relative)
+
+				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
+					continue
+
+				# get changes for this package
+				cdrlen = len(checkdir_relative)
+				check_relative = lambda e: e.startswith(checkdir_relative)
+				split_relative = lambda e: e[cdrlen:]
+				clnew = list(map(split_relative, filter(check_relative, mynew)))
+				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
+				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
+
+				# Skip ChangeLog generation if only the Manifest was modified,
+				# as discussed in bug #398009.
+				nontrivial_cl_files = set()
+				nontrivial_cl_files.update(clnew, clremoved, clchanged)
+				nontrivial_cl_files.difference_update(['Manifest'])
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
+					continue
+
+				new_changelog = utilities.UpdateChangeLog(
+					checkdir_relative, committer_name, changelog_msg,
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
+					catdir, pkgdir,
+					new=clnew, removed=clremoved, changed=clchanged,
+					pretend=self.options.pretend)
+				if new_changelog is None:
+					writemsg_level(
+						"!!! Updating the ChangeLog failed\n",
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(1)
+
+				# if the ChangeLog was just created, add it to vcs
+				if new_changelog:
+					myautoadd.append(changelog_path)
+					# myautoadd is appended to myupdates below
+				else:
+					myupdates.append(changelog_path)
+
+				if self.options.ask and not self.options.pretend:
+					# regenerate Manifest for modified ChangeLog (bug #420735)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
+				else:
+					broken_changelog_manifests.append(x)
+
+		if myautoadd:
+			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
+			add_cmd = [self.vcs_settings.vcs, "add"]
+			add_cmd += myautoadd
+			if self.options.pretend:
+				portage.writemsg_stdout(
+					"(%s)\n" % " ".join(add_cmd),
+					noiselevel=-1)
+			else:
+
+				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+					not os.path.isabs(add_cmd[0]):
+					# Python 3.1 _execvp throws TypeError for non-absolute executable
+					# path passed as bytes (see http://bugs.python.org/issue8513).
+					fullname = find_binary(add_cmd[0])
+					if fullname is None:
+						raise portage.exception.CommandNotFound(add_cmd[0])
+					add_cmd[0] = fullname
+
+				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
+				retcode = subprocess.call(add_cmd)
+				if retcode != os.EX_OK:
+					logging.error(
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
+					sys.exit(retcode)
+
+			myupdates += myautoadd
+		return myupdates, broken_changelog_manifests


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     befc99fa5ff79af530be6e3126a300e182866a2f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:07:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=befc99fa

repoman/actions.py: Break out changes detectection into sudo vcs plugins

 pym/repoman/actions.py | 215 +++++++++++++++++++++++++++----------------------
 1 file changed, 120 insertions(+), 95 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 611c0dd..1f70815 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -74,102 +74,9 @@ class Actions(object):
 
 		self._vcs_deleted(mydeleted)
 
-		if self.vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if self.vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif self.vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if self.vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if self.vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		changes = self.get_vcs_changed(mydeleted)
 
-		if self.vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
+		mynew, mychanged, myremoved, no_expansion, expansion = changes
 
 		# Manifests need to be regenerated after all other commits, so don't commit
 		# them now even if they have changed.
@@ -772,3 +679,121 @@ class Actions(object):
 			print()
 			print()
 			sys.exit(1)
+
+
+	def get_vcs_changed(self, mydeleted):
+		'''Holding function which calls the approriate VCS module for the data'''
+		changed = ([], [], [], [], [])
+		if self.vcs_settings.vcs:
+			vcs_module = getattr(self, '_get_changed_%s_' % self.vcs_settings.vcs)
+			changed = vcs_module(mydeleted)
+			mynew, mychanged, myremoved, no_expansion, expansion = changed
+
+			a_file_is_changed = mychanged or mynew or myremoved
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
+
+			if not (a_file_is_changed or a_file_is_deleted_hg):
+				utilities.repoman_sez(
+					"\"Doing nothing is not always good for QA.\"")
+				print()
+				print("(Didn't find any changed files...)")
+				print()
+				sys.exit(1)
+		return changed
+
+
+	def _get_changed_cvs_(self, mydeleted):
+		mycvstree = cvstree.getentries("./", recursive=1)
+		mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
+		mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
+		myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
+		bin_blob_pattern = re.compile("^-kb$")
+		no_expansion = set(portage.cvstree.findoption(
+			mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_svn_(self, mydeleted):
+		with repoman_popen("svn status") as f:
+			svnstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if (elem[:1] in "MR" or elem[1:2] in "M")]
+		mynew = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("A")]
+		myremoved = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("D")]
+		# Subversion expands keywords specified in svn:keywords properties.
+		with repoman_popen("svn propget -R svn:keywords") as f:
+			props = f.readlines()
+		expansion = dict(
+			("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
+			for prop in props if " - " in prop)
+		no_expansion = set()
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_git_(self, mydeleted):
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=M HEAD") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem[:-1] for elem in mychanged]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=A HEAD") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem[:-1] for elem in mynew]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=D HEAD") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem[:-1] for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_bzr_(self, mydeleted):
+		with repoman_popen("bzr status -S .") as f:
+			bzrstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and elem[1:2] == "M"]
+		mynew = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
+		myremoved = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem.startswith("-")]
+		myremoved = [
+			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+		# Bazaar expands nothing.
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_hg_(self, mydeleted):
+		with repoman_popen("hg status --no-status --modified .") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem.rstrip() for elem in mychanged]
+
+		with repoman_popen("hg status --no-status --added .") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem.rstrip() for elem in mynew]
+
+		with repoman_popen("hg status --no-status --removed .") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     3d375a8705fbf6f0ad6f08ca5ffcadf656c9a8a1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d375a87

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8497833..4dbc09e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
  0 siblings, 1 reply; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     001dd58b705449b08acb34a085673a69b41b697e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=001dd58b

repoman/main.py: Move some functions out of the main code definition

Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.
Add new file gpg.py

 pym/repoman/gpg.py  | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 pym/repoman/main.py | 78 +++++-----------------------------------------------
 2 files changed, 86 insertions(+), 71 deletions(-)

diff --git a/pym/repoman/gpg.py b/pym/repoman/gpg.py
new file mode 100644
index 0000000..a6c4c5f
--- /dev/null
+++ b/pym/repoman/gpg.py
@@ -0,0 +1,79 @@
+
+import errno
+import logging
+import subprocess
+import sys
+
+import portage
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.exception import MissingParameter
+from portage.process import find_binary
+
+
+# Setup the GPG commands
+def gpgsign(filename, repoman_settings, options):
+	gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
+	if gpgcmd in [None, '']:
+		raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
+			" Is make.globals missing?")
+	if "${PORTAGE_GPG_KEY}" in gpgcmd and \
+		"PORTAGE_GPG_KEY" not in repoman_settings:
+		raise MissingParameter("PORTAGE_GPG_KEY is unset!")
+	if "${PORTAGE_GPG_DIR}" in gpgcmd:
+		if "PORTAGE_GPG_DIR" not in repoman_settings:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser("~/.gnupg")
+			logging.info(
+				"Automatically setting PORTAGE_GPG_DIR to '%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+		else:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
+		if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
+			raise portage.exception.InvalidLocation(
+				"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+	gpgvars = {"FILE": filename}
+	for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
+		v = repoman_settings.get(k)
+		if v is not None:
+			gpgvars[k] = v
+	gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
+	if options.pretend:
+		print("(" + gpgcmd + ")")
+	else:
+		# Encode unicode manually for bug #310789.
+		gpgcmd = portage.util.shlex_split(gpgcmd)
+
+		if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+			not os.path.isabs(gpgcmd[0]):
+			# Python 3.1 _execvp throws TypeError for non-absolute executable
+			# path passed as bytes (see http://bugs.python.org/issue8513).
+			fullname = find_binary(gpgcmd[0])
+			if fullname is None:
+				raise portage.exception.CommandNotFound(gpgcmd[0])
+			gpgcmd[0] = fullname
+
+		gpgcmd = [
+			_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
+			for arg in gpgcmd]
+		rValue = subprocess.call(gpgcmd)
+		if rValue == os.EX_OK:
+			os.rename(filename + ".asc", filename)
+		else:
+			raise portage.exception.PortageException(
+				"!!! gpg exited with '" + str(rValue) + "' status")
+
+def need_signature(filename):
+	try:
+		with open(
+			_unicode_encode(
+				filename, encoding=_encodings['fs'], errors='strict'),
+			'rb') as f:
+			return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
+	except IOError as e:
+		if e.errno in (errno.ENOENT, errno.ESTALE):
+			return False
+		raise

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 4dbc09e..e276aba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -38,7 +38,6 @@ import portage.repository.config
 from portage import cvstree, normalize_path
 from portage import util
 from portage.dep import Atom
-from portage.exception import MissingParameter
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -67,6 +66,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (
@@ -97,6 +97,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
+
+def sort_key(item):
+	return item[2].sub_path
+
+
 # Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
 # behave incrementally.
 repoman_incrementals = tuple(
@@ -673,9 +678,6 @@ for xpkg in effective_scanlist:
 			relevant_profiles.extend(
 				(keyword, groups, prof) for prof in profiles[arch])
 
-		def sort_key(item):
-			return item[2].sub_path
-
 		relevant_profiles.sort(key=sort_key)
 
 		for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1443,6 @@ else:
 			except OSError:
 				pass
 
-	# Setup the GPG commands
-	def gpgsign(filename):
-		gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
-		if gpgcmd in [None, '']:
-			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
-				" Is make.globals missing?")
-		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
-			"PORTAGE_GPG_KEY" not in repoman_settings:
-			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "${PORTAGE_GPG_DIR}" in gpgcmd:
-			if "PORTAGE_GPG_DIR" not in repoman_settings:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser("~/.gnupg")
-				logging.info(
-					"Automatically setting PORTAGE_GPG_DIR to '%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-			else:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
-			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
-				raise portage.exception.InvalidLocation(
-					"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-		gpgvars = {"FILE": filename}
-		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			v = repoman_settings.get(k)
-			if v is not None:
-				gpgvars[k] = v
-		gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
-		if options.pretend:
-			print("(" + gpgcmd + ")")
-		else:
-			# Encode unicode manually for bug #310789.
-			gpgcmd = portage.util.shlex_split(gpgcmd)
-
-			if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-				not os.path.isabs(gpgcmd[0]):
-				# Python 3.1 _execvp throws TypeError for non-absolute executable
-				# path passed as bytes (see http://bugs.python.org/issue8513).
-				fullname = find_binary(gpgcmd[0])
-				if fullname is None:
-					raise portage.exception.CommandNotFound(gpgcmd[0])
-				gpgcmd[0] = fullname
-
-			gpgcmd = [
-				_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
-				for arg in gpgcmd]
-			rValue = subprocess.call(gpgcmd)
-			if rValue == os.EX_OK:
-				os.rename(filename + ".asc", filename)
-			else:
-				raise portage.exception.PortageException(
-					"!!! gpg exited with '" + str(rValue) + "' status")
-
-	def need_signature(filename):
-		try:
-			with open(
-				_unicode_encode(
-					filename, encoding=_encodings['fs'], errors='strict'),
-				'rb') as f:
-				return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
-		except IOError as e:
-			if e.errno in (errno.ENOENT, errno.ESTALE):
-				return False
-			raise
-
 	# When files are removed and re-added, the cvs server will put /Attic/
 	# inside the $Header path. This code detects the problem and corrects it
 	# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1493,7 @@ else:
 				manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 				if not need_signature(manifest_path):
 					continue
-				gpgsign(manifest_path)
+				gpgsign(manifest_path, repoman_settings, options)
 		except portage.exception.PortageException as e:
 			portage.writemsg("!!! %s\n" % str(e))
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     4d38fd403a374a07def13421cd276c0b2de84605
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:34:01 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d38fd40

repoman/actions.py: Split out get_new_commit_message()

 pym/repoman/actions.py | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 4f516da..9d97b20 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -111,24 +111,8 @@ class Actions(object):
 				else:
 					raise
 		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if self.scanner.repolevel > 1:
-				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+			commitmessage = self.get_new_commit_message(qa_output)
 
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 
 		myupdates, broken_changelog_manifests = self.changelogs(
@@ -826,3 +810,24 @@ class Actions(object):
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")
 			self.repo_settings.sign_manifests = False
 
+
+	def get_new_commit_message(self, qa_output):
+		msg_prefix = ""
+		if self.scanner.repolevel > 1:
+			msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+
+		try:
+			editor = os.environ.get("EDITOR")
+			if editor and utilities.editor_is_executable(editor):
+				commitmessage = utilities.get_commit_message_with_editor(
+					editor, message=qa_output, prefix=msg_prefix)
+			else:
+				commitmessage = utilities.get_commit_message_with_stdin()
+		except KeyboardInterrupt:
+			logging.fatal("Interrupted; exiting...")
+			sys.exit(1)
+		if (not commitmessage or not commitmessage.strip()
+				or commitmessage.strip() == msg_prefix):
+			print("* no commit message?  aborting commit.")
+			sys.exit(1)
+		return commitmessage


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     f702bf4c75b03b19e214c6d9f5a376afa647dce5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:59:10 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f702bf4c

repoman/actions.py: split out a manifest function

 pym/repoman/actions.py | 110 +++++++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index d70dd82..405a8c7 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -330,59 +330,7 @@ class Actions(object):
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if self.options.pretend and self.vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(self.vcs_settings.vcs)
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			if self.vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+		self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage)
 
 		print()
 		if self.vcs_settings.vcs:
@@ -807,3 +755,59 @@ class Actions(object):
 
 			myupdates += myautoadd
 		return myupdates, broken_changelog_manifests
+
+
+	def add_manifest(self, mymanifests, myheaders, myupdates, myremoved,
+					commitmessage):
+		myfiles = mymanifests[:]
+		# If there are no header (SVN/CVS keywords) changes in
+		# the files, this Manifest commit must include the
+		# other (yet uncommitted) files.
+		if not myheaders:
+			myfiles += myupdates
+			myfiles += myremoved
+		myfiles.sort()
+
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		commit_cmd = []
+		if self.options.pretend and self.vcs_settings.vcs is None:
+			# substitute a bogus value for pretend output
+			commit_cmd.append("cvs")
+		else:
+			commit_cmd.append(self.vcs_settings.vcs)
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		if self.vcs_settings.vcs == "hg":
+			commit_cmd.extend(["--logfile", commitmessagefile])
+			commit_cmd.extend(myfiles)
+		else:
+			commit_cmd.extend(["-F", commitmessagefile])
+			commit_cmd.extend(f.lstrip("./") for f in myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
+						not git_supports_gpg_sign():
+						# Inform user that newer git is needed (bug #403323).
+						logging.error(
+							"Git >=1.7.9 is required for signed commits!")
+
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     9c022fd0fe3d40a5c80e2362da48035d03f237f7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:43:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9c022fd0

repoamn/repos.py: Indent fix

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index de99fdf..f16bf7a 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -128,29 +128,29 @@ class RepoSettings(object):
 				sys.exit(1)
 
 	def _add_repo(self, config_root, portdir_overlay):
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
-				portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				self.repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			self.repoman_settings = portage.config(
-				config_root=config_root, local_config=False,
-				repositories=self.repositories)
+		self.repo_conf = portage.repository.config
+		self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
+			portdir_overlay)[0]
+		self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+		if self.layout_conf_data['repo-name']:
+			self.repo_name = self.layout_conf_data['repo-name']
+		tmp_conf_file = io.StringIO(textwrap.dedent("""
+			[%s]
+			location = %s
+			""") % (self.repo_name, portdir_overlay))
+		# Ensure that the repository corresponding to $PWD overrides a
+		# repository of the same name referenced by the existing PORTDIR
+		# or PORTDIR_OVERLAY settings.
+		self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+			self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+			portage._shell_quote(portdir_overlay))
+		self.repositories = self.repo_conf.load_repository_config(
+			self.repoman_settings, extra_files=[tmp_conf_file])
+		# We have to call the config constructor again so that attributes
+		# dependent on config.repositories are initialized correctly.
+		self.repoman_settings = portage.config(
+			config_root=config_root, local_config=False,
+			repositories=self.repositories)
 
 	##########
 	# future vcs plugin functions


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     3f47be32adcee89a34234d594b04e81089ea85ce
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:25:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3f47be32

repoman/actions.py: Split out thick_manifest()

 pym/repoman/actions.py | 101 +++++++++++++++++++++++++------------------------
 1 file changed, 52 insertions(+), 49 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index af50c1b..974de62 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -146,55 +146,7 @@ class Actions(object):
 			# committed in one big commit at the end.
 			print()
 		elif not self.repo_settings.repo_config.thin_manifest:
-			if self.vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif self.vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if self.vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif self.vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
+			self.thick_manifest(myupdates, myheaders, no_expansion, expansion)
 
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
@@ -814,3 +766,54 @@ class Actions(object):
 			except OSError:
 				pass
 
+
+	def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
+			if self.vcs_settings.vcs == 'cvs':
+				headerstring = "'\$(Header|Id).*\$'"
+			elif self.vcs_settings.vcs == "svn":
+				svn_keywords = dict((k.lower(), k) for k in [
+					"Rev",
+					"Revision",
+					"LastChangedRevision",
+					"Date",
+					"LastChangedDate",
+					"Author",
+					"LastChangedBy",
+					"URL",
+					"HeadURL",
+					"Id",
+					"Header",
+				])
+
+			for myfile in myupdates:
+
+				# for CVS, no_expansion contains files that are excluded from expansion
+				if self.vcs_settings.vcs == "cvs":
+					if myfile in no_expansion:
+						continue
+
+				# for SVN, expansion contains files that are included in expansion
+				elif self.vcs_settings.vcs == "svn":
+					if myfile not in expansion:
+						continue
+
+					# Subversion keywords are case-insensitive
+					# in svn:keywords properties,
+					# but case-sensitive in contents of files.
+					enabled_keywords = []
+					for k in expansion[myfile]:
+						keyword = svn_keywords.get(k.lower())
+						if keyword is not None:
+							enabled_keywords.append(keyword)
+
+					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
+
+				myout = repoman_getstatusoutput(
+					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
+				if myout[0] == 0:
+					myheaders.append(myfile)
+
+			print("%s have headers that will change." % green(str(len(myheaders))))
+			print(
+				"* Files with headers will"
+				" cause the manifests to be changed and committed separately.")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     6a7e4358e3fbf359d77623b007c1a68c901a1790
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:10:03 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6a7e4358

repoman/actions.py: Split out priming_commit()

 pym/repoman/actions.py | 91 ++++++++++++++++++++++++++------------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 2318ce2..af50c1b 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -208,49 +208,7 @@ class Actions(object):
 		# will change and need a priming commit before the Manifest
 		# can be committed.
 		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [self.vcs_settings.vcs]
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+			self.priming_commit(myupdates, myremoved, commitmessage)
 
 		# When files are removed and re-added, the cvs server will put /Attic/
 		# inside the $Header path. This code detects the problem and corrects it
@@ -809,3 +767,50 @@ class Actions(object):
 				os.unlink(commitmessagefile)
 			except OSError:
 				pass
+
+
+	def priming_commit(self, myupdates, myremoved, commitmessage):
+		myfiles = myupdates + myremoved
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		separator = '-' * 78
+
+		print()
+		print(green("Using commit message:"))
+		print(green(separator))
+		print(commitmessage)
+		print(green(separator))
+		print()
+
+		# Having a leading ./ prefix on file paths can trigger a bug in
+		# the cvs server when committing files to multiple directories,
+		# so strip the prefix.
+		myfiles = [f.lstrip("./") for f in myfiles]
+
+		commit_cmd = [self.vcs_settings.vcs]
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		commit_cmd.extend(["-F", commitmessagefile])
+		commit_cmd.extend(myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     9f63c395ee23b00d77d00e667a28624de5baff49
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 15:29:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9f63c395

repoman: Move the primary checks loop to it's own class and file

Only minimal changes were done for this initial move.
The _scan_ebuilds() needs major hacking up into manageable chunks.
Clean out code separation demarcation lines
These lines were originally used to mark places where code was removed.
And replaced with a class instance and/or function call.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 756 ++-----------------------------------------------
 pym/repoman/scanner.py | 715 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 743 insertions(+), 728 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e3d0472..2b2f91d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,7 +4,6 @@
 
 from __future__ import print_function, unicode_literals
 
-import copy
 import errno
 import io
 import logging
@@ -15,7 +14,6 @@ import sys
 import tempfile
 import platform
 from itertools import chain
-from pprint import pformat
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -30,14 +28,12 @@ portage._disable_legacy_globals()
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.Package import Package
 from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree, normalize_path
+from portage import cvstree
 from portage import util
-from portage.dep import Atom
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -47,40 +43,18 @@ from portage.util import writemsg_level
 from portage.package.ebuild.digestgen import digestgen
 
 from repoman.argparser import parse_args
-from repoman.checks.directories.files import FileChecks
-from repoman.checks.ebuilds.checks import run_checks, checks_init
-from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.checks.ebuilds.fetches import FetchChecks
-from repoman.checks.ebuilds.keywords import KeywordChecks
-from repoman.checks.ebuilds.isebuild import IsEbuild
-from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
-from repoman.checks.ebuilds.manifests import Manifests
-from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
-from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
-from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
-from repoman.checks.ebuilds.variables.eapi import EAPIChecks
-from repoman.checks.ebuilds.variables.license import LicenseChecks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
-from repoman.ebuild import Ebuild
+from repoman.checks.ebuilds.checks import checks_init
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats, missingvars,
-	suspect_virtual, suspect_rdepend)
-from repoman.qa_tracker import QATracker
-from repoman.repos import RepoSettings, repo_metadata
-from repoman.scan import Changes, scan
+	qawarnings, qacats)
+from repoman.repos import RepoSettings
+from repoman.scanner import Scanner
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (
 	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-from repoman.vcs.vcsstatus import VCSStatus
 
 
 if sys.hexversion >= 0x3000000:
@@ -90,21 +64,11 @@ util.initialize_logger()
 
 bad = create_color_func("BAD")
 
-live_eclasses = portage.const.LIVE_ECLASSES
-non_ascii_re = re.compile(r'[^\x00-\x7f]')
-
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
-def sort_key(item):
-	return item[2].sub_path
-
 
 def repoman_main(argv):
-	# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
-	# behave incrementally.
-	repoman_incrementals = tuple(
-		x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
 	config_root = os.environ.get("PORTAGE_CONFIGROOT")
 	repoman_settings = portage.config(config_root=config_root, local_config=False)
 
@@ -142,30 +106,9 @@ def repoman_main(argv):
 	repo_settings = RepoSettings(
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
-
 	repoman_settings = repo_settings.repoman_settings
-
 	portdb = repo_settings.portdb
 
-	if options.echangelog is None and repo_settings.repo_config.update_changelog:
-		options.echangelog = 'y'
-
-	if vcs_settings.vcs is None:
-		options.echangelog = 'n'
-
-	# The --echangelog option causes automatic ChangeLog generation,
-	# which invalidates changelog.ebuildadded and changelog.missing
-	# checks.
-	# Note: Some don't use ChangeLogs in distributed SCMs.
-	# It will be generated on server side from scm log,
-	# before package moves to the rsync server.
-	# This is needed because they try to avoid merge collisions.
-	# Gentoo's Council decided to always use the ChangeLog file.
-	# TODO: shouldn't this just be switched on the repo, iso the VCS?
-	is_echangelog_enabled = options.echangelog in ('y', 'force')
-	vcs_settings.vcs_is_cvs_or_svn = vcs_settings.vcs in ('cvs', 'svn')
-	check_changelog = not is_echangelog_enabled and vcs_settings.vcs_is_cvs_or_svn
-
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
 
@@ -178,663 +121,16 @@ def repoman_main(argv):
 	env = os.environ.copy()
 	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
 
-	categories = []
-	for path in repo_settings.repo_config.eclass_db.porttrees:
-		categories.extend(portage.util.grabfile(
-			os.path.join(path, 'profiles', 'categories')))
-	repoman_settings.categories = frozenset(
-		portage.util.stack_lists([categories], incremental=1))
-	categories = repoman_settings.categories
-
-	portdb.settings = repoman_settings
-	# We really only need to cache the metadata that's necessary for visibility
-	# filtering. Anything else can be discarded to reduce memory consumption.
-	portdb._aux_cache_keys.clear()
-	portdb._aux_cache_keys.update(
-		["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
-
-	reposplit = myreporoot.split(os.path.sep)
-	repolevel = len(reposplit)
-
-	###################
-	commitmessage = None
-	if options.mode == 'commit':
-		repochecks.commit_check(repolevel, reposplit)
-		repochecks.conflict_check(vcs_settings, options)
-
-	###################
-
-	# Make startdir relative to the canonical repodir, so that we can pass
-	# it to digestgen and it won't have to be canonicalized again.
-	if repolevel == 1:
-		startdir = repo_settings.repodir
-	else:
-		startdir = normalize_path(mydir)
-		startdir = os.path.join(
-			repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-	###################
-
-
-	# get lists of valid keywords, licenses, and use
-	new_data = repo_metadata(repo_settings.portdb, repoman_settings)
-	kwlist, liclist, uselist, profile_list, \
-		global_pmaskdict, liclist_deprecated = new_data
-
-	repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
-	repoman_settings.backup_changes('PORTAGE_ARCHLIST')
-
-	####################
-
-	profiles = setup_profile(profile_list)
-
-	####################
-
-	check_profiles(profiles, repoman_settings.archlist())
-
-	####################
-
-	scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
-
-	####################
-
-	dev_keywords = dev_profile_keywords(profiles)
-
-	qatracker = QATracker()
-
-
-	if options.mode == "manifest":
-		pass
-	elif options.pretend:
-		print(green("\nRepoMan does a once-over of the neighborhood..."))
-	else:
-		print(green("\nRepoMan scours the neighborhood..."))
-
-	#####################
-
-	changed = Changes(options)
-	changed.scan(vcs_settings)
-
-	######################
-
-	have_pmasked = False
-	have_dev_keywords = False
-	dofail = 0
-
-	# NOTE: match-all caches are not shared due to potential
-	# differences between profiles in _get_implicit_iuse.
-	arch_caches = {}
-	arch_xmatch_caches = {}
-	shared_xmatch_caches = {"cp-list": {}}
-
-	include_arches = None
-	if options.include_arches:
-		include_arches = set()
-		include_arches.update(*[x.split() for x in options.include_arches])
-
-	# Disable the "ebuild.notadded" check when not in commit mode and
-	# running `svn status` in every package dir will be too expensive.
-
-	check_ebuild_notadded = not \
-		(vcs_settings.vcs == "svn" and repolevel < 3 and options.mode != "commit")
-
-	effective_scanlist = scanlist
-	if options.if_modified == "y":
-		effective_scanlist = sorted(vcs_files_to_cps(
-			chain(changed.changed, changed.new, changed.removed),
-			repolevel, reposplit, categories))
-
-	######################
-	# initialize our checks classes here before the big xpkg loop
-	manifester = Manifests(options, qatracker, repoman_settings)
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
-	filescheck = FileChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	status_check = VCSStatus(vcs_settings, qatracker)
-	fetchcheck = FetchChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
-	thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
-	use_flag_checks = USEFlagChecks(qatracker, uselist)
-	keywordcheck = KeywordChecks(qatracker, options)
-	liveeclasscheck = LiveEclassChecks(qatracker)
-	rubyeclasscheck = RubyEclassChecks(qatracker)
-	eapicheck = EAPIChecks(qatracker, repo_settings)
-	descriptioncheck = DescriptionChecks(qatracker)
-	licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated)
-	restrictcheck = RestrictChecks(qatracker)
-	######################
-
-	for xpkg in effective_scanlist:
-		# ebuilds and digests added to cvs respectively.
-		logging.info("checking package %s" % xpkg)
-		# save memory by discarding xmatch caches from previous package(s)
-		arch_xmatch_caches.clear()
-		eadded = []
-		catdir, pkgdir = xpkg.split("/")
-		checkdir = repo_settings.repodir + "/" + xpkg
-		checkdir_relative = ""
-		if repolevel < 3:
-			checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-		if repolevel < 2:
-			checkdir_relative = os.path.join(catdir, checkdir_relative)
-		checkdir_relative = os.path.join(".", checkdir_relative)
-
-	#####################
-		if manifester.run(checkdir, portdb):
-			continue
-		if not manifester.generated_manifest:
-			manifester.digest_check(xpkg, checkdir)
-	######################
-
-		if options.mode == 'manifest-check':
-			continue
-
-		checkdirlist = os.listdir(checkdir)
-
-	######################
-		pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
-		if is_ebuild.continue_:
-			# If we can't access all the metadata then it's totally unsafe to
-			# commit since there's no way to generate a correct Manifest.
-			# Do not try to do any more QA checks on this package since missing
-			# metadata leads to false positives for several checks, and false
-			# positives confuse users.
-			can_force = False
-			continue
-	######################
-
-		keywordcheck.prepare()
-
-		# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
-		ebuildlist = sorted(pkgs.values())
-		ebuildlist = [pkg.pf for pkg in ebuildlist]
-	#######################
-		filescheck.check(
-			checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new)
-	#######################
-		status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
-		eadded.extend(status_check.eadded)
-
-	#################
-		fetchcheck.check(
-			xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
-	#################
-
-		if check_changelog and "ChangeLog" not in checkdirlist:
-			qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
-	#################
-		pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
-		muselist = frozenset(pkgmeta.musedict)
-	#################
-
-		changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-		changelog_modified = changelog_path in changed.changelogs
-
-		# detect unused local USE-descriptions
-		used_useflags = set()
-
-		for y_ebuild in ebuildlist:
-			##################
-			ebuild = Ebuild(
-				repo_settings, repolevel, pkgdir, catdir, vcs_settings,
-				xpkg, y_ebuild)
-			##################
-
-			if check_changelog and not changelog_modified \
-				and ebuild.ebuild_path in changed.new_ebuilds:
-				qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
-
-			if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded):
-				# ebuild not added to vcs
-				qatracker.add_error(
-					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
-
-	##################
-			if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker):
-				continue
-	###################
-			pkg = pkgs[y_ebuild]
-			if pkg_invalid(pkg, qatracker, ebuild):
-				allvalid = False
-				continue
-
-			myaux = pkg._metadata
-			eapi = myaux["EAPI"]
-			inherited = pkg.inherited
-			live_ebuild = live_eclasses.intersection(inherited)
-
-			#######################
-			eapicheck.check(pkg, ebuild)
-			#######################
-
-			for k, v in myaux.items():
-				if not isinstance(v, basestring):
-					continue
-				m = non_ascii_re.search(v)
-				if m is not None:
-					qatracker.add_error(
-						"variable.invalidchar",
-						"%s: %s variable contains non-ASCII "
-						"character at position %s" %
-						(ebuild.relative_path, k, m.start() + 1))
-
-			if not fetchcheck.src_uri_error:
-				#######################
-				thirdparty.check(myaux, ebuild.relative_path)
-				#######################
-			if myaux.get("PROVIDE"):
-				qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
-
-			for pos, missing_var in enumerate(missingvars):
-				if not myaux.get(missing_var):
-					if catdir == "virtual" and \
-						missing_var in ("HOMEPAGE", "LICENSE"):
-						continue
-					if live_ebuild and missing_var == "KEYWORDS":
-						continue
-					myqakey = missingvars[pos] + ".missing"
-					qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
-			if catdir == "virtual":
-				for var in ("HOMEPAGE", "LICENSE"):
-					if myaux.get(var):
-						myqakey = var + ".virtual"
-						qatracker.add_error(myqakey, ebuild.relative_path)
-
-			#######################
-			descriptioncheck.check(pkg, ebuild)
-			#######################
-
-			keywords = myaux["KEYWORDS"].split()
-
-			ebuild_archs = set(
-				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
-
-			#######################
-			keywordcheck.check(
-				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed,
-				live_ebuild, kwlist, profiles)
-			#######################
-
-			if live_ebuild and repo_settings.repo_config.name == "gentoo":
-				#######################
-				liveeclasscheck.check(
-					pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict)
-				#######################
-
-			if options.ignore_arches:
-				arches = [[
-					repoman_settings["ARCH"], repoman_settings["ARCH"],
-					repoman_settings["ACCEPT_KEYWORDS"].split()]]
-			else:
-				arches = set()
-				for keyword in keywords:
-					if keyword[0] == "-":
-						continue
-					elif keyword[0] == "~":
-						arch = keyword[1:]
-						if arch == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (
-										expanded_arch, "~" + expanded_arch)))
-						else:
-							arches.add((keyword, arch, (arch, keyword)))
-					else:
-						if keyword == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (expanded_arch,)))
-						else:
-							arches.add((keyword, keyword, (keyword,)))
-				if not arches:
-					# Use an empty profile for checking dependencies of
-					# packages that have empty KEYWORDS.
-					arches.add(('**', '**', ('**',)))
-
-			unknown_pkgs = set()
-			baddepsyntax = False
-			badlicsyntax = False
-			badprovsyntax = False
-			# catpkg = catdir + "/" + y_ebuild
-
-			inherited_java_eclass = "java-pkg-2" in inherited or \
-				"java-pkg-opt-2" in inherited
-			inherited_wxwidgets_eclass = "wxwidgets" in inherited
-			# operator_tokens = set(["||", "(", ")"])
-			type_list, badsyntax = [], []
-			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
-				mydepstr = myaux[mytype]
-
-				buildtime = mytype in Package._buildtime_keys
-				runtime = mytype in Package._runtime_keys
-				token_class = None
-				if mytype.endswith("DEPEND"):
-					token_class = portage.dep.Atom
+	# Perform the main checks
+	scanner = Scanner(repo_settings, myreporoot, config_root, options,
+					vcs_settings, mydir, env)
+	qatracker, can_force = scanner.scan_pkgs(can_force)
 
-				try:
-					atoms = portage.dep.use_reduce(
-						mydepstr, matchall=1, flat=True,
-						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
-				except portage.exception.InvalidDependString as e:
-					atoms = None
-					badsyntax.append(str(e))
-
-				if atoms and mytype.endswith("DEPEND"):
-					if runtime and \
-						"test?" in mydepstr.split():
-						qatracker.add_error(
-							mytype + '.suspect',
-							"%s: 'test?' USE conditional in %s" %
-							(ebuild.relative_path, mytype))
-
-					for atom in atoms:
-						if atom == "||":
-							continue
-
-						is_blocker = atom.blocker
-
-						# Skip dependency.unknown for blockers, so that we
-						# don't encourage people to remove necessary blockers,
-						# as discussed in bug 382407. We use atom.without_use
-						# due to bug 525376.
-						if not is_blocker and \
-							not portdb.xmatch("match-all", atom.without_use) and \
-							not atom.cp.startswith("virtual/"):
-							unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
-						if catdir != "virtual":
-							if not is_blocker and \
-								atom.cp in suspect_virtual:
-								qatracker.add_error(
-									'virtual.suspect', ebuild.relative_path +
-									": %s: consider using '%s' instead of '%s'" %
-									(mytype, suspect_virtual[atom.cp], atom))
-							if not is_blocker and \
-								atom.cp.startswith("perl-core/"):
-								qatracker.add_error('dependency.perlcore',
-									ebuild.relative_path +
-									": %s: please use '%s' instead of '%s'" %
-									(mytype,
-									atom.replace("perl-core/","virtual/perl-"),
-									atom))
-
-						if buildtime and \
-							not is_blocker and \
-							not inherited_java_eclass and \
-							atom.cp == "virtual/jdk":
-							qatracker.add_error(
-								'java.eclassesnotused', ebuild.relative_path)
-						elif buildtime and \
-							not is_blocker and \
-							not inherited_wxwidgets_eclass and \
-							atom.cp == "x11-libs/wxGTK":
-							qatracker.add_error(
-								'wxwidgets.eclassnotused',
-								"%s: %ss on x11-libs/wxGTK without inheriting"
-								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
-						elif runtime:
-							if not is_blocker and \
-								atom.cp in suspect_rdepend:
-								qatracker.add_error(
-									mytype + '.suspect',
-									ebuild.relative_path + ": '%s'" % atom)
-
-						if atom.operator == "~" and \
-							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
-							qacat = 'dependency.badtilde'
-							qatracker.add_error(
-								qacat, "%s: %s uses the ~ operator"
-								" with a non-zero revision: '%s'" %
-								(ebuild.relative_path, mytype, atom))
-
-						check_missingslot(atom, mytype, eapi, portdb, qatracker,
-							ebuild.relative_path, myaux)
-
-				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
-			for m, b in zip(type_list, badsyntax):
-				if m.endswith("DEPEND"):
-					qacat = "dependency.syntax"
-				else:
-					qacat = m + ".syntax"
-				qatracker.add_error(
-					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
-
-			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
-			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
-			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
-			badlicsyntax = badlicsyntax > 0
-			badprovsyntax = badprovsyntax > 0
-
-			#################
-			use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
-
-			ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
-			#################
-			rubyeclasscheck.check(pkg, ebuild)
-			#################
-
-			# license checks
-			if not badlicsyntax:
-				#################
-				licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
-				#################
-
-			#################
-			restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
-			#################
-
-			# Syntax Checks
-
-			if not vcs_settings.vcs_preserves_mtime:
-				if ebuild.ebuild_path not in changed.new_ebuilds and \
-					ebuild.ebuild_path not in changed.ebuilds:
-					pkg.mtime = None
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, pkg):
-						qatracker.add_error(
-							check_name, ebuild.relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
-
-			if options.force:
-				# The dep_check() calls are the most expensive QA test. If --force
-				# is enabled, there's no point in wasting time on these since the
-				# user is intent on forcing the commit anyway.
-				continue
-
-			relevant_profiles = []
-			for keyword, arch, groups in arches:
-				if arch not in profiles:
-					# A missing profile will create an error further down
-					# during the KEYWORDS verification.
-					continue
-
-				if include_arches is not None:
-					if arch not in include_arches:
-						continue
-
-				relevant_profiles.extend(
-					(keyword, groups, prof) for prof in profiles[arch])
-
-			relevant_profiles.sort(key=sort_key)
-
-			for keyword, groups, prof in relevant_profiles:
-
-				is_stable_profile = prof.status == "stable"
-				is_dev_profile = prof.status == "dev" and \
-					options.include_dev
-				is_exp_profile = prof.status == "exp" and \
-					options.include_exp_profiles == 'y'
-				if not (is_stable_profile or is_dev_profile or is_exp_profile):
-					continue
+	commitmessage = None
 
-				dep_settings = arch_caches.get(prof.sub_path)
-				if dep_settings is None:
-					dep_settings = portage.config(
-						config_profile_path=prof.abs_path,
-						config_incrementals=repoman_incrementals,
-						config_root=config_root,
-						local_config=False,
-						_unmatched_removal=options.unmatched_removal,
-						env=env, repositories=repoman_settings.repositories)
-					dep_settings.categories = repoman_settings.categories
-					if options.without_mask:
-						dep_settings._mask_manager_obj = \
-							copy.deepcopy(dep_settings._mask_manager)
-						dep_settings._mask_manager._pmaskdict.clear()
-					arch_caches[prof.sub_path] = dep_settings
-
-				xmatch_cache_key = (prof.sub_path, tuple(groups))
-				xcache = arch_xmatch_caches.get(xmatch_cache_key)
-				if xcache is None:
-					portdb.melt()
-					portdb.freeze()
-					xcache = portdb.xcache
-					xcache.update(shared_xmatch_caches)
-					arch_xmatch_caches[xmatch_cache_key] = xcache
-
-				repo_settings.trees[repo_settings.root]["porttree"].settings = dep_settings
-				portdb.settings = dep_settings
-				portdb.xcache = xcache
-
-				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
-				# just in case, prevent config.reset() from nuking these.
-				dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
-				# This attribute is used in dbapi._match_use() to apply
-				# use.stable.{mask,force} settings based on the stable
-				# status of the parent package. This is required in order
-				# for USE deps of unstable packages to be resolved correctly,
-				# since otherwise use.stable.{mask,force} settings of
-				# dependencies may conflict (see bug #456342).
-				dep_settings._parent_stable = dep_settings._isStable(pkg)
-
-				# Handle package.use*.{force,mask) calculation, for use
-				# in dep_check.
-				dep_settings.useforce = dep_settings._use_manager.getUseForce(
-					pkg, stable=dep_settings._parent_stable)
-				dep_settings.usemask = dep_settings._use_manager.getUseMask(
-					pkg, stable=dep_settings._parent_stable)
-
-				if not baddepsyntax:
-					ismasked = not ebuild_archs or \
-						pkg.cpv not in portdb.xmatch("match-visible",
-						Atom("%s::%s" % (pkg.cp, repo_settings.repo_config.name)))
-					if ismasked:
-						if not have_pmasked:
-							have_pmasked = bool(dep_settings._getMaskAtom(
-								pkg.cpv, pkg._metadata))
-						if options.ignore_masked:
-							continue
-						# we are testing deps for a masked package; give it some lee-way
-						suffix = "masked"
-						matchmode = "minimum-all"
-					else:
-						suffix = ""
-						matchmode = "minimum-visible"
-
-					if not have_dev_keywords:
-						have_dev_keywords = \
-							bool(dev_keywords.intersection(keywords))
-
-					if prof.status == "dev":
-						suffix = suffix + "indev"
-
-					for mytype in Package._dep_keys:
-
-						mykey = "dependency.bad" + suffix
-						myvalue = myaux[mytype]
-						if not myvalue:
-							continue
-
-						success, atoms = portage.dep_check(
-							myvalue, portdb, dep_settings,
-							use="all", mode=matchmode, trees=repo_settings.trees)
-
-						if success:
-							if atoms:
-
-								# Don't bother with dependency.unknown for
-								# cases in which *DEPEND.bad is triggered.
-								for atom in atoms:
-									# dep_check returns all blockers and they
-									# aren't counted for *DEPEND.bad, so we
-									# ignore them here.
-									if not atom.blocker:
-										unknown_pkgs.discard(
-											(mytype, atom.unevaluated_atom))
-
-								if not prof.sub_path:
-									# old-style virtuals currently aren't
-									# resolvable with empty profile, since
-									# 'virtuals' mappings are unavailable
-									# (it would be expensive to search
-									# for PROVIDE in all ebuilds)
-									atoms = [
-										atom for atom in atoms if not (
-											atom.cp.startswith('virtual/')
-											and not portdb.cp_list(atom.cp))]
-
-								# we have some unsolvable deps
-								# remove ! deps, which always show up as unsatisfiable
-								atoms = [
-									str(atom.unevaluated_atom)
-									for atom in atoms if not atom.blocker]
-
-								# if we emptied out our list, continue:
-								if not atoms:
-									continue
-								qatracker.add_error(mykey,
-									"%s: %s: %s(%s)\n%s"
-									% (ebuild.relative_path, mytype, keyword, prof,
-										pformat(atoms, indent=6)))
-						else:
-							qatracker.add_error(mykey,
-								"%s: %s: %s(%s)\n%s"
-								% (ebuild.relative_path, mytype, keyword, prof,
-									pformat(atoms, indent=6)))
-
-			if not baddepsyntax and unknown_pkgs:
-				type_map = {}
-				for mytype, atom in unknown_pkgs:
-					type_map.setdefault(mytype, set()).add(atom)
-				for mytype, atoms in type_map.items():
-					qatracker.add_error(
-						"dependency.unknown", "%s: %s: %s"
-						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
-
-		# check if there are unused local USE-descriptions in metadata.xml
-		# (unless there are any invalids, to avoid noise)
-		if allvalid:
-			for myflag in muselist.difference(used_useflags):
-				qatracker.add_error(
-					"metadata.warning",
-					"%s/metadata.xml: unused local USE-description: '%s'"
-					% (xpkg, myflag))
-
-
-	if options.if_modified == "y" and len(effective_scanlist) < 1:
+	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
 	# dofail will be true if we have failed in at least one non-warning category
 	dofail = 0
 	# dowarn will be true if we tripped any warnings
@@ -842,6 +138,10 @@ def repoman_main(argv):
 	# dofull will be true if we should print a "repoman full" informational message
 	dofull = options.mode != 'full'
 
+	# early out for manifest generation
+	if options.mode == "manifest":
+		sys.exit(dofail)
+
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
@@ -884,9 +184,9 @@ def repoman_main(argv):
 	suggest_ignore_masked = False
 	suggest_include_dev = False
 
-	if have_pmasked and not (options.without_mask or options.ignore_masked):
+	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
 		suggest_ignore_masked = True
-	if have_dev_keywords and not options.include_dev:
+	if scanner.have['dev_keywords'] and not options.include_dev:
 		suggest_include_dev = True
 
 	if suggest_ignore_masked or suggest_include_dev:
@@ -1164,8 +464,8 @@ def repoman_main(argv):
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if repolevel > 1:
-				msg_prefix = "/".join(reposplit[1:]) + ": "
+			if scanner.repolevel > 1:
+				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -1196,10 +496,10 @@ def repoman_main(argv):
 			report_options.append("--force")
 		if options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if include_arches is not None:
+		if scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(include_arches)))
+				" ".join(sorted(scanner.include_arches)))
 
 		if vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
@@ -1238,18 +538,18 @@ def repoman_main(argv):
 			committer_name = utilities.get_committer_name(env=repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				catdir, pkgdir = x.split("/")
 				checkdir = repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if repolevel < 3:
+				if scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if repolevel < 2:
+				if scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in changed.changelogs
+				changelog_modified = changelog_path in scanner.changed.changelogs
 				if changelog_modified and options.echangelog != 'force':
 					continue
 
@@ -1459,7 +759,7 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if repolevel == 1:
+		if scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
@@ -1467,7 +767,7 @@ def repoman_main(argv):
 		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 				digestgen(mysettings=repoman_settings, myportdb=portdb)
 
@@ -1480,7 +780,7 @@ def repoman_main(argv):
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					repolevel, reposplit, categories)):
+					scanner.repolevel, scanner.reposplit, scanner.categories)):
 					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
new file mode 100644
index 0000000..44ff33b
--- /dev/null
+++ b/pym/repoman/scanner.py
@@ -0,0 +1,715 @@
+
+import copy
+import io
+import logging
+import re
+import sys
+from itertools import chain
+from pprint import pformat
+
+from _emerge.Package import Package
+
+import portage
+from portage import normalize_path
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.dep import Atom
+from portage.output import green
+from repoman.checks.directories.files import FileChecks
+from repoman.checks.ebuilds.checks import run_checks
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
+from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
+from repoman.checks.ebuilds.fetches import FetchChecks
+from repoman.checks.ebuilds.keywords import KeywordChecks
+from repoman.checks.ebuilds.isebuild import IsEbuild
+from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
+from repoman.checks.ebuilds.manifests import Manifests
+from repoman.check_missingslot import check_missingslot
+from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
+from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
+from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.description import DescriptionChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
+from repoman.checks.ebuilds.variables.license import LicenseChecks
+from repoman.checks.ebuilds.variables.restrict import RestrictChecks
+from repoman.ebuild import Ebuild
+from repoman.modules.commit import repochecks
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
+from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
+from repoman.qa_tracker import QATracker
+from repoman.repos import repo_metadata
+from repoman.scan import Changes, scan
+from repoman.vcs.vcsstatus import VCSStatus
+from repoman.vcs.vcs import vcs_files_to_cps
+
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+def sort_key(item):
+	return item[2].sub_path
+
+
+
+class Scanner(object):
+	'''Primary scan class.  Operates all the small Q/A tests and checks'''
+
+	def __init__(self, repo_settings, myreporoot, config_root, options,
+				vcs_settings, mydir, env):
+		'''Class __init__'''
+		self.repo_settings = repo_settings
+		self.config_root = config_root
+		self.options = options
+		self.vcs_settings = vcs_settings
+		self.env = env
+
+		# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
+		# behave incrementally.
+		self.repoman_incrementals = tuple(
+			x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
+
+		self.categories = []
+		for path in self.repo_settings.repo_config.eclass_db.porttrees:
+			self.categories.extend(portage.util.grabfile(
+				os.path.join(path, 'profiles', 'categories')))
+		self.repo_settings.repoman_settings.categories = frozenset(
+			portage.util.stack_lists([self.categories], incremental=1))
+		self.categories = self.repo_settings.repoman_settings.categories
+
+		self.portdb = repo_settings.portdb
+		self.portdb.settings = self.repo_settings.repoman_settings
+		# We really only need to cache the metadata that's necessary for visibility
+		# filtering. Anything else can be discarded to reduce memory consumption.
+		self.portdb._aux_cache_keys.clear()
+		self.portdb._aux_cache_keys.update(
+			["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
+
+		self.reposplit = myreporoot.split(os.path.sep)
+		self.repolevel = len(self.reposplit)
+
+		if self.options.mode == 'commit':
+			repochecks.commit_check(self.repolevel, self.reposplit)
+			repochecks.conflict_check(self.vcs_settings, self.options)
+
+		# Make startdir relative to the canonical repodir, so that we can pass
+		# it to digestgen and it won't have to be canonicalized again.
+		if self.repolevel == 1:
+			startdir = self.repo_settings.repodir
+		else:
+			startdir = normalize_path(mydir)
+			startdir = os.path.join(
+				self.repo_settings.repodir, *startdir.split(os.sep)[-2 - self.repolevel + 3:])
+
+		# get lists of valid keywords, licenses, and use
+		new_data = repo_metadata(self.portdb, self.repo_settings.repoman_settings)
+		kwlist, liclist, uselist, profile_list, \
+			global_pmaskdict, liclist_deprecated = new_data
+		self.repo_metadata = {
+			'kwlist': kwlist,
+			'liclist': liclist,
+			'uselist': uselist,
+			'profile_list': profile_list,
+			'pmaskdict': global_pmaskdict,
+			'lic_deprecated': liclist_deprecated,
+		}
+
+		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
+		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
+
+		self.profiles = setup_profile(profile_list)
+
+		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+
+		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
+
+		self.dev_keywords = dev_profile_keywords(self.profiles)
+
+		self.qatracker = QATracker()
+
+		if self.options.echangelog is None and self.repo_settings.repo_config.update_changelog:
+			self.options.echangelog = 'y'
+
+		if self.vcs_settings.vcs is None:
+			self.options.echangelog = 'n'
+
+		self.check = {}
+		# The --echangelog option causes automatic ChangeLog generation,
+		# which invalidates changelog.ebuildadded and changelog.missing
+		# checks.
+		# Note: Some don't use ChangeLogs in distributed SCMs.
+		# It will be generated on server side from scm log,
+		# before package moves to the rsync server.
+		# This is needed because they try to avoid merge collisions.
+		# Gentoo's Council decided to always use the ChangeLog file.
+		# TODO: shouldn't this just be switched on the repo, iso the VCS?
+		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
+		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
+		self.check['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+
+		if self.options.mode == "manifest":
+			pass
+		elif self.options.pretend:
+			print(green("\nRepoMan does a once-over of the neighborhood..."))
+		else:
+			print(green("\nRepoMan scours the neighborhood..."))
+
+		self.changed = Changes(self.options)
+		self.changed.scan(self.vcs_settings)
+
+		self.have = {
+			'pmasked': False,
+			'dev_keywords': False,
+		}
+
+		# NOTE: match-all caches are not shared due to potential
+		# differences between profiles in _get_implicit_iuse.
+		self.caches = {
+			'arch': {},
+			'arch_xmatch': {},
+			'shared_xmatch': {"cp-list": {}},
+		}
+
+		self.include_arches = None
+		if self.options.include_arches:
+			self.include_arches = set()
+			self.include_arches.update(*[x.split() for x in self.options.include_arches])
+
+		# Disable the "ebuild.notadded" check when not in commit mode and
+		# running `svn status` in every package dir will be too expensive.
+		self.check['ebuild_notadded'] = not \
+			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
+
+		self.effective_scanlist = scanlist
+		if self.options.if_modified == "y":
+			self.effective_scanlist = sorted(vcs_files_to_cps(
+				chain(self.changed.changed, self.changed.new, self.changed.removed),
+				self.repolevel, self.reposplit, self.categories))
+
+		self.live_eclasses = portage.const.LIVE_ECLASSES
+
+		# initialize our checks classes here before the big xpkg loop
+		self.manifester = Manifests(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.is_ebuild = IsEbuild(self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.qatracker)
+		self.filescheck = FileChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.status_check = VCSStatus(self.vcs_settings, self.qatracker)
+		self.fetchcheck = FetchChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.pkgmeta = PkgMetadata(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
+		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
+		self.keywordcheck = KeywordChecks(self.qatracker, self.options)
+		self.liveeclasscheck = LiveEclassChecks(self.qatracker)
+		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
+		self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
+		self.descriptioncheck = DescriptionChecks(self.qatracker)
+		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
+		self.restrictcheck = RestrictChecks(self.qatracker)
+
+
+	def scan_pkgs(self, can_force):
+		for xpkg in self.effective_scanlist:
+			# ebuilds and digests added to cvs respectively.
+			logging.info("checking package %s" % xpkg)
+			# save memory by discarding xmatch caches from previous package(s)
+			self.caches['arch_xmatch'].clear()
+			self.eadded = []
+			catdir, pkgdir = xpkg.split("/")
+			checkdir = self.repo_settings.repodir + "/" + xpkg
+			checkdir_relative = ""
+			if self.repolevel < 3:
+				checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+			if self.repolevel < 2:
+				checkdir_relative = os.path.join(catdir, checkdir_relative)
+			checkdir_relative = os.path.join(".", checkdir_relative)
+
+			if self.manifester.run(checkdir, self.portdb):
+				continue
+			if not self.manifester.generated_manifest:
+				self.manifester.digest_check(xpkg, checkdir)
+			if self.options.mode == 'manifest-check':
+				continue
+
+			checkdirlist = os.listdir(checkdir)
+
+			self.pkgs, self.allvalid = self.is_ebuild.check(checkdirlist, checkdir, xpkg)
+			if self.is_ebuild.continue_:
+				# If we can't access all the metadata then it's totally unsafe to
+				# commit since there's no way to generate a correct Manifest.
+				# Do not try to do any more QA checks on this package since missing
+				# metadata leads to false positives for several checks, and false
+				# positives confuse users.
+				can_force = False
+				continue
+
+			self.keywordcheck.prepare()
+
+			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+			ebuildlist = sorted(self.pkgs.values())
+			ebuildlist = [pkg.pf for pkg in ebuildlist]
+
+			self.filescheck.check(
+				checkdir, checkdirlist, checkdir_relative, self.changed.changed, self.changed.new)
+
+			self.status_check.check(self.check['ebuild_notadded'], checkdir, checkdir_relative, xpkg)
+			self.eadded.extend(self.status_check.eadded)
+
+			self.fetchcheck.check(
+				xpkg, checkdir, checkdir_relative, self.changed.changed, self.changed.new)
+
+			if self.check['changelog'] and "ChangeLog" not in checkdirlist:
+				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
+
+			self.pkgmeta.check(xpkg, checkdir, checkdirlist, self.repolevel)
+			self.muselist = frozenset(self.pkgmeta.musedict)
+
+			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+			self.changelog_modified = changelog_path in self.changed.changelogs
+
+			self._scan_ebuilds(ebuildlist, xpkg, catdir, pkgdir)
+		return self.qatracker, can_force
+
+
+	def _scan_ebuilds(self, ebuildlist, xpkg, catdir, pkgdir):
+		# detect unused local USE-descriptions
+		used_useflags = set()
+
+		for y_ebuild in ebuildlist:
+
+			ebuild = Ebuild(
+				self.repo_settings, self.repolevel, pkgdir, catdir, self.vcs_settings,
+				xpkg, y_ebuild)
+
+			if self.check['changelog'] and not self.changelog_modified \
+				and ebuild.ebuild_path in self.changed.new_ebuilds:
+				self.qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
+
+			if ebuild.untracked(self.check['ebuild_notadded'], y_ebuild, self.eadded):
+				# ebuild not added to vcs
+				self.qatracker.add_error(
+					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
+
+			if bad_split_check(xpkg, y_ebuild, pkgdir, self.qatracker):
+				continue
+
+			pkg = self.pkgs[y_ebuild]
+			if pkg_invalid(pkg, self.qatracker, ebuild):
+				self.allvalid = False
+				continue
+
+			myaux = pkg._metadata
+			eapi = myaux["EAPI"]
+			inherited = pkg.inherited
+			live_ebuild = self.live_eclasses.intersection(inherited)
+
+			self.eapicheck.check(pkg, ebuild)
+
+			for k, v in myaux.items():
+				if not isinstance(v, basestring):
+					continue
+				m = NON_ASCII_RE.search(v)
+				if m is not None:
+					self.qatracker.add_error(
+						"variable.invalidchar",
+						"%s: %s variable contains non-ASCII "
+						"character at position %s" %
+						(ebuild.relative_path, k, m.start() + 1))
+
+			if not self.fetchcheck.src_uri_error:
+				self.thirdparty.check(myaux, ebuild.relative_path)
+
+			if myaux.get("PROVIDE"):
+				self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
+			for pos, missing_var in enumerate(missingvars):
+				if not myaux.get(missing_var):
+					if catdir == "virtual" and \
+						missing_var in ("HOMEPAGE", "LICENSE"):
+						continue
+					if live_ebuild and missing_var == "KEYWORDS":
+						continue
+					myqakey = missingvars[pos] + ".missing"
+					self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
+
+			if catdir == "virtual":
+				for var in ("HOMEPAGE", "LICENSE"):
+					if myaux.get(var):
+						myqakey = var + ".virtual"
+						self.qatracker.add_error(myqakey, ebuild.relative_path)
+
+			self.descriptioncheck.check(pkg, ebuild)
+
+			keywords = myaux["KEYWORDS"].split()
+
+			ebuild_archs = set(
+				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
+
+			self.keywordcheck.check(
+				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, self.changed,
+				live_ebuild, self.repo_metadata['kwlist'], self.profiles)
+
+			if live_ebuild and self.repo_settings.repo_config.name == "gentoo":
+				self.liveeclasscheck.check(
+					pkg, xpkg, ebuild, y_ebuild, keywords, self.repo_metadata['pmaskdict'])
+
+			if self.options.ignore_arches:
+				arches = [[
+					self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
+					self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
+			else:
+				arches = set()
+				for keyword in keywords:
+					if keyword[0] == "-":
+						continue
+					elif keyword[0] == "~":
+						arch = keyword[1:]
+						if arch == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (
+										expanded_arch, "~" + expanded_arch)))
+						else:
+							arches.add((keyword, arch, (arch, keyword)))
+					else:
+						if keyword == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (expanded_arch,)))
+						else:
+							arches.add((keyword, keyword, (keyword,)))
+				if not arches:
+					# Use an empty profile for checking dependencies of
+					# packages that have empty KEYWORDS.
+					arches.add(('**', '**', ('**',)))
+
+			unknown_pkgs = set()
+			baddepsyntax = False
+			badlicsyntax = False
+			badprovsyntax = False
+			# catpkg = catdir + "/" + y_ebuild
+
+			inherited_java_eclass = "java-pkg-2" in inherited or \
+				"java-pkg-opt-2" in inherited
+			inherited_wxwidgets_eclass = "wxwidgets" in inherited
+			# operator_tokens = set(["||", "(", ")"])
+			type_list, badsyntax = [], []
+			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+				mydepstr = myaux[mytype]
+
+				buildtime = mytype in Package._buildtime_keys
+				runtime = mytype in Package._runtime_keys
+				token_class = None
+				if mytype.endswith("DEPEND"):
+					token_class = portage.dep.Atom
+
+				try:
+					atoms = portage.dep.use_reduce(
+						mydepstr, matchall=1, flat=True,
+						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+				except portage.exception.InvalidDependString as e:
+					atoms = None
+					badsyntax.append(str(e))
+
+				if atoms and mytype.endswith("DEPEND"):
+					if runtime and \
+						"test?" in mydepstr.split():
+						self.qatracker.add_error(
+							mytype + '.suspect',
+							"%s: 'test?' USE conditional in %s" %
+							(ebuild.relative_path, mytype))
+
+					for atom in atoms:
+						if atom == "||":
+							continue
+
+						is_blocker = atom.blocker
+
+						# Skip dependency.unknown for blockers, so that we
+						# don't encourage people to remove necessary blockers,
+						# as discussed in bug 382407. We use atom.without_use
+						# due to bug 525376.
+						if not is_blocker and \
+							not self.portdb.xmatch("match-all", atom.without_use) and \
+							not atom.cp.startswith("virtual/"):
+							unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+						if catdir != "virtual":
+							if not is_blocker and \
+								atom.cp in suspect_virtual:
+								self.qatracker.add_error(
+									'virtual.suspect', ebuild.relative_path +
+									": %s: consider using '%s' instead of '%s'" %
+									(mytype, suspect_virtual[atom.cp], atom))
+							if not is_blocker and \
+								atom.cp.startswith("perl-core/"):
+								self.qatracker.add_error('dependency.perlcore',
+									ebuild.relative_path +
+									": %s: please use '%s' instead of '%s'" %
+									(mytype,
+									atom.replace("perl-core/","virtual/perl-"),
+									atom))
+
+						if buildtime and \
+							not is_blocker and \
+							not inherited_java_eclass and \
+							atom.cp == "virtual/jdk":
+							self.qatracker.add_error(
+								'java.eclassesnotused', ebuild.relative_path)
+						elif buildtime and \
+							not is_blocker and \
+							not inherited_wxwidgets_eclass and \
+							atom.cp == "x11-libs/wxGTK":
+							self.qatracker.add_error(
+								'wxwidgets.eclassnotused',
+								"%s: %ss on x11-libs/wxGTK without inheriting"
+								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
+						elif runtime:
+							if not is_blocker and \
+								atom.cp in suspect_rdepend:
+								self.qatracker.add_error(
+									mytype + '.suspect',
+									ebuild.relative_path + ": '%s'" % atom)
+
+						if atom.operator == "~" and \
+							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+							qacat = 'dependency.badtilde'
+							self.qatracker.add_error(
+								qacat, "%s: %s uses the ~ operator"
+								" with a non-zero revision: '%s'" %
+								(ebuild.relative_path, mytype, atom))
+
+						check_missingslot(atom, mytype, eapi, self.portdb, self.qatracker,
+							ebuild.relative_path, myaux)
+
+				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+			for m, b in zip(type_list, badsyntax):
+				if m.endswith("DEPEND"):
+					qacat = "dependency.syntax"
+				else:
+					qacat = m + ".syntax"
+				self.qatracker.add_error(
+					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+
+			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+			badlicsyntax = badlicsyntax > 0
+			badprovsyntax = badprovsyntax > 0
+
+			self.use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, self.muselist)
+
+			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
+			used_useflags = used_useflags.union(ebuild_used_useflags)
+
+			self.rubyeclasscheck.check(pkg, ebuild)
+
+			# license checks
+			if not badlicsyntax:
+				self.licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			self.restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			# Syntax Checks
+			if not self.vcs_settings.vcs_preserves_mtime:
+				if ebuild.ebuild_path not in self.changed.new_ebuilds and \
+					ebuild.ebuild_path not in self.changed.ebuilds:
+					pkg.mtime = None
+			try:
+				# All ebuilds should have utf_8 encoding.
+				f = io.open(
+					_unicode_encode(
+						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
+					mode='r', encoding=_encodings['repo.content'])
+				try:
+					for check_name, e in run_checks(f, pkg):
+						self.qatracker.add_error(
+							check_name, ebuild.relative_path + ': %s' % e)
+				finally:
+					f.close()
+			except UnicodeDecodeError:
+				# A file.UTF8 failure will have already been recorded above.
+				pass
+
+			if self.options.force:
+				# The dep_check() calls are the most expensive QA test. If --force
+				# is enabled, there's no point in wasting time on these since the
+				# user is intent on forcing the commit anyway.
+				continue
+
+			relevant_profiles = []
+			for keyword, arch, groups in arches:
+				if arch not in self.profiles:
+					# A missing profile will create an error further down
+					# during the KEYWORDS verification.
+					continue
+
+				if self.include_arches is not None:
+					if arch not in self.include_arches:
+						continue
+
+				relevant_profiles.extend(
+					(keyword, groups, prof) for prof in self.profiles[arch])
+
+			relevant_profiles.sort(key=sort_key)
+
+			for keyword, groups, prof in relevant_profiles:
+
+				is_stable_profile = prof.status == "stable"
+				is_dev_profile = prof.status == "dev" and \
+					self.options.include_dev
+				is_exp_profile = prof.status == "exp" and \
+					self.options.include_exp_profiles == 'y'
+				if not (is_stable_profile or is_dev_profile or is_exp_profile):
+					continue
+
+				dep_settings = self.caches['arch'].get(prof.sub_path)
+				if dep_settings is None:
+					dep_settings = portage.config(
+						config_profile_path=prof.abs_path,
+						config_incrementals=self.repoman_incrementals,
+						config_root=self.config_root,
+						local_config=False,
+						_unmatched_removal=self.options.unmatched_removal,
+						env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+					dep_settings.categories = self.repo_settings.repoman_settings.categories
+					if self.options.without_mask:
+						dep_settings._mask_manager_obj = \
+							copy.deepcopy(dep_settings._mask_manager)
+						dep_settings._mask_manager._pmaskdict.clear()
+					self.caches['arch'][prof.sub_path] = dep_settings
+
+				xmatch_cache_key = (prof.sub_path, tuple(groups))
+				xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+				if xcache is None:
+					self.portdb.melt()
+					self.portdb.freeze()
+					xcache = self.portdb.xcache
+					xcache.update(self.caches['shared_xmatch'])
+					self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+				self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+				self.portdb.settings = dep_settings
+				self.portdb.xcache = xcache
+
+				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+				# just in case, prevent config.reset() from nuking these.
+				dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+				# This attribute is used in dbapi._match_use() to apply
+				# use.stable.{mask,force} settings based on the stable
+				# status of the parent package. This is required in order
+				# for USE deps of unstable packages to be resolved correctly,
+				# since otherwise use.stable.{mask,force} settings of
+				# dependencies may conflict (see bug #456342).
+				dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+				# Handle package.use*.{force,mask) calculation, for use
+				# in dep_check.
+				dep_settings.useforce = dep_settings._use_manager.getUseForce(
+					pkg, stable=dep_settings._parent_stable)
+				dep_settings.usemask = dep_settings._use_manager.getUseMask(
+					pkg, stable=dep_settings._parent_stable)
+
+				if not baddepsyntax:
+					ismasked = not ebuild_archs or \
+						pkg.cpv not in self.portdb.xmatch("match-visible",
+						Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+					if ismasked:
+						if not self.have['pmasked']:
+							self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+								pkg.cpv, pkg._metadata))
+						if self.options.ignore_masked:
+							continue
+						# we are testing deps for a masked package; give it some lee-way
+						suffix = "masked"
+						matchmode = "minimum-all"
+					else:
+						suffix = ""
+						matchmode = "minimum-visible"
+
+					if not self.have['dev_keywords']:
+						self.have['dev_keywords'] = \
+							bool(self.dev_keywords.intersection(keywords))
+
+					if prof.status == "dev":
+						suffix = suffix + "indev"
+
+					for mytype in Package._dep_keys:
+
+						mykey = "dependency.bad" + suffix
+						myvalue = myaux[mytype]
+						if not myvalue:
+							continue
+
+						success, atoms = portage.dep_check(
+							myvalue, self.portdb, dep_settings,
+							use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+						if success:
+							if atoms:
+
+								# Don't bother with dependency.unknown for
+								# cases in which *DEPEND.bad is triggered.
+								for atom in atoms:
+									# dep_check returns all blockers and they
+									# aren't counted for *DEPEND.bad, so we
+									# ignore them here.
+									if not atom.blocker:
+										unknown_pkgs.discard(
+											(mytype, atom.unevaluated_atom))
+
+								if not prof.sub_path:
+									# old-style virtuals currently aren't
+									# resolvable with empty profile, since
+									# 'virtuals' mappings are unavailable
+									# (it would be expensive to search
+									# for PROVIDE in all ebuilds)
+									atoms = [
+										atom for atom in atoms if not (
+											atom.cp.startswith('virtual/')
+											and not self.portdb.cp_list(atom.cp))]
+
+								# we have some unsolvable deps
+								# remove ! deps, which always show up as unsatisfiable
+								atoms = [
+									str(atom.unevaluated_atom)
+									for atom in atoms if not atom.blocker]
+
+								# if we emptied out our list, continue:
+								if not atoms:
+									continue
+								self.qatracker.add_error(mykey,
+									"%s: %s: %s(%s)\n%s"
+									% (ebuild.relative_path, mytype, keyword, prof,
+										pformat(atoms, indent=6)))
+						else:
+							self.qatracker.add_error(mykey,
+								"%s: %s: %s(%s)\n%s"
+								% (ebuild.relative_path, mytype, keyword, prof,
+									pformat(atoms, indent=6)))
+
+			if not baddepsyntax and unknown_pkgs:
+				type_map = {}
+				for mytype, atom in unknown_pkgs:
+					type_map.setdefault(mytype, set()).add(atom)
+				for mytype, atoms in type_map.items():
+					self.qatracker.add_error(
+						"dependency.unknown", "%s: %s: %s"
+						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+
+		# check if there are unused local USE-descriptions in metadata.xml
+		# (unless there are any invalids, to avoid noise)
+		if self.allvalid:
+			for myflag in self.muselist.difference(used_useflags):
+				self.qatracker.add_error(
+					"metadata.warning",
+					"%s/metadata.xml: unused local USE-description: '%s'"
+					% (xpkg, myflag))


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     8553e18d54009d5fb804a7a9d65ae0d8f7de2cba
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 00:48:05 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8553e18d

repoman: Move the remaining actions to an Actions class

Fix regression from which always runs commit mode.
Error found by Mike Gilbert
actions.py: Assign repoman_settings from the repo_settings variable
Add a return to the end perform(), it just didn't seem right to leave it hanging.

 pym/repoman/{main.py => actions.py} | 662 +++++++++++++------------------
 pym/repoman/main.py                 | 756 ++----------------------------------
 2 files changed, 302 insertions(+), 1116 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/actions.py
old mode 100755
new mode 100644
similarity index 66%
copy from pym/repoman/main.py
copy to pym/repoman/actions.py
index 2b2f91d..611c0dd
--- a/pym/repoman/main.py
+++ b/pym/repoman/actions.py
@@ -1,337 +1,80 @@
-#!/usr/bin/python -bO
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function, unicode_literals
 
 import errno
 import io
 import logging
+import platform
 import re
 import signal
 import subprocess
 import sys
 import tempfile
-import platform
 from itertools import chain
 
-from os import path as osp
-if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
-	pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__)))) #, "pym")
-	sys.path.insert(0, pym_path)
-# import our centrally initialized portage instance
-from repoman._portage import portage
-portage._internal_caller = True
-portage._disable_legacy_globals()
-
+from _emerge.UserQuery import UserQuery
 
+import portage
+from portage import cvstree
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
-import portage.checksum
-import portage.const
-import portage.repository.config
-from portage import cvstree
-from portage import util
-from portage.process import find_binary, spawn
 from portage.output import (
-	bold, create_color_func, green, nocolor, red)
-from portage.output import ConsoleStyleFile, StyleWriter
-from portage.util import formatter
-from portage.util import writemsg_level
+	bold, create_color_func, green, red)
 from portage.package.ebuild.digestgen import digestgen
+from portage.process import find_binary, spawn
+from portage.util import writemsg_level
 
-from repoman.argparser import parse_args
-from repoman.checks.ebuilds.checks import checks_init
+from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.qa_data import (
-	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats)
-from repoman.repos import RepoSettings
-from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
-
-if sys.hexversion >= 0x3000000:
-	basestring = str
-
-util.initialize_logger()
+from repoman.vcs.vcs import git_supports_gpg_sign, vcs_files_to_cps
 
 bad = create_color_func("BAD")
 
-# A sane umask is needed for files that portage creates.
-os.umask(0o22)
-
-
-def repoman_main(argv):
-	config_root = os.environ.get("PORTAGE_CONFIGROOT")
-	repoman_settings = portage.config(config_root=config_root, local_config=False)
-
-	if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
-		repoman_settings.get('TERM') == 'dumb' or \
-		not sys.stdout.isatty():
-		nocolor()
-
-	options, arguments = parse_args(
-		sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
-
-	if options.version:
-		print("Portage", portage.VERSION)
-		sys.exit(0)
-
-	if options.experimental_inherit == 'y':
-		# This is experimental, so it's non-fatal.
-		qawarnings.add("inherit.missing")
-		checks_init(experimental_inherit=True)
-
-	# Set this to False when an extraordinary issue (generally
-	# something other than a QA issue) makes it impossible to
-	# commit (like if Manifest generation fails).
-	can_force = True
-
-	portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-	if portdir is None:
-		sys.exit(1)
-
-	myreporoot = os.path.basename(portdir_overlay)
-	myreporoot += mydir[len(portdir_overlay):]
-
-	vcs_settings = VCSSettings(options, repoman_settings)
-
-	repo_settings = RepoSettings(
-		config_root, portdir, portdir_overlay,
-		repoman_settings, vcs_settings, options, qawarnings)
-	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
-
-	if 'digest' in repoman_settings.features and options.digest != 'n':
-		options.digest = 'y'
-
-	logging.debug("vcs: %s" % (vcs_settings.vcs,))
-	logging.debug("repo config: %s" % (repo_settings.repo_config,))
-	logging.debug("options: %s" % (options,))
-
-	# It's confusing if these warnings are displayed without the user
-	# being told which profile they come from, so disable them.
-	env = os.environ.copy()
-	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
-
-	# Perform the main checks
-	scanner = Scanner(repo_settings, myreporoot, config_root, options,
-					vcs_settings, mydir, env)
-	qatracker, can_force = scanner.scan_pkgs(can_force)
-
-	commitmessage = None
-
-	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
-		logging.warning("--if-modified is enabled, but no modified packages were found!")
-
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
-
-	# early out for manifest generation
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
-	for x in qacats:
-		if x not in qatracker.fails:
-			continue
-		dowarn = 1
-		if x not in qawarnings:
-			dofail = 1
-
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
-
-	# Save QA output so that it can be conveniently displayed
-	# in $EDITOR while the user creates a commit message.
-	# Otherwise, the user would not be able to see this output
-	# once the editor has taken over the screen.
-	qa_output = io.StringIO()
-	style_file = ConsoleStyleFile(sys.stdout)
-	if options.mode == 'commit' and \
-		(not commitmessage or not commitmessage.strip()):
-		style_file.write_listener = qa_output
-	console_writer = StyleWriter(file=style_file, maxcol=9999)
-	console_writer.style_listener = style_file.new_styles
-
-	f = formatter.AbstractFormatter(console_writer)
-
-	format_outputs = {
-		'column': format_qa_output_column,
-		'default': format_qa_output
-	}
-
-	format_output = format_outputs.get(
-		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
-
-	style_file.flush()
-	del console_writer, f, style_file
-	qa_output = qa_output.getvalue()
-	qa_output = qa_output.splitlines(True)
-
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
 
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
+class Actions(object):
+	'''Handles post check result output and performs
+	the various vcs activities for committing the results'''
+
+	def __init__(self, repo_settings, options, scanner, vcs_settings):
+		self.repo_settings = repo_settings
+		self.options = options
+		self.scanner = scanner
+		self.vcs_settings = vcs_settings
+		self.repoman_settings = repo_settings.repoman_settings
+		self.suggest = {
+			'ignore_masked': False,
+			'include_dev': False,
+		}
+		if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
+			self.suggest['ignore_masked'] = True
+		if scanner.have['dev_keywords'] and not options.include_dev:
+			self.suggest['include_dev'] = True
+
+
+	def inform(self, can_force, result):
+		'''Inform the user of all the problems found'''
+		if self.suggest['ignore_masked'] or self.suggest['include_dev']:
+			self._suggest()
+		if self.options.mode != 'commit':
+			self._non_commit(result)
+			return False
+		else:
+			self._fail(result, can_force)
+			if self.options.pretend:
+				utilities.repoman_sez(
+					"\"So, you want to play it safe. Good call.\"\n")
+			return True
 
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
 
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
+	def perform(self, qa_output):
+		myunadded, mydeleted = self._vcs_unadded()
 
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+		myautoadd = self._vcs_autoadd(myunadded)
 
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		self._vcs_deleted(mydeleted)
 
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
+		if self.vcs_settings.vcs == "cvs":
 			mycvstree = cvstree.getentries("./", recursive=1)
 			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
 			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
@@ -340,7 +83,7 @@ def repoman_main(argv):
 			no_expansion = set(portage.cvstree.findoption(
 				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
 
-		if vcs_settings.vcs == "svn":
+		if self.vcs_settings.vcs == "svn":
 			with repoman_popen("svn status") as f:
 				svnstatus = f.readlines()
 			mychanged = [
@@ -363,7 +106,7 @@ def repoman_main(argv):
 				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
 				for prop in props if " - " in prop)
 
-		elif vcs_settings.vcs == "git":
+		elif self.vcs_settings.vcs == "git":
 			with repoman_popen(
 				"git diff-index --name-only "
 				"--relative --diff-filter=M HEAD") as f:
@@ -382,7 +125,7 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem[:-1] for elem in myremoved]
 
-		if vcs_settings.vcs == "bzr":
+		if self.vcs_settings.vcs == "bzr":
 			with repoman_popen("bzr status -S .") as f:
 				bzrstatus = f.readlines()
 			mychanged = [
@@ -403,7 +146,7 @@ def repoman_main(argv):
 				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
 			# Bazaar expands nothing.
 
-		if vcs_settings.vcs == "hg":
+		if self.vcs_settings.vcs == "hg":
 			with repoman_popen("hg status --no-status --modified .") as f:
 				mychanged = f.readlines()
 			mychanged = ["./" + elem.rstrip() for elem in mychanged]
@@ -416,9 +159,9 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem.rstrip() for elem in myremoved]
 
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
 
 			if not (a_file_is_changed or a_file_is_deleted_hg):
 				utilities.repoman_sez(
@@ -442,12 +185,12 @@ def repoman_main(argv):
 		mymanifests = list(mymanifests)
 		myheaders = []
 
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
+		commitmessage = self.options.commitmsg
+		if self.options.commitmsgfile:
 			try:
 				f = io.open(
 					_unicode_encode(
-						options.commitmsgfile,
+						self.options.commitmsgfile,
 						encoding=_encodings['fs'], errors='strict'),
 					mode='r', encoding=_encodings['content'], errors='replace')
 				commitmessage = f.read()
@@ -457,15 +200,15 @@ def repoman_main(argv):
 				if e.errno == errno.ENOENT:
 					portage.writemsg(
 						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
+						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
 			# We've read the content so the file is no longer needed.
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
+			if self.scanner.repolevel > 1:
+				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -484,29 +227,29 @@ def repoman_main(argv):
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
 		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
 		if portage_version is None:
 			sys.stderr.write("Failed to insert portage version in message!\n")
 			sys.stderr.flush()
 			portage_version = "Unknown"
 
 		report_options = []
-		if options.force:
+		if self.options.force:
 			report_options.append("--force")
-		if options.ignore_arches:
+		if self.options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
+		if self.scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
+				" ".join(sorted(self.scanner.include_arches)))
 
-		if vcs_settings.vcs == "git":
+		if self.vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
 			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
 			if report_options:
 				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
 			if dco_sob:
 				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
@@ -520,10 +263,10 @@ def repoman_main(argv):
 			if dco_sob:
 				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
 			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
+				(portage_version, self.vcs_settings.vcs, unameout)
 			if report_options:
 				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += ", signed Manifest commit with key %s" % \
 					(gpg_key, )
 			else:
@@ -533,24 +276,24 @@ def repoman_main(argv):
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
+		if self.options.echangelog in ('y', 'force'):
 			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
 				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
+				checkdir = self.repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if scanner.repolevel < 3:
+				if self.scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
+				if self.scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
 					continue
 
 				# get changes for this package
@@ -566,15 +309,15 @@ def repoman_main(argv):
 				nontrivial_cl_files = set()
 				nontrivial_cl_files.update(clnew, clremoved, clchanged)
 				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
 					continue
 
 				new_changelog = utilities.UpdateChangeLog(
 					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
 					catdir, pkgdir,
 					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
+					pretend=self.options.pretend)
 				if new_changelog is None:
 					writemsg_level(
 						"!!! Updating the ChangeLog failed\n",
@@ -588,18 +331,18 @@ def repoman_main(argv):
 				else:
 					myupdates.append(changelog_path)
 
-				if options.ask and not options.pretend:
+				if self.options.ask and not self.options.pretend:
 					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 				else:
 					broken_changelog_manifests.append(x)
 
 		if myautoadd:
 			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
+			add_cmd = [self.vcs_settings.vcs, "add"]
 			add_cmd += myautoadd
-			if options.pretend:
+			if self.options.pretend:
 				portage.writemsg_stdout(
 					"(%s)\n" % " ".join(add_cmd),
 					noiselevel=-1)
@@ -618,22 +361,22 @@ def repoman_main(argv):
 				retcode = subprocess.call(add_cmd)
 				if retcode != os.EX_OK:
 					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
 					sys.exit(retcode)
 
 			myupdates += myautoadd
 
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
-		if vcs_settings.vcs not in ('cvs', 'svn'):
+		if self.vcs_settings.vcs not in ('cvs', 'svn'):
 			# With git, bzr and hg, there's never any keyword expansion, so
 			# there's no need to regenerate manifests and all files will be
 			# committed in one big commit at the end.
 			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
+		elif not self.repo_settings.repo_config.thin_manifest:
+			if self.vcs_settings.vcs == 'cvs':
 				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
+			elif self.vcs_settings.vcs == "svn":
 				svn_keywords = dict((k.lower(), k) for k in [
 					"Rev",
 					"Revision",
@@ -651,12 +394,12 @@ def repoman_main(argv):
 			for myfile in myupdates:
 
 				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
+				if self.vcs_settings.vcs == "cvs":
 					if myfile in no_expansion:
 						continue
 
 				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
+				elif self.vcs_settings.vcs == "svn":
 					if myfile not in expansion:
 						continue
 
@@ -684,8 +427,8 @@ def repoman_main(argv):
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
 
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
+		uq = UserQuery(self.options)
+		if self.options.ask and uq.query('Commit changes?', True) != 'Yes':
 			print("* aborting commit.")
 			sys.exit(128 + signal.SIGINT)
 
@@ -713,22 +456,22 @@ def repoman_main(argv):
 			# so strip the prefix.
 			myfiles = [f.lstrip("./") for f in myfiles]
 
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+			commit_cmd = [self.vcs_settings.vcs]
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
 			commit_cmd.extend(["-F", commitmessagefile])
 			commit_cmd.extend(myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -759,39 +502,39 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if scanner.repolevel == 1:
+		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
 
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
+		if self.vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		elif broken_changelog_manifests:
 			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
-		if repo_settings.sign_manifests:
+		if self.repo_settings.sign_manifests:
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
+					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):
 						continue
-					gpgsign(manifest_path, repoman_settings, options)
+					gpgsign(manifest_path, self.repoman_settings, self.options)
 			except portage.exception.PortageException as e:
 				portage.writemsg("!!! %s\n" % str(e))
 				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
+				self.repo_settings.sign_manifests = False
 
-		if vcs_settings.vcs == 'git':
+		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
 			# be some modified files elsewhere in the working tree that the
 			# user doesn't want to commit. Therefore, call git update-index
@@ -802,14 +545,14 @@ def repoman_main(argv):
 			myfiles.sort()
 			update_index_cmd = ["git", "update-index"]
 			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
+			if self.options.pretend:
 				print("(%s)" % (" ".join(update_index_cmd),))
 			else:
 				retval = spawn(update_index_cmd, env=os.environ)
 				if retval != os.EX_OK:
 					writemsg_level(
 						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
@@ -829,15 +572,15 @@ def repoman_main(argv):
 			mymsg.close()
 
 			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
+			if self.options.pretend and self.vcs_settings.vcs is None:
 				# substitute a bogus value for pretend output
 				commit_cmd.append("cvs")
 			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+				commit_cmd.append(self.vcs_settings.vcs)
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+			if self.vcs_settings.vcs == "hg":
 				commit_cmd.extend(["--logfile", commitmessagefile])
 				commit_cmd.extend(myfiles)
 			else:
@@ -845,12 +588,12 @@ def repoman_main(argv):
 				commit_cmd.extend(f.lstrip("./") for f in myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
+						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
 							not git_supports_gpg_sign():
 							# Inform user that newer git is needed (bug #403323).
 							logging.error(
@@ -858,7 +601,7 @@ def repoman_main(argv):
 
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -868,7 +611,7 @@ def repoman_main(argv):
 					pass
 
 		print()
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			print("Commit complete.")
 		else:
 			print(
@@ -877,4 +620,155 @@ def repoman_main(argv):
 				" that he forgot to commit anything")
 		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"\n")
-	sys.exit(0)
+		return
+
+
+	def _suggest(self):
+		print()
+		if self.suggest['ignore_masked']:
+			print(bold(
+				"Note: use --without-mask to check "
+				"KEYWORDS on dependencies of masked packages"))
+
+		if self.suggest['include_dev']:
+			print(bold(
+				"Note: use --include-dev (-d) to check "
+				"dependencies for 'dev' profiles"))
+		print()
+
+
+	def _non_commit(self, result):
+		if result['full']:
+			print(bold("Note: type \"repoman full\" for a complete listing."))
+		if result['warn'] and not result['fail']:
+			utilities.repoman_sez(
+				"\"You're only giving me a partial QA payment?\n"
+				"              I'll take it this time, but I'm not happy.\"")
+		elif not result['fail']:
+			utilities.repoman_sez(
+				"\"If everyone were like you, I'd be out of business!\"")
+		elif result['fail']:
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _fail(self, result, can_force):
+		if result['fail'] and can_force and self.options.force and not self.options.pretend:
+			utilities.repoman_sez(
+				" \"You want to commit even with these QA issues?\n"
+				"              I'll take it this time, but I'm not happy.\"\n")
+		elif result['fail']:
+			if self.options.force and not can_force:
+				print(bad(
+					"The --force option has been disabled"
+					" due to extraordinary issues."))
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _vcs_unadded(self):
+		myunadded = []
+		mydeleted = []
+		if self.vcs_settings.vcs == "cvs":
+			try:
+				myvcstree = portage.cvstree.getentries("./", recursive=1)
+				myunadded = portage.cvstree.findunadded(
+					myvcstree, recursive=1, basedir="./")
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving CVS tree; exiting.")
+		if self.vcs_settings.vcs == "svn":
+			try:
+				with repoman_popen("svn status --no-ignore") as f:
+					svnstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1]
+					for elem in svnstatus
+					if elem.startswith("?") or elem.startswith("I")]
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving SVN info; exiting.")
+		if self.vcs_settings.vcs == "git":
+			# get list of files not under version control or missing
+			myf = repoman_popen("git ls-files --others")
+			myunadded = ["./" + elem[:-1] for elem in myf]
+			myf.close()
+		if self.vcs_settings.vcs == "bzr":
+			try:
+				with repoman_popen("bzr status -S .") as f:
+					bzrstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
+					for elem in bzrstatus
+					if elem.startswith("?") or elem[0:2] == " D"]
+			except SystemExit:
+				raise # TODO propagate this
+			except:
+				err("Error retrieving bzr info; exiting.")
+		if self.vcs_settings.vcs == "hg":
+			with repoman_popen("hg status --no-status --unknown .") as f:
+				myunadded = f.readlines()
+			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+
+			# Mercurial doesn't handle manually deleted files as removed from
+			# the repository, so the user need to remove them before commit,
+			# using "hg remove [FILES]"
+			with repoman_popen("hg status --no-status --deleted .") as f:
+				mydeleted = f.readlines()
+			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		return myunadded, mydeleted
+
+
+	def _vcs_autoadd(self, myunadded):
+		myautoadd = []
+		if myunadded:
+			for x in range(len(myunadded) - 1, -1, -1):
+				xs = myunadded[x].split("/")
+				if self.repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
+					# The Manifest excludes this file,
+					# so it's safe to ignore.
+					del myunadded[x]
+				elif xs[-1] == "files":
+					print("!!! files dir is not added! Please correct this.")
+					sys.exit(-1)
+				elif xs[-1] == "Manifest":
+					# It's a manifest... auto add
+					myautoadd += [myunadded[x]]
+					del myunadded[x]
+
+		if myunadded:
+			print(red(
+				"!!! The following files are in your local tree"
+				" but are not added to the master"))
+			print(red(
+				"!!! tree. Please remove them from the local tree"
+				" or add them to the master tree."))
+			for x in myunadded:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)
+		return myautoadd
+
+
+	def _vcs_deleted(self, mydeleted):
+		if self.vcs_settings.vcs == "hg" and mydeleted:
+			print(red(
+				"!!! The following files are removed manually"
+				" from your local tree but are not"))
+			print(red(
+				"!!! removed from the repository."
+				" Please remove them, using \"hg remove [FILES]\"."))
+			for x in mydeleted:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2b2f91d..808c55e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,16 +4,9 @@
 
 from __future__ import print_function, unicode_literals
 
-import errno
 import io
 import logging
-import re
-import signal
-import subprocess
 import sys
-import tempfile
-import platform
-from itertools import chain
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -26,36 +19,24 @@ portage._disable_legacy_globals()
 
 
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree
 from portage import util
-from portage.process import find_binary, spawn
-from portage.output import (
-	bold, create_color_func, green, nocolor, red)
+from portage.output import create_color_func, nocolor
 from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import formatter
-from portage.util import writemsg_level
-from portage.package.ebuild.digestgen import digestgen
 
+from repoman.actions import Actions
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import checks_init
-from repoman.errors import err
-from repoman.gpg import gpgsign, need_signature
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats)
 from repoman.repos import RepoSettings
 from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
+from repoman.vcs.vcs import VCSSettings
 
 if sys.hexversion >= 0x3000000:
 	basestring = str
@@ -107,7 +88,6 @@ def repoman_main(argv):
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
 
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
@@ -131,27 +111,29 @@ def repoman_main(argv):
 	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
+	result = {
+		# fail will be true if we have failed in at least one non-warning category
+		'fail': 0,
+		# warn will be true if we tripped any warnings
+		'warn': 0,
+		# full will be true if we should print a "repoman full" informational message
+		'full': options.mode != 'full',
+	}
 
 	# early out for manifest generation
 	if options.mode == "manifest":
-		sys.exit(dofail)
+		sys.exit(result['fail'])
 
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
-		dowarn = 1
+		result['warn'] = 1
 		if x not in qawarnings:
-			dofail = 1
+			result['fail'] = 1
 
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
+	if result['fail'] or \
+		(result['warn'] and not (options.quiet or options.mode == "scan")):
+		result['full'] = 0
 
 	# Save QA output so that it can be conveniently displayed
 	# in $EDITOR while the user creates a commit message.
@@ -174,707 +156,17 @@ def repoman_main(argv):
 
 	format_output = format_outputs.get(
 		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
+	format_output(f, qatracker.fails, result['full'], result['fail'], options, qawarnings)
 
 	style_file.flush()
 	del console_writer, f, style_file
 	qa_output = qa_output.getvalue()
 	qa_output = qa_output.splitlines(True)
 
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
-
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
-
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
-
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
-
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
-
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
-
-		if vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
-
-		# Manifests need to be regenerated after all other commits, so don't commit
-		# them now even if they have changed.
-		mymanifests = set()
-		myupdates = set()
-		for f in mychanged + mynew:
-			if "Manifest" == os.path.basename(f):
-				mymanifests.add(f)
-			else:
-				myupdates.add(f)
-		myupdates.difference_update(myremoved)
-		myupdates = list(myupdates)
-		mymanifests = list(mymanifests)
-		myheaders = []
-
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
-			try:
-				f = io.open(
-					_unicode_encode(
-						options.commitmsgfile,
-						encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['content'], errors='replace')
-				commitmessage = f.read()
-				f.close()
-				del f
-			except (IOError, OSError) as e:
-				if e.errno == errno.ENOENT:
-					portage.writemsg(
-						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
-				else:
-					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
-		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
-
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
-		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if options.force:
-			report_options.append("--force")
-		if options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
-
-		if vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
-
-		commitmessage += commit_footer
-
-		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if options.ask and not options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
-		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
-
-		if vcs_settings.vcs not in ('cvs', 'svn'):
-			# With git, bzr and hg, there's never any keyword expansion, so
-			# there's no need to regenerate manifests and all files will be
-			# committed in one big commit at the end.
-			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
-
-		logging.info("myupdates: %s", myupdates)
-		logging.info("myheaders: %s", myheaders)
-
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
-			print("* aborting commit.")
-			sys.exit(128 + signal.SIGINT)
-
-		# Handle the case where committed files have keywords which
-		# will change and need a priming commit before the Manifest
-		# can be committed.
-		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		# When files are removed and re-added, the cvs server will put /Attic/
-		# inside the $Header path. This code detects the problem and corrects it
-		# so that the Manifest will generate correctly. See bug #169500.
-		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
-
-		if scanner.repolevel == 1:
-			utilities.repoman_sez(
-				"\"You're rather crazy... "
-				"doing the entire repository.\"\n")
-
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		elif broken_changelog_manifests:
-			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		if repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, repoman_settings, options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
-
-		if vcs_settings.vcs == 'git':
-			# It's not safe to use the git commit -a option since there might
-			# be some modified files elsewhere in the working tree that the
-			# user doesn't want to commit. Therefore, call git update-index
-			# in order to ensure that the index is updated with the latest
-			# versions of all new and modified files in the relevant portion
-			# of the working tree.
-			myfiles = mymanifests + myupdates
-			myfiles.sort()
-			update_index_cmd = ["git", "update-index"]
-			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
-				print("(%s)" % (" ".join(update_index_cmd),))
-			else:
-				retval = spawn(update_index_cmd, env=os.environ)
-				if retval != os.EX_OK:
-					writemsg_level(
-						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(retval)
-
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		print()
-		if vcs_settings.vcs:
-			print("Commit complete.")
-		else:
-			print(
-				"repoman was too scared"
-				" by not seeing any familiar version control file"
-				" that he forgot to commit anything")
-		utilities.repoman_sez(
-			"\"If everyone were like you, I'd be out of business!\"\n")
+	# output the results
+	actions = Actions(repo_settings, options, scanner, vcs_settings)
+	if actions.inform(can_force, result):
+		# perform any other actions
+		actions.perform(qa_output)
+
 	sys.exit(0)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     5d91183c50d57d7ddb06721a64f2ae6f95b6aeea
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:59:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5d91183c

repoman/actions.py: Split out the commit footer to a function

 pym/repoman/actions.py | 95 ++++++++++++++++++++++++++------------------------
 1 file changed, 49 insertions(+), 46 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 1f70815..e9bf147 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -133,53 +133,8 @@ class Actions(object):
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if self.options.force:
-			report_options.append("--force")
-		if self.options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if self.scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(self.scanner.include_arches)))
-
-		if self.vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, self.vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
 
+		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
@@ -797,3 +752,51 @@ class Actions(object):
 		expansion = {}
 		return  (mynew, mychanged, myremoved, no_expansion, expansion)
 
+
+	def get_commit_footer(self):
+		portage_version = getattr(portage, "VERSION", None)
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		report_options = []
+		if self.options.force:
+			report_options.append("--force")
+		if self.options.ignore_arches:
+			report_options.append("--ignore-arches")
+		if self.scanner.include_arches is not None:
+			report_options.append(
+				"--include-arches=\"%s\"" %
+				" ".join(sorted(self.scanner.include_arches)))
+
+		if portage_version is None:
+			sys.stderr.write("Failed to insert portage version in message!\n")
+			sys.stderr.flush()
+			portage_version = "Unknown"
+		# Use new footer only for git (see bug #438364).
+		if self.vcs_settings.vcs in ["git"]:
+			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
+			if report_options:
+				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
+			if dco_sob:
+				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
+		else:
+			unameout = platform.system() + " "
+			if platform.system() in ["Darwin", "SunOS"]:
+				unameout += platform.processor()
+			else:
+				unameout += platform.machine()
+			commit_footer = "\n\n"
+			if dco_sob:
+				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
+			commit_footer += "(Portage version: %s/%s/%s" % \
+				(portage_version, self.vcs_settings.vcs, unameout)
+			if report_options:
+				commit_footer += ", RepoMan options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += ", signed Manifest commit with key %s" % \
+					(gpg_key, )
+			else:
+				commit_footer += ", unsigned Manifest commit"
+			commit_footer += ")"
+		return commit_footer


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     3769fd0b8cfa080197cf154b2742bc2d7895ae15
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:27:19 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3769fd0b

repoamn/actions.py: Split out sign_manifest()

 pym/repoman/actions.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 5b55ff8..4f516da 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -186,19 +186,7 @@ class Actions(object):
 				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		if self.repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
-					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, self.repoman_settings, self.options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				self.repo_settings.sign_manifests = False
+			self.sign_manifests(myupdates, myremoved, mymanifests)
 
 		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
@@ -821,3 +809,20 @@ class Actions(object):
 					modified = True
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+
+
+	def sign_manifest(self, myupdates, myremoved, mymanifests):
+		try:
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, myremoved, mymanifests),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
+				if not need_signature(manifest_path):
+					continue
+				gpgsign(manifest_path, self.repoman_settings, self.options)
+		except portage.exception.PortageException as e:
+			portage.writemsg("!!! %s\n" % str(e))
+			portage.writemsg("!!! Disabled FEATURES='sign'\n")
+			self.repo_settings.sign_manifests = False
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     e5c1c0899f0cf8e1331a1e523a27703fe84fb8c9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 04:06:24 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5c1c089

repoman: Change name of dev_keywords() due to variable name conflict

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 4 ++--
 pym/repoman/profile.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e276aba..006afc9 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -68,7 +68,7 @@ from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_keywords, setup_profile
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, missingvars,
@@ -243,7 +243,7 @@ scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
 ####################
 
-dev_keywords = dev_keywords(profiles)
+dev_keywords = dev_profile_keywords(profiles)
 
 qatracker = QATracker()
 

diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py
index 11b93c7..0aedbe8 100644
--- a/pym/repoman/profile.py
+++ b/pym/repoman/profile.py
@@ -28,7 +28,7 @@ class ProfileDesc(object):
 valid_profile_types = frozenset(['dev', 'exp', 'stable'])
 
 
-def dev_keywords(profiles):
+def dev_profile_keywords(profiles):
 	"""
 	Create a set of KEYWORDS values that exist in 'dev'
 	profiles. These are used


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     56cd8391579d206245232b0766d7cfe6c6b82dbc
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:03:54 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=56cd8391

repoman/actions.py: Remove unused variable

 pym/repoman/actions.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 405a8c7..2318ce2 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -110,8 +110,6 @@ class Actions(object):
 						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
 			if self.scanner.repolevel > 1:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     1ab7562ec6027e5edd118e66a9e39d2353d8bc87
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:39:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ab7562e

repoman/repos.py: Fix a regression where the repo is not in repos.conf

The regression was introduced when a variable was used to reduce the size of
some long lines.  The variable was not being reset after the repo was added, so
the remaining code was looking at a stale config.
It turned out the variable was a dupe of an already properly updated class wide
one.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 700c064..de99fdf 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -30,12 +30,12 @@ class RepoSettings(object):
 		self.repoman_settings = repoman_settings
 		self.vcs_settings = vcs_settings
 
-		repoman_repos = self.repoman_settings.repositories
+		self.repositories = self.repoman_settings.repositories
 
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
-			repoman_repos.get_repo_for_location(self.repodir)
+			self.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
 			self._add_repo(config_root, portdir_overlay)
 
@@ -47,15 +47,15 @@ class RepoSettings(object):
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_repos.get_repo_for_location(self.repodir)
+		self.repo_config = self.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_repos):
+		for repo in list(self.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_repos[repo.name]
+				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     f0fb6cd1e492c1e6f0d26c483dc0a0ebcbc8ecb8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 00:48:05 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:59:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0fb6cd1

repoman: Move the remaining actions to an Actions class

Fix regression from which always runs commit mode.
Error found by Mike Gilbert
actions.py: Assign repoman_settings from the repo_settings variable
Add a return to the end perform(), it just didn't seem right to leave it hanging.

 pym/repoman/{main.py => actions.py} | 662 +++++++++++++------------------
 pym/repoman/main.py                 | 756 ++----------------------------------
 2 files changed, 302 insertions(+), 1116 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/actions.py
old mode 100755
new mode 100644
similarity index 66%
copy from pym/repoman/main.py
copy to pym/repoman/actions.py
index 2b2f91d..611c0dd
--- a/pym/repoman/main.py
+++ b/pym/repoman/actions.py
@@ -1,337 +1,80 @@
-#!/usr/bin/python -bO
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function, unicode_literals
 
 import errno
 import io
 import logging
+import platform
 import re
 import signal
 import subprocess
 import sys
 import tempfile
-import platform
 from itertools import chain
 
-from os import path as osp
-if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
-	pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__)))) #, "pym")
-	sys.path.insert(0, pym_path)
-# import our centrally initialized portage instance
-from repoman._portage import portage
-portage._internal_caller = True
-portage._disable_legacy_globals()
-
+from _emerge.UserQuery import UserQuery
 
+import portage
+from portage import cvstree
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
-import portage.checksum
-import portage.const
-import portage.repository.config
-from portage import cvstree
-from portage import util
-from portage.process import find_binary, spawn
 from portage.output import (
-	bold, create_color_func, green, nocolor, red)
-from portage.output import ConsoleStyleFile, StyleWriter
-from portage.util import formatter
-from portage.util import writemsg_level
+	bold, create_color_func, green, red)
 from portage.package.ebuild.digestgen import digestgen
+from portage.process import find_binary, spawn
+from portage.util import writemsg_level
 
-from repoman.argparser import parse_args
-from repoman.checks.ebuilds.checks import checks_init
+from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.qa_data import (
-	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats)
-from repoman.repos import RepoSettings
-from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
-
-if sys.hexversion >= 0x3000000:
-	basestring = str
-
-util.initialize_logger()
+from repoman.vcs.vcs import git_supports_gpg_sign, vcs_files_to_cps
 
 bad = create_color_func("BAD")
 
-# A sane umask is needed for files that portage creates.
-os.umask(0o22)
-
-
-def repoman_main(argv):
-	config_root = os.environ.get("PORTAGE_CONFIGROOT")
-	repoman_settings = portage.config(config_root=config_root, local_config=False)
-
-	if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
-		repoman_settings.get('TERM') == 'dumb' or \
-		not sys.stdout.isatty():
-		nocolor()
-
-	options, arguments = parse_args(
-		sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
-
-	if options.version:
-		print("Portage", portage.VERSION)
-		sys.exit(0)
-
-	if options.experimental_inherit == 'y':
-		# This is experimental, so it's non-fatal.
-		qawarnings.add("inherit.missing")
-		checks_init(experimental_inherit=True)
-
-	# Set this to False when an extraordinary issue (generally
-	# something other than a QA issue) makes it impossible to
-	# commit (like if Manifest generation fails).
-	can_force = True
-
-	portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-	if portdir is None:
-		sys.exit(1)
-
-	myreporoot = os.path.basename(portdir_overlay)
-	myreporoot += mydir[len(portdir_overlay):]
-
-	vcs_settings = VCSSettings(options, repoman_settings)
-
-	repo_settings = RepoSettings(
-		config_root, portdir, portdir_overlay,
-		repoman_settings, vcs_settings, options, qawarnings)
-	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
-
-	if 'digest' in repoman_settings.features and options.digest != 'n':
-		options.digest = 'y'
-
-	logging.debug("vcs: %s" % (vcs_settings.vcs,))
-	logging.debug("repo config: %s" % (repo_settings.repo_config,))
-	logging.debug("options: %s" % (options,))
-
-	# It's confusing if these warnings are displayed without the user
-	# being told which profile they come from, so disable them.
-	env = os.environ.copy()
-	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
-
-	# Perform the main checks
-	scanner = Scanner(repo_settings, myreporoot, config_root, options,
-					vcs_settings, mydir, env)
-	qatracker, can_force = scanner.scan_pkgs(can_force)
-
-	commitmessage = None
-
-	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
-		logging.warning("--if-modified is enabled, but no modified packages were found!")
-
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
-
-	# early out for manifest generation
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
-	for x in qacats:
-		if x not in qatracker.fails:
-			continue
-		dowarn = 1
-		if x not in qawarnings:
-			dofail = 1
-
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
-
-	# Save QA output so that it can be conveniently displayed
-	# in $EDITOR while the user creates a commit message.
-	# Otherwise, the user would not be able to see this output
-	# once the editor has taken over the screen.
-	qa_output = io.StringIO()
-	style_file = ConsoleStyleFile(sys.stdout)
-	if options.mode == 'commit' and \
-		(not commitmessage or not commitmessage.strip()):
-		style_file.write_listener = qa_output
-	console_writer = StyleWriter(file=style_file, maxcol=9999)
-	console_writer.style_listener = style_file.new_styles
-
-	f = formatter.AbstractFormatter(console_writer)
-
-	format_outputs = {
-		'column': format_qa_output_column,
-		'default': format_qa_output
-	}
-
-	format_output = format_outputs.get(
-		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
-
-	style_file.flush()
-	del console_writer, f, style_file
-	qa_output = qa_output.getvalue()
-	qa_output = qa_output.splitlines(True)
-
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
 
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
+class Actions(object):
+	'''Handles post check result output and performs
+	the various vcs activities for committing the results'''
+
+	def __init__(self, repo_settings, options, scanner, vcs_settings):
+		self.repo_settings = repo_settings
+		self.options = options
+		self.scanner = scanner
+		self.vcs_settings = vcs_settings
+		self.repoman_settings = repo_settings.repoman_settings
+		self.suggest = {
+			'ignore_masked': False,
+			'include_dev': False,
+		}
+		if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
+			self.suggest['ignore_masked'] = True
+		if scanner.have['dev_keywords'] and not options.include_dev:
+			self.suggest['include_dev'] = True
+
+
+	def inform(self, can_force, result):
+		'''Inform the user of all the problems found'''
+		if self.suggest['ignore_masked'] or self.suggest['include_dev']:
+			self._suggest()
+		if self.options.mode != 'commit':
+			self._non_commit(result)
+			return False
+		else:
+			self._fail(result, can_force)
+			if self.options.pretend:
+				utilities.repoman_sez(
+					"\"So, you want to play it safe. Good call.\"\n")
+			return True
 
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
 
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
+	def perform(self, qa_output):
+		myunadded, mydeleted = self._vcs_unadded()
 
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+		myautoadd = self._vcs_autoadd(myunadded)
 
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		self._vcs_deleted(mydeleted)
 
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
+		if self.vcs_settings.vcs == "cvs":
 			mycvstree = cvstree.getentries("./", recursive=1)
 			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
 			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
@@ -340,7 +83,7 @@ def repoman_main(argv):
 			no_expansion = set(portage.cvstree.findoption(
 				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
 
-		if vcs_settings.vcs == "svn":
+		if self.vcs_settings.vcs == "svn":
 			with repoman_popen("svn status") as f:
 				svnstatus = f.readlines()
 			mychanged = [
@@ -363,7 +106,7 @@ def repoman_main(argv):
 				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
 				for prop in props if " - " in prop)
 
-		elif vcs_settings.vcs == "git":
+		elif self.vcs_settings.vcs == "git":
 			with repoman_popen(
 				"git diff-index --name-only "
 				"--relative --diff-filter=M HEAD") as f:
@@ -382,7 +125,7 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem[:-1] for elem in myremoved]
 
-		if vcs_settings.vcs == "bzr":
+		if self.vcs_settings.vcs == "bzr":
 			with repoman_popen("bzr status -S .") as f:
 				bzrstatus = f.readlines()
 			mychanged = [
@@ -403,7 +146,7 @@ def repoman_main(argv):
 				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
 			# Bazaar expands nothing.
 
-		if vcs_settings.vcs == "hg":
+		if self.vcs_settings.vcs == "hg":
 			with repoman_popen("hg status --no-status --modified .") as f:
 				mychanged = f.readlines()
 			mychanged = ["./" + elem.rstrip() for elem in mychanged]
@@ -416,9 +159,9 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem.rstrip() for elem in myremoved]
 
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
 
 			if not (a_file_is_changed or a_file_is_deleted_hg):
 				utilities.repoman_sez(
@@ -442,12 +185,12 @@ def repoman_main(argv):
 		mymanifests = list(mymanifests)
 		myheaders = []
 
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
+		commitmessage = self.options.commitmsg
+		if self.options.commitmsgfile:
 			try:
 				f = io.open(
 					_unicode_encode(
-						options.commitmsgfile,
+						self.options.commitmsgfile,
 						encoding=_encodings['fs'], errors='strict'),
 					mode='r', encoding=_encodings['content'], errors='replace')
 				commitmessage = f.read()
@@ -457,15 +200,15 @@ def repoman_main(argv):
 				if e.errno == errno.ENOENT:
 					portage.writemsg(
 						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
+						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
 			# We've read the content so the file is no longer needed.
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
+			if self.scanner.repolevel > 1:
+				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -484,29 +227,29 @@ def repoman_main(argv):
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
 		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
 		if portage_version is None:
 			sys.stderr.write("Failed to insert portage version in message!\n")
 			sys.stderr.flush()
 			portage_version = "Unknown"
 
 		report_options = []
-		if options.force:
+		if self.options.force:
 			report_options.append("--force")
-		if options.ignore_arches:
+		if self.options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
+		if self.scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
+				" ".join(sorted(self.scanner.include_arches)))
 
-		if vcs_settings.vcs == "git":
+		if self.vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
 			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
 			if report_options:
 				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
 			if dco_sob:
 				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
@@ -520,10 +263,10 @@ def repoman_main(argv):
 			if dco_sob:
 				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
 			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
+				(portage_version, self.vcs_settings.vcs, unameout)
 			if report_options:
 				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += ", signed Manifest commit with key %s" % \
 					(gpg_key, )
 			else:
@@ -533,24 +276,24 @@ def repoman_main(argv):
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
+		if self.options.echangelog in ('y', 'force'):
 			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
 				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
+				checkdir = self.repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if scanner.repolevel < 3:
+				if self.scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
+				if self.scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
 					continue
 
 				# get changes for this package
@@ -566,15 +309,15 @@ def repoman_main(argv):
 				nontrivial_cl_files = set()
 				nontrivial_cl_files.update(clnew, clremoved, clchanged)
 				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
 					continue
 
 				new_changelog = utilities.UpdateChangeLog(
 					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
 					catdir, pkgdir,
 					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
+					pretend=self.options.pretend)
 				if new_changelog is None:
 					writemsg_level(
 						"!!! Updating the ChangeLog failed\n",
@@ -588,18 +331,18 @@ def repoman_main(argv):
 				else:
 					myupdates.append(changelog_path)
 
-				if options.ask and not options.pretend:
+				if self.options.ask and not self.options.pretend:
 					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 				else:
 					broken_changelog_manifests.append(x)
 
 		if myautoadd:
 			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
+			add_cmd = [self.vcs_settings.vcs, "add"]
 			add_cmd += myautoadd
-			if options.pretend:
+			if self.options.pretend:
 				portage.writemsg_stdout(
 					"(%s)\n" % " ".join(add_cmd),
 					noiselevel=-1)
@@ -618,22 +361,22 @@ def repoman_main(argv):
 				retcode = subprocess.call(add_cmd)
 				if retcode != os.EX_OK:
 					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
 					sys.exit(retcode)
 
 			myupdates += myautoadd
 
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
-		if vcs_settings.vcs not in ('cvs', 'svn'):
+		if self.vcs_settings.vcs not in ('cvs', 'svn'):
 			# With git, bzr and hg, there's never any keyword expansion, so
 			# there's no need to regenerate manifests and all files will be
 			# committed in one big commit at the end.
 			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
+		elif not self.repo_settings.repo_config.thin_manifest:
+			if self.vcs_settings.vcs == 'cvs':
 				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
+			elif self.vcs_settings.vcs == "svn":
 				svn_keywords = dict((k.lower(), k) for k in [
 					"Rev",
 					"Revision",
@@ -651,12 +394,12 @@ def repoman_main(argv):
 			for myfile in myupdates:
 
 				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
+				if self.vcs_settings.vcs == "cvs":
 					if myfile in no_expansion:
 						continue
 
 				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
+				elif self.vcs_settings.vcs == "svn":
 					if myfile not in expansion:
 						continue
 
@@ -684,8 +427,8 @@ def repoman_main(argv):
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
 
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
+		uq = UserQuery(self.options)
+		if self.options.ask and uq.query('Commit changes?', True) != 'Yes':
 			print("* aborting commit.")
 			sys.exit(128 + signal.SIGINT)
 
@@ -713,22 +456,22 @@ def repoman_main(argv):
 			# so strip the prefix.
 			myfiles = [f.lstrip("./") for f in myfiles]
 
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+			commit_cmd = [self.vcs_settings.vcs]
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
 			commit_cmd.extend(["-F", commitmessagefile])
 			commit_cmd.extend(myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -759,39 +502,39 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if scanner.repolevel == 1:
+		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
 
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
+		if self.vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		elif broken_changelog_manifests:
 			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
-		if repo_settings.sign_manifests:
+		if self.repo_settings.sign_manifests:
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
+					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):
 						continue
-					gpgsign(manifest_path, repoman_settings, options)
+					gpgsign(manifest_path, self.repoman_settings, self.options)
 			except portage.exception.PortageException as e:
 				portage.writemsg("!!! %s\n" % str(e))
 				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
+				self.repo_settings.sign_manifests = False
 
-		if vcs_settings.vcs == 'git':
+		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
 			# be some modified files elsewhere in the working tree that the
 			# user doesn't want to commit. Therefore, call git update-index
@@ -802,14 +545,14 @@ def repoman_main(argv):
 			myfiles.sort()
 			update_index_cmd = ["git", "update-index"]
 			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
+			if self.options.pretend:
 				print("(%s)" % (" ".join(update_index_cmd),))
 			else:
 				retval = spawn(update_index_cmd, env=os.environ)
 				if retval != os.EX_OK:
 					writemsg_level(
 						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
@@ -829,15 +572,15 @@ def repoman_main(argv):
 			mymsg.close()
 
 			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
+			if self.options.pretend and self.vcs_settings.vcs is None:
 				# substitute a bogus value for pretend output
 				commit_cmd.append("cvs")
 			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+				commit_cmd.append(self.vcs_settings.vcs)
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+			if self.vcs_settings.vcs == "hg":
 				commit_cmd.extend(["--logfile", commitmessagefile])
 				commit_cmd.extend(myfiles)
 			else:
@@ -845,12 +588,12 @@ def repoman_main(argv):
 				commit_cmd.extend(f.lstrip("./") for f in myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
+						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
 							not git_supports_gpg_sign():
 							# Inform user that newer git is needed (bug #403323).
 							logging.error(
@@ -858,7 +601,7 @@ def repoman_main(argv):
 
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -868,7 +611,7 @@ def repoman_main(argv):
 					pass
 
 		print()
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			print("Commit complete.")
 		else:
 			print(
@@ -877,4 +620,155 @@ def repoman_main(argv):
 				" that he forgot to commit anything")
 		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"\n")
-	sys.exit(0)
+		return
+
+
+	def _suggest(self):
+		print()
+		if self.suggest['ignore_masked']:
+			print(bold(
+				"Note: use --without-mask to check "
+				"KEYWORDS on dependencies of masked packages"))
+
+		if self.suggest['include_dev']:
+			print(bold(
+				"Note: use --include-dev (-d) to check "
+				"dependencies for 'dev' profiles"))
+		print()
+
+
+	def _non_commit(self, result):
+		if result['full']:
+			print(bold("Note: type \"repoman full\" for a complete listing."))
+		if result['warn'] and not result['fail']:
+			utilities.repoman_sez(
+				"\"You're only giving me a partial QA payment?\n"
+				"              I'll take it this time, but I'm not happy.\"")
+		elif not result['fail']:
+			utilities.repoman_sez(
+				"\"If everyone were like you, I'd be out of business!\"")
+		elif result['fail']:
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _fail(self, result, can_force):
+		if result['fail'] and can_force and self.options.force and not self.options.pretend:
+			utilities.repoman_sez(
+				" \"You want to commit even with these QA issues?\n"
+				"              I'll take it this time, but I'm not happy.\"\n")
+		elif result['fail']:
+			if self.options.force and not can_force:
+				print(bad(
+					"The --force option has been disabled"
+					" due to extraordinary issues."))
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _vcs_unadded(self):
+		myunadded = []
+		mydeleted = []
+		if self.vcs_settings.vcs == "cvs":
+			try:
+				myvcstree = portage.cvstree.getentries("./", recursive=1)
+				myunadded = portage.cvstree.findunadded(
+					myvcstree, recursive=1, basedir="./")
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving CVS tree; exiting.")
+		if self.vcs_settings.vcs == "svn":
+			try:
+				with repoman_popen("svn status --no-ignore") as f:
+					svnstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1]
+					for elem in svnstatus
+					if elem.startswith("?") or elem.startswith("I")]
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving SVN info; exiting.")
+		if self.vcs_settings.vcs == "git":
+			# get list of files not under version control or missing
+			myf = repoman_popen("git ls-files --others")
+			myunadded = ["./" + elem[:-1] for elem in myf]
+			myf.close()
+		if self.vcs_settings.vcs == "bzr":
+			try:
+				with repoman_popen("bzr status -S .") as f:
+					bzrstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
+					for elem in bzrstatus
+					if elem.startswith("?") or elem[0:2] == " D"]
+			except SystemExit:
+				raise # TODO propagate this
+			except:
+				err("Error retrieving bzr info; exiting.")
+		if self.vcs_settings.vcs == "hg":
+			with repoman_popen("hg status --no-status --unknown .") as f:
+				myunadded = f.readlines()
+			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+
+			# Mercurial doesn't handle manually deleted files as removed from
+			# the repository, so the user need to remove them before commit,
+			# using "hg remove [FILES]"
+			with repoman_popen("hg status --no-status --deleted .") as f:
+				mydeleted = f.readlines()
+			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		return myunadded, mydeleted
+
+
+	def _vcs_autoadd(self, myunadded):
+		myautoadd = []
+		if myunadded:
+			for x in range(len(myunadded) - 1, -1, -1):
+				xs = myunadded[x].split("/")
+				if self.repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
+					# The Manifest excludes this file,
+					# so it's safe to ignore.
+					del myunadded[x]
+				elif xs[-1] == "files":
+					print("!!! files dir is not added! Please correct this.")
+					sys.exit(-1)
+				elif xs[-1] == "Manifest":
+					# It's a manifest... auto add
+					myautoadd += [myunadded[x]]
+					del myunadded[x]
+
+		if myunadded:
+			print(red(
+				"!!! The following files are in your local tree"
+				" but are not added to the master"))
+			print(red(
+				"!!! tree. Please remove them from the local tree"
+				" or add them to the master tree."))
+			for x in myunadded:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)
+		return myautoadd
+
+
+	def _vcs_deleted(self, mydeleted):
+		if self.vcs_settings.vcs == "hg" and mydeleted:
+			print(red(
+				"!!! The following files are removed manually"
+				" from your local tree but are not"))
+			print(red(
+				"!!! removed from the repository."
+				" Please remove them, using \"hg remove [FILES]\"."))
+			for x in mydeleted:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2b2f91d..808c55e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,16 +4,9 @@
 
 from __future__ import print_function, unicode_literals
 
-import errno
 import io
 import logging
-import re
-import signal
-import subprocess
 import sys
-import tempfile
-import platform
-from itertools import chain
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -26,36 +19,24 @@ portage._disable_legacy_globals()
 
 
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree
 from portage import util
-from portage.process import find_binary, spawn
-from portage.output import (
-	bold, create_color_func, green, nocolor, red)
+from portage.output import create_color_func, nocolor
 from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import formatter
-from portage.util import writemsg_level
-from portage.package.ebuild.digestgen import digestgen
 
+from repoman.actions import Actions
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import checks_init
-from repoman.errors import err
-from repoman.gpg import gpgsign, need_signature
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats)
 from repoman.repos import RepoSettings
 from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
+from repoman.vcs.vcs import VCSSettings
 
 if sys.hexversion >= 0x3000000:
 	basestring = str
@@ -107,7 +88,6 @@ def repoman_main(argv):
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
 
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
@@ -131,27 +111,29 @@ def repoman_main(argv):
 	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
+	result = {
+		# fail will be true if we have failed in at least one non-warning category
+		'fail': 0,
+		# warn will be true if we tripped any warnings
+		'warn': 0,
+		# full will be true if we should print a "repoman full" informational message
+		'full': options.mode != 'full',
+	}
 
 	# early out for manifest generation
 	if options.mode == "manifest":
-		sys.exit(dofail)
+		sys.exit(result['fail'])
 
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
-		dowarn = 1
+		result['warn'] = 1
 		if x not in qawarnings:
-			dofail = 1
+			result['fail'] = 1
 
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
+	if result['fail'] or \
+		(result['warn'] and not (options.quiet or options.mode == "scan")):
+		result['full'] = 0
 
 	# Save QA output so that it can be conveniently displayed
 	# in $EDITOR while the user creates a commit message.
@@ -174,707 +156,17 @@ def repoman_main(argv):
 
 	format_output = format_outputs.get(
 		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
+	format_output(f, qatracker.fails, result['full'], result['fail'], options, qawarnings)
 
 	style_file.flush()
 	del console_writer, f, style_file
 	qa_output = qa_output.getvalue()
 	qa_output = qa_output.splitlines(True)
 
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
-
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
-
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
-
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
-
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
-
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
-
-		if vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
-
-		# Manifests need to be regenerated after all other commits, so don't commit
-		# them now even if they have changed.
-		mymanifests = set()
-		myupdates = set()
-		for f in mychanged + mynew:
-			if "Manifest" == os.path.basename(f):
-				mymanifests.add(f)
-			else:
-				myupdates.add(f)
-		myupdates.difference_update(myremoved)
-		myupdates = list(myupdates)
-		mymanifests = list(mymanifests)
-		myheaders = []
-
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
-			try:
-				f = io.open(
-					_unicode_encode(
-						options.commitmsgfile,
-						encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['content'], errors='replace')
-				commitmessage = f.read()
-				f.close()
-				del f
-			except (IOError, OSError) as e:
-				if e.errno == errno.ENOENT:
-					portage.writemsg(
-						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
-				else:
-					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
-		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
-
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
-		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if options.force:
-			report_options.append("--force")
-		if options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
-
-		if vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
-
-		commitmessage += commit_footer
-
-		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if options.ask and not options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
-		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
-
-		if vcs_settings.vcs not in ('cvs', 'svn'):
-			# With git, bzr and hg, there's never any keyword expansion, so
-			# there's no need to regenerate manifests and all files will be
-			# committed in one big commit at the end.
-			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
-
-		logging.info("myupdates: %s", myupdates)
-		logging.info("myheaders: %s", myheaders)
-
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
-			print("* aborting commit.")
-			sys.exit(128 + signal.SIGINT)
-
-		# Handle the case where committed files have keywords which
-		# will change and need a priming commit before the Manifest
-		# can be committed.
-		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		# When files are removed and re-added, the cvs server will put /Attic/
-		# inside the $Header path. This code detects the problem and corrects it
-		# so that the Manifest will generate correctly. See bug #169500.
-		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
-
-		if scanner.repolevel == 1:
-			utilities.repoman_sez(
-				"\"You're rather crazy... "
-				"doing the entire repository.\"\n")
-
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		elif broken_changelog_manifests:
-			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		if repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, repoman_settings, options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
-
-		if vcs_settings.vcs == 'git':
-			# It's not safe to use the git commit -a option since there might
-			# be some modified files elsewhere in the working tree that the
-			# user doesn't want to commit. Therefore, call git update-index
-			# in order to ensure that the index is updated with the latest
-			# versions of all new and modified files in the relevant portion
-			# of the working tree.
-			myfiles = mymanifests + myupdates
-			myfiles.sort()
-			update_index_cmd = ["git", "update-index"]
-			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
-				print("(%s)" % (" ".join(update_index_cmd),))
-			else:
-				retval = spawn(update_index_cmd, env=os.environ)
-				if retval != os.EX_OK:
-					writemsg_level(
-						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(retval)
-
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		print()
-		if vcs_settings.vcs:
-			print("Commit complete.")
-		else:
-			print(
-				"repoman was too scared"
-				" by not seeing any familiar version control file"
-				" that he forgot to commit anything")
-		utilities.repoman_sez(
-			"\"If everyone were like you, I'd be out of business!\"\n")
+	# output the results
+	actions = Actions(repo_settings, options, scanner, vcs_settings)
+	if actions.inform(can_force, result):
+		# perform any other actions
+		actions.perform(qa_output)
+
 	sys.exit(0)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     b6e251f2f8c1aae87092306813898f5af03e9bec
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:59:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b6e251f2

repoman/actions.py: Split out the commit footer to a function

 pym/repoman/actions.py | 95 ++++++++++++++++++++++++++------------------------
 1 file changed, 49 insertions(+), 46 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 1f70815..e9bf147 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -133,53 +133,8 @@ class Actions(object):
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if self.options.force:
-			report_options.append("--force")
-		if self.options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if self.scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(self.scanner.include_arches)))
-
-		if self.vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, self.vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
 
+		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
@@ -797,3 +752,51 @@ class Actions(object):
 		expansion = {}
 		return  (mynew, mychanged, myremoved, no_expansion, expansion)
 
+
+	def get_commit_footer(self):
+		portage_version = getattr(portage, "VERSION", None)
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		report_options = []
+		if self.options.force:
+			report_options.append("--force")
+		if self.options.ignore_arches:
+			report_options.append("--ignore-arches")
+		if self.scanner.include_arches is not None:
+			report_options.append(
+				"--include-arches=\"%s\"" %
+				" ".join(sorted(self.scanner.include_arches)))
+
+		if portage_version is None:
+			sys.stderr.write("Failed to insert portage version in message!\n")
+			sys.stderr.flush()
+			portage_version = "Unknown"
+		# Use new footer only for git (see bug #438364).
+		if self.vcs_settings.vcs in ["git"]:
+			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
+			if report_options:
+				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
+			if dco_sob:
+				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
+		else:
+			unameout = platform.system() + " "
+			if platform.system() in ["Darwin", "SunOS"]:
+				unameout += platform.processor()
+			else:
+				unameout += platform.machine()
+			commit_footer = "\n\n"
+			if dco_sob:
+				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
+			commit_footer += "(Portage version: %s/%s/%s" % \
+				(portage_version, self.vcs_settings.vcs, unameout)
+			if report_options:
+				commit_footer += ", RepoMan options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += ", signed Manifest commit with key %s" % \
+					(gpg_key, )
+			else:
+				commit_footer += ", unsigned Manifest commit"
+			commit_footer += ")"
+		return commit_footer


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     f0f1958d8e21b3a11eb6a1a4441527f7f3d5c60a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:59:10 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0f1958d

repoman/actions.py: split out a manifest function

 pym/repoman/actions.py | 110 +++++++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index d70dd82..405a8c7 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -330,59 +330,7 @@ class Actions(object):
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if self.options.pretend and self.vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(self.vcs_settings.vcs)
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			if self.vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+		self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage)
 
 		print()
 		if self.vcs_settings.vcs:
@@ -807,3 +755,59 @@ class Actions(object):
 
 			myupdates += myautoadd
 		return myupdates, broken_changelog_manifests
+
+
+	def add_manifest(self, mymanifests, myheaders, myupdates, myremoved,
+					commitmessage):
+		myfiles = mymanifests[:]
+		# If there are no header (SVN/CVS keywords) changes in
+		# the files, this Manifest commit must include the
+		# other (yet uncommitted) files.
+		if not myheaders:
+			myfiles += myupdates
+			myfiles += myremoved
+		myfiles.sort()
+
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		commit_cmd = []
+		if self.options.pretend and self.vcs_settings.vcs is None:
+			# substitute a bogus value for pretend output
+			commit_cmd.append("cvs")
+		else:
+			commit_cmd.append(self.vcs_settings.vcs)
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		if self.vcs_settings.vcs == "hg":
+			commit_cmd.extend(["--logfile", commitmessagefile])
+			commit_cmd.extend(myfiles)
+		else:
+			commit_cmd.extend(["-F", commitmessagefile])
+			commit_cmd.extend(f.lstrip("./") for f in myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
+						not git_supports_gpg_sign():
+						# Inform user that newer git is needed (bug #403323).
+						logging.error(
+							"Git >=1.7.9 is required for signed commits!")
+
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     dfbca13b96e7dc73157030be3c1e8ae8ee6311b3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:25:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dfbca13b

repoman/actions.py: Split out thick_manifest()

 pym/repoman/actions.py | 101 +++++++++++++++++++++++++------------------------
 1 file changed, 52 insertions(+), 49 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index af50c1b..974de62 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -146,55 +146,7 @@ class Actions(object):
 			# committed in one big commit at the end.
 			print()
 		elif not self.repo_settings.repo_config.thin_manifest:
-			if self.vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif self.vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if self.vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif self.vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
+			self.thick_manifest(myupdates, myheaders, no_expansion, expansion)
 
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
@@ -814,3 +766,54 @@ class Actions(object):
 			except OSError:
 				pass
 
+
+	def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
+			if self.vcs_settings.vcs == 'cvs':
+				headerstring = "'\$(Header|Id).*\$'"
+			elif self.vcs_settings.vcs == "svn":
+				svn_keywords = dict((k.lower(), k) for k in [
+					"Rev",
+					"Revision",
+					"LastChangedRevision",
+					"Date",
+					"LastChangedDate",
+					"Author",
+					"LastChangedBy",
+					"URL",
+					"HeadURL",
+					"Id",
+					"Header",
+				])
+
+			for myfile in myupdates:
+
+				# for CVS, no_expansion contains files that are excluded from expansion
+				if self.vcs_settings.vcs == "cvs":
+					if myfile in no_expansion:
+						continue
+
+				# for SVN, expansion contains files that are included in expansion
+				elif self.vcs_settings.vcs == "svn":
+					if myfile not in expansion:
+						continue
+
+					# Subversion keywords are case-insensitive
+					# in svn:keywords properties,
+					# but case-sensitive in contents of files.
+					enabled_keywords = []
+					for k in expansion[myfile]:
+						keyword = svn_keywords.get(k.lower())
+						if keyword is not None:
+							enabled_keywords.append(keyword)
+
+					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
+
+				myout = repoman_getstatusoutput(
+					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
+				if myout[0] == 0:
+					myheaders.append(myfile)
+
+			print("%s have headers that will change." % green(str(len(myheaders))))
+			print(
+				"* Files with headers will"
+				" cause the manifests to be changed and committed separately.")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     50639f3d31486c1279a96739ef00466536bf6aeb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:34:01 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:01:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=50639f3d

repoman/actions.py: Split out get_new_commit_message()

 pym/repoman/actions.py | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 4f516da..9d97b20 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -111,24 +111,8 @@ class Actions(object):
 				else:
 					raise
 		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if self.scanner.repolevel > 1:
-				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+			commitmessage = self.get_new_commit_message(qa_output)
 
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 
 		myupdates, broken_changelog_manifests = self.changelogs(
@@ -826,3 +810,24 @@ class Actions(object):
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")
 			self.repo_settings.sign_manifests = False
 
+
+	def get_new_commit_message(self, qa_output):
+		msg_prefix = ""
+		if self.scanner.repolevel > 1:
+			msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+
+		try:
+			editor = os.environ.get("EDITOR")
+			if editor and utilities.editor_is_executable(editor):
+				commitmessage = utilities.get_commit_message_with_editor(
+					editor, message=qa_output, prefix=msg_prefix)
+			else:
+				commitmessage = utilities.get_commit_message_with_stdin()
+		except KeyboardInterrupt:
+			logging.fatal("Interrupted; exiting...")
+			sys.exit(1)
+		if (not commitmessage or not commitmessage.strip()
+				or commitmessage.strip() == msg_prefix):
+			print("* no commit message?  aborting commit.")
+			sys.exit(1)
+		return commitmessage


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     22fc20dea05f86d061826dc39026e10a8fec1497
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:27:19 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:01:42 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=22fc20de

repoamn/actions.py: Split out sign_manifest()

 pym/repoman/actions.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 5b55ff8..4f516da 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -186,19 +186,7 @@ class Actions(object):
 				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		if self.repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
-					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, self.repoman_settings, self.options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				self.repo_settings.sign_manifests = False
+			self.sign_manifests(myupdates, myremoved, mymanifests)
 
 		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
@@ -821,3 +809,20 @@ class Actions(object):
 					modified = True
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+
+
+	def sign_manifest(self, myupdates, myremoved, mymanifests):
+		try:
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, myremoved, mymanifests),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
+				if not need_signature(manifest_path):
+					continue
+				gpgsign(manifest_path, self.repoman_settings, self.options)
+		except portage.exception.PortageException as e:
+			portage.writemsg("!!! %s\n" % str(e))
+			portage.writemsg("!!! Disabled FEATURES='sign'\n")
+			self.repo_settings.sign_manifests = False
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     13255057f276b7ec1fe14528490502b5916ed879
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 15:29:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=13255057

repoman: Move the primary checks loop to it's own class and file

Only minimal changes were done for this initial move.
The _scan_ebuilds() needs major hacking up into manageable chunks.
Clean out code separation demarcation lines
These lines were originally used to mark places where code was removed.
And replaced with a class instance and/or function call.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 756 ++-----------------------------------------------
 pym/repoman/scanner.py | 715 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 743 insertions(+), 728 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e3d0472..2b2f91d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,7 +4,6 @@
 
 from __future__ import print_function, unicode_literals
 
-import copy
 import errno
 import io
 import logging
@@ -15,7 +14,6 @@ import sys
 import tempfile
 import platform
 from itertools import chain
-from pprint import pformat
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -30,14 +28,12 @@ portage._disable_legacy_globals()
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.Package import Package
 from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree, normalize_path
+from portage import cvstree
 from portage import util
-from portage.dep import Atom
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -47,40 +43,18 @@ from portage.util import writemsg_level
 from portage.package.ebuild.digestgen import digestgen
 
 from repoman.argparser import parse_args
-from repoman.checks.directories.files import FileChecks
-from repoman.checks.ebuilds.checks import run_checks, checks_init
-from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.checks.ebuilds.fetches import FetchChecks
-from repoman.checks.ebuilds.keywords import KeywordChecks
-from repoman.checks.ebuilds.isebuild import IsEbuild
-from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
-from repoman.checks.ebuilds.manifests import Manifests
-from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
-from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
-from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
-from repoman.checks.ebuilds.variables.eapi import EAPIChecks
-from repoman.checks.ebuilds.variables.license import LicenseChecks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
-from repoman.ebuild import Ebuild
+from repoman.checks.ebuilds.checks import checks_init
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats, missingvars,
-	suspect_virtual, suspect_rdepend)
-from repoman.qa_tracker import QATracker
-from repoman.repos import RepoSettings, repo_metadata
-from repoman.scan import Changes, scan
+	qawarnings, qacats)
+from repoman.repos import RepoSettings
+from repoman.scanner import Scanner
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (
 	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-from repoman.vcs.vcsstatus import VCSStatus
 
 
 if sys.hexversion >= 0x3000000:
@@ -90,21 +64,11 @@ util.initialize_logger()
 
 bad = create_color_func("BAD")
 
-live_eclasses = portage.const.LIVE_ECLASSES
-non_ascii_re = re.compile(r'[^\x00-\x7f]')
-
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
-def sort_key(item):
-	return item[2].sub_path
-
 
 def repoman_main(argv):
-	# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
-	# behave incrementally.
-	repoman_incrementals = tuple(
-		x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
 	config_root = os.environ.get("PORTAGE_CONFIGROOT")
 	repoman_settings = portage.config(config_root=config_root, local_config=False)
 
@@ -142,30 +106,9 @@ def repoman_main(argv):
 	repo_settings = RepoSettings(
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
-
 	repoman_settings = repo_settings.repoman_settings
-
 	portdb = repo_settings.portdb
 
-	if options.echangelog is None and repo_settings.repo_config.update_changelog:
-		options.echangelog = 'y'
-
-	if vcs_settings.vcs is None:
-		options.echangelog = 'n'
-
-	# The --echangelog option causes automatic ChangeLog generation,
-	# which invalidates changelog.ebuildadded and changelog.missing
-	# checks.
-	# Note: Some don't use ChangeLogs in distributed SCMs.
-	# It will be generated on server side from scm log,
-	# before package moves to the rsync server.
-	# This is needed because they try to avoid merge collisions.
-	# Gentoo's Council decided to always use the ChangeLog file.
-	# TODO: shouldn't this just be switched on the repo, iso the VCS?
-	is_echangelog_enabled = options.echangelog in ('y', 'force')
-	vcs_settings.vcs_is_cvs_or_svn = vcs_settings.vcs in ('cvs', 'svn')
-	check_changelog = not is_echangelog_enabled and vcs_settings.vcs_is_cvs_or_svn
-
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
 
@@ -178,663 +121,16 @@ def repoman_main(argv):
 	env = os.environ.copy()
 	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
 
-	categories = []
-	for path in repo_settings.repo_config.eclass_db.porttrees:
-		categories.extend(portage.util.grabfile(
-			os.path.join(path, 'profiles', 'categories')))
-	repoman_settings.categories = frozenset(
-		portage.util.stack_lists([categories], incremental=1))
-	categories = repoman_settings.categories
-
-	portdb.settings = repoman_settings
-	# We really only need to cache the metadata that's necessary for visibility
-	# filtering. Anything else can be discarded to reduce memory consumption.
-	portdb._aux_cache_keys.clear()
-	portdb._aux_cache_keys.update(
-		["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
-
-	reposplit = myreporoot.split(os.path.sep)
-	repolevel = len(reposplit)
-
-	###################
-	commitmessage = None
-	if options.mode == 'commit':
-		repochecks.commit_check(repolevel, reposplit)
-		repochecks.conflict_check(vcs_settings, options)
-
-	###################
-
-	# Make startdir relative to the canonical repodir, so that we can pass
-	# it to digestgen and it won't have to be canonicalized again.
-	if repolevel == 1:
-		startdir = repo_settings.repodir
-	else:
-		startdir = normalize_path(mydir)
-		startdir = os.path.join(
-			repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-	###################
-
-
-	# get lists of valid keywords, licenses, and use
-	new_data = repo_metadata(repo_settings.portdb, repoman_settings)
-	kwlist, liclist, uselist, profile_list, \
-		global_pmaskdict, liclist_deprecated = new_data
-
-	repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
-	repoman_settings.backup_changes('PORTAGE_ARCHLIST')
-
-	####################
-
-	profiles = setup_profile(profile_list)
-
-	####################
-
-	check_profiles(profiles, repoman_settings.archlist())
-
-	####################
-
-	scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
-
-	####################
-
-	dev_keywords = dev_profile_keywords(profiles)
-
-	qatracker = QATracker()
-
-
-	if options.mode == "manifest":
-		pass
-	elif options.pretend:
-		print(green("\nRepoMan does a once-over of the neighborhood..."))
-	else:
-		print(green("\nRepoMan scours the neighborhood..."))
-
-	#####################
-
-	changed = Changes(options)
-	changed.scan(vcs_settings)
-
-	######################
-
-	have_pmasked = False
-	have_dev_keywords = False
-	dofail = 0
-
-	# NOTE: match-all caches are not shared due to potential
-	# differences between profiles in _get_implicit_iuse.
-	arch_caches = {}
-	arch_xmatch_caches = {}
-	shared_xmatch_caches = {"cp-list": {}}
-
-	include_arches = None
-	if options.include_arches:
-		include_arches = set()
-		include_arches.update(*[x.split() for x in options.include_arches])
-
-	# Disable the "ebuild.notadded" check when not in commit mode and
-	# running `svn status` in every package dir will be too expensive.
-
-	check_ebuild_notadded = not \
-		(vcs_settings.vcs == "svn" and repolevel < 3 and options.mode != "commit")
-
-	effective_scanlist = scanlist
-	if options.if_modified == "y":
-		effective_scanlist = sorted(vcs_files_to_cps(
-			chain(changed.changed, changed.new, changed.removed),
-			repolevel, reposplit, categories))
-
-	######################
-	# initialize our checks classes here before the big xpkg loop
-	manifester = Manifests(options, qatracker, repoman_settings)
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
-	filescheck = FileChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	status_check = VCSStatus(vcs_settings, qatracker)
-	fetchcheck = FetchChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
-	thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
-	use_flag_checks = USEFlagChecks(qatracker, uselist)
-	keywordcheck = KeywordChecks(qatracker, options)
-	liveeclasscheck = LiveEclassChecks(qatracker)
-	rubyeclasscheck = RubyEclassChecks(qatracker)
-	eapicheck = EAPIChecks(qatracker, repo_settings)
-	descriptioncheck = DescriptionChecks(qatracker)
-	licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated)
-	restrictcheck = RestrictChecks(qatracker)
-	######################
-
-	for xpkg in effective_scanlist:
-		# ebuilds and digests added to cvs respectively.
-		logging.info("checking package %s" % xpkg)
-		# save memory by discarding xmatch caches from previous package(s)
-		arch_xmatch_caches.clear()
-		eadded = []
-		catdir, pkgdir = xpkg.split("/")
-		checkdir = repo_settings.repodir + "/" + xpkg
-		checkdir_relative = ""
-		if repolevel < 3:
-			checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-		if repolevel < 2:
-			checkdir_relative = os.path.join(catdir, checkdir_relative)
-		checkdir_relative = os.path.join(".", checkdir_relative)
-
-	#####################
-		if manifester.run(checkdir, portdb):
-			continue
-		if not manifester.generated_manifest:
-			manifester.digest_check(xpkg, checkdir)
-	######################
-
-		if options.mode == 'manifest-check':
-			continue
-
-		checkdirlist = os.listdir(checkdir)
-
-	######################
-		pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
-		if is_ebuild.continue_:
-			# If we can't access all the metadata then it's totally unsafe to
-			# commit since there's no way to generate a correct Manifest.
-			# Do not try to do any more QA checks on this package since missing
-			# metadata leads to false positives for several checks, and false
-			# positives confuse users.
-			can_force = False
-			continue
-	######################
-
-		keywordcheck.prepare()
-
-		# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
-		ebuildlist = sorted(pkgs.values())
-		ebuildlist = [pkg.pf for pkg in ebuildlist]
-	#######################
-		filescheck.check(
-			checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new)
-	#######################
-		status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
-		eadded.extend(status_check.eadded)
-
-	#################
-		fetchcheck.check(
-			xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
-	#################
-
-		if check_changelog and "ChangeLog" not in checkdirlist:
-			qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
-	#################
-		pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
-		muselist = frozenset(pkgmeta.musedict)
-	#################
-
-		changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-		changelog_modified = changelog_path in changed.changelogs
-
-		# detect unused local USE-descriptions
-		used_useflags = set()
-
-		for y_ebuild in ebuildlist:
-			##################
-			ebuild = Ebuild(
-				repo_settings, repolevel, pkgdir, catdir, vcs_settings,
-				xpkg, y_ebuild)
-			##################
-
-			if check_changelog and not changelog_modified \
-				and ebuild.ebuild_path in changed.new_ebuilds:
-				qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
-
-			if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded):
-				# ebuild not added to vcs
-				qatracker.add_error(
-					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
-
-	##################
-			if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker):
-				continue
-	###################
-			pkg = pkgs[y_ebuild]
-			if pkg_invalid(pkg, qatracker, ebuild):
-				allvalid = False
-				continue
-
-			myaux = pkg._metadata
-			eapi = myaux["EAPI"]
-			inherited = pkg.inherited
-			live_ebuild = live_eclasses.intersection(inherited)
-
-			#######################
-			eapicheck.check(pkg, ebuild)
-			#######################
-
-			for k, v in myaux.items():
-				if not isinstance(v, basestring):
-					continue
-				m = non_ascii_re.search(v)
-				if m is not None:
-					qatracker.add_error(
-						"variable.invalidchar",
-						"%s: %s variable contains non-ASCII "
-						"character at position %s" %
-						(ebuild.relative_path, k, m.start() + 1))
-
-			if not fetchcheck.src_uri_error:
-				#######################
-				thirdparty.check(myaux, ebuild.relative_path)
-				#######################
-			if myaux.get("PROVIDE"):
-				qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
-
-			for pos, missing_var in enumerate(missingvars):
-				if not myaux.get(missing_var):
-					if catdir == "virtual" and \
-						missing_var in ("HOMEPAGE", "LICENSE"):
-						continue
-					if live_ebuild and missing_var == "KEYWORDS":
-						continue
-					myqakey = missingvars[pos] + ".missing"
-					qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
-			if catdir == "virtual":
-				for var in ("HOMEPAGE", "LICENSE"):
-					if myaux.get(var):
-						myqakey = var + ".virtual"
-						qatracker.add_error(myqakey, ebuild.relative_path)
-
-			#######################
-			descriptioncheck.check(pkg, ebuild)
-			#######################
-
-			keywords = myaux["KEYWORDS"].split()
-
-			ebuild_archs = set(
-				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
-
-			#######################
-			keywordcheck.check(
-				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed,
-				live_ebuild, kwlist, profiles)
-			#######################
-
-			if live_ebuild and repo_settings.repo_config.name == "gentoo":
-				#######################
-				liveeclasscheck.check(
-					pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict)
-				#######################
-
-			if options.ignore_arches:
-				arches = [[
-					repoman_settings["ARCH"], repoman_settings["ARCH"],
-					repoman_settings["ACCEPT_KEYWORDS"].split()]]
-			else:
-				arches = set()
-				for keyword in keywords:
-					if keyword[0] == "-":
-						continue
-					elif keyword[0] == "~":
-						arch = keyword[1:]
-						if arch == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (
-										expanded_arch, "~" + expanded_arch)))
-						else:
-							arches.add((keyword, arch, (arch, keyword)))
-					else:
-						if keyword == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (expanded_arch,)))
-						else:
-							arches.add((keyword, keyword, (keyword,)))
-				if not arches:
-					# Use an empty profile for checking dependencies of
-					# packages that have empty KEYWORDS.
-					arches.add(('**', '**', ('**',)))
-
-			unknown_pkgs = set()
-			baddepsyntax = False
-			badlicsyntax = False
-			badprovsyntax = False
-			# catpkg = catdir + "/" + y_ebuild
-
-			inherited_java_eclass = "java-pkg-2" in inherited or \
-				"java-pkg-opt-2" in inherited
-			inherited_wxwidgets_eclass = "wxwidgets" in inherited
-			# operator_tokens = set(["||", "(", ")"])
-			type_list, badsyntax = [], []
-			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
-				mydepstr = myaux[mytype]
-
-				buildtime = mytype in Package._buildtime_keys
-				runtime = mytype in Package._runtime_keys
-				token_class = None
-				if mytype.endswith("DEPEND"):
-					token_class = portage.dep.Atom
+	# Perform the main checks
+	scanner = Scanner(repo_settings, myreporoot, config_root, options,
+					vcs_settings, mydir, env)
+	qatracker, can_force = scanner.scan_pkgs(can_force)
 
-				try:
-					atoms = portage.dep.use_reduce(
-						mydepstr, matchall=1, flat=True,
-						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
-				except portage.exception.InvalidDependString as e:
-					atoms = None
-					badsyntax.append(str(e))
-
-				if atoms and mytype.endswith("DEPEND"):
-					if runtime and \
-						"test?" in mydepstr.split():
-						qatracker.add_error(
-							mytype + '.suspect',
-							"%s: 'test?' USE conditional in %s" %
-							(ebuild.relative_path, mytype))
-
-					for atom in atoms:
-						if atom == "||":
-							continue
-
-						is_blocker = atom.blocker
-
-						# Skip dependency.unknown for blockers, so that we
-						# don't encourage people to remove necessary blockers,
-						# as discussed in bug 382407. We use atom.without_use
-						# due to bug 525376.
-						if not is_blocker and \
-							not portdb.xmatch("match-all", atom.without_use) and \
-							not atom.cp.startswith("virtual/"):
-							unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
-						if catdir != "virtual":
-							if not is_blocker and \
-								atom.cp in suspect_virtual:
-								qatracker.add_error(
-									'virtual.suspect', ebuild.relative_path +
-									": %s: consider using '%s' instead of '%s'" %
-									(mytype, suspect_virtual[atom.cp], atom))
-							if not is_blocker and \
-								atom.cp.startswith("perl-core/"):
-								qatracker.add_error('dependency.perlcore',
-									ebuild.relative_path +
-									": %s: please use '%s' instead of '%s'" %
-									(mytype,
-									atom.replace("perl-core/","virtual/perl-"),
-									atom))
-
-						if buildtime and \
-							not is_blocker and \
-							not inherited_java_eclass and \
-							atom.cp == "virtual/jdk":
-							qatracker.add_error(
-								'java.eclassesnotused', ebuild.relative_path)
-						elif buildtime and \
-							not is_blocker and \
-							not inherited_wxwidgets_eclass and \
-							atom.cp == "x11-libs/wxGTK":
-							qatracker.add_error(
-								'wxwidgets.eclassnotused',
-								"%s: %ss on x11-libs/wxGTK without inheriting"
-								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
-						elif runtime:
-							if not is_blocker and \
-								atom.cp in suspect_rdepend:
-								qatracker.add_error(
-									mytype + '.suspect',
-									ebuild.relative_path + ": '%s'" % atom)
-
-						if atom.operator == "~" and \
-							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
-							qacat = 'dependency.badtilde'
-							qatracker.add_error(
-								qacat, "%s: %s uses the ~ operator"
-								" with a non-zero revision: '%s'" %
-								(ebuild.relative_path, mytype, atom))
-
-						check_missingslot(atom, mytype, eapi, portdb, qatracker,
-							ebuild.relative_path, myaux)
-
-				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
-			for m, b in zip(type_list, badsyntax):
-				if m.endswith("DEPEND"):
-					qacat = "dependency.syntax"
-				else:
-					qacat = m + ".syntax"
-				qatracker.add_error(
-					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
-
-			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
-			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
-			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
-			badlicsyntax = badlicsyntax > 0
-			badprovsyntax = badprovsyntax > 0
-
-			#################
-			use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
-
-			ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
-			#################
-			rubyeclasscheck.check(pkg, ebuild)
-			#################
-
-			# license checks
-			if not badlicsyntax:
-				#################
-				licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
-				#################
-
-			#################
-			restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
-			#################
-
-			# Syntax Checks
-
-			if not vcs_settings.vcs_preserves_mtime:
-				if ebuild.ebuild_path not in changed.new_ebuilds and \
-					ebuild.ebuild_path not in changed.ebuilds:
-					pkg.mtime = None
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, pkg):
-						qatracker.add_error(
-							check_name, ebuild.relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
-
-			if options.force:
-				# The dep_check() calls are the most expensive QA test. If --force
-				# is enabled, there's no point in wasting time on these since the
-				# user is intent on forcing the commit anyway.
-				continue
-
-			relevant_profiles = []
-			for keyword, arch, groups in arches:
-				if arch not in profiles:
-					# A missing profile will create an error further down
-					# during the KEYWORDS verification.
-					continue
-
-				if include_arches is not None:
-					if arch not in include_arches:
-						continue
-
-				relevant_profiles.extend(
-					(keyword, groups, prof) for prof in profiles[arch])
-
-			relevant_profiles.sort(key=sort_key)
-
-			for keyword, groups, prof in relevant_profiles:
-
-				is_stable_profile = prof.status == "stable"
-				is_dev_profile = prof.status == "dev" and \
-					options.include_dev
-				is_exp_profile = prof.status == "exp" and \
-					options.include_exp_profiles == 'y'
-				if not (is_stable_profile or is_dev_profile or is_exp_profile):
-					continue
+	commitmessage = None
 
-				dep_settings = arch_caches.get(prof.sub_path)
-				if dep_settings is None:
-					dep_settings = portage.config(
-						config_profile_path=prof.abs_path,
-						config_incrementals=repoman_incrementals,
-						config_root=config_root,
-						local_config=False,
-						_unmatched_removal=options.unmatched_removal,
-						env=env, repositories=repoman_settings.repositories)
-					dep_settings.categories = repoman_settings.categories
-					if options.without_mask:
-						dep_settings._mask_manager_obj = \
-							copy.deepcopy(dep_settings._mask_manager)
-						dep_settings._mask_manager._pmaskdict.clear()
-					arch_caches[prof.sub_path] = dep_settings
-
-				xmatch_cache_key = (prof.sub_path, tuple(groups))
-				xcache = arch_xmatch_caches.get(xmatch_cache_key)
-				if xcache is None:
-					portdb.melt()
-					portdb.freeze()
-					xcache = portdb.xcache
-					xcache.update(shared_xmatch_caches)
-					arch_xmatch_caches[xmatch_cache_key] = xcache
-
-				repo_settings.trees[repo_settings.root]["porttree"].settings = dep_settings
-				portdb.settings = dep_settings
-				portdb.xcache = xcache
-
-				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
-				# just in case, prevent config.reset() from nuking these.
-				dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
-				# This attribute is used in dbapi._match_use() to apply
-				# use.stable.{mask,force} settings based on the stable
-				# status of the parent package. This is required in order
-				# for USE deps of unstable packages to be resolved correctly,
-				# since otherwise use.stable.{mask,force} settings of
-				# dependencies may conflict (see bug #456342).
-				dep_settings._parent_stable = dep_settings._isStable(pkg)
-
-				# Handle package.use*.{force,mask) calculation, for use
-				# in dep_check.
-				dep_settings.useforce = dep_settings._use_manager.getUseForce(
-					pkg, stable=dep_settings._parent_stable)
-				dep_settings.usemask = dep_settings._use_manager.getUseMask(
-					pkg, stable=dep_settings._parent_stable)
-
-				if not baddepsyntax:
-					ismasked = not ebuild_archs or \
-						pkg.cpv not in portdb.xmatch("match-visible",
-						Atom("%s::%s" % (pkg.cp, repo_settings.repo_config.name)))
-					if ismasked:
-						if not have_pmasked:
-							have_pmasked = bool(dep_settings._getMaskAtom(
-								pkg.cpv, pkg._metadata))
-						if options.ignore_masked:
-							continue
-						# we are testing deps for a masked package; give it some lee-way
-						suffix = "masked"
-						matchmode = "minimum-all"
-					else:
-						suffix = ""
-						matchmode = "minimum-visible"
-
-					if not have_dev_keywords:
-						have_dev_keywords = \
-							bool(dev_keywords.intersection(keywords))
-
-					if prof.status == "dev":
-						suffix = suffix + "indev"
-
-					for mytype in Package._dep_keys:
-
-						mykey = "dependency.bad" + suffix
-						myvalue = myaux[mytype]
-						if not myvalue:
-							continue
-
-						success, atoms = portage.dep_check(
-							myvalue, portdb, dep_settings,
-							use="all", mode=matchmode, trees=repo_settings.trees)
-
-						if success:
-							if atoms:
-
-								# Don't bother with dependency.unknown for
-								# cases in which *DEPEND.bad is triggered.
-								for atom in atoms:
-									# dep_check returns all blockers and they
-									# aren't counted for *DEPEND.bad, so we
-									# ignore them here.
-									if not atom.blocker:
-										unknown_pkgs.discard(
-											(mytype, atom.unevaluated_atom))
-
-								if not prof.sub_path:
-									# old-style virtuals currently aren't
-									# resolvable with empty profile, since
-									# 'virtuals' mappings are unavailable
-									# (it would be expensive to search
-									# for PROVIDE in all ebuilds)
-									atoms = [
-										atom for atom in atoms if not (
-											atom.cp.startswith('virtual/')
-											and not portdb.cp_list(atom.cp))]
-
-								# we have some unsolvable deps
-								# remove ! deps, which always show up as unsatisfiable
-								atoms = [
-									str(atom.unevaluated_atom)
-									for atom in atoms if not atom.blocker]
-
-								# if we emptied out our list, continue:
-								if not atoms:
-									continue
-								qatracker.add_error(mykey,
-									"%s: %s: %s(%s)\n%s"
-									% (ebuild.relative_path, mytype, keyword, prof,
-										pformat(atoms, indent=6)))
-						else:
-							qatracker.add_error(mykey,
-								"%s: %s: %s(%s)\n%s"
-								% (ebuild.relative_path, mytype, keyword, prof,
-									pformat(atoms, indent=6)))
-
-			if not baddepsyntax and unknown_pkgs:
-				type_map = {}
-				for mytype, atom in unknown_pkgs:
-					type_map.setdefault(mytype, set()).add(atom)
-				for mytype, atoms in type_map.items():
-					qatracker.add_error(
-						"dependency.unknown", "%s: %s: %s"
-						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
-
-		# check if there are unused local USE-descriptions in metadata.xml
-		# (unless there are any invalids, to avoid noise)
-		if allvalid:
-			for myflag in muselist.difference(used_useflags):
-				qatracker.add_error(
-					"metadata.warning",
-					"%s/metadata.xml: unused local USE-description: '%s'"
-					% (xpkg, myflag))
-
-
-	if options.if_modified == "y" and len(effective_scanlist) < 1:
+	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
 	# dofail will be true if we have failed in at least one non-warning category
 	dofail = 0
 	# dowarn will be true if we tripped any warnings
@@ -842,6 +138,10 @@ def repoman_main(argv):
 	# dofull will be true if we should print a "repoman full" informational message
 	dofull = options.mode != 'full'
 
+	# early out for manifest generation
+	if options.mode == "manifest":
+		sys.exit(dofail)
+
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
@@ -884,9 +184,9 @@ def repoman_main(argv):
 	suggest_ignore_masked = False
 	suggest_include_dev = False
 
-	if have_pmasked and not (options.without_mask or options.ignore_masked):
+	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
 		suggest_ignore_masked = True
-	if have_dev_keywords and not options.include_dev:
+	if scanner.have['dev_keywords'] and not options.include_dev:
 		suggest_include_dev = True
 
 	if suggest_ignore_masked or suggest_include_dev:
@@ -1164,8 +464,8 @@ def repoman_main(argv):
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if repolevel > 1:
-				msg_prefix = "/".join(reposplit[1:]) + ": "
+			if scanner.repolevel > 1:
+				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -1196,10 +496,10 @@ def repoman_main(argv):
 			report_options.append("--force")
 		if options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if include_arches is not None:
+		if scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(include_arches)))
+				" ".join(sorted(scanner.include_arches)))
 
 		if vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
@@ -1238,18 +538,18 @@ def repoman_main(argv):
 			committer_name = utilities.get_committer_name(env=repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				catdir, pkgdir = x.split("/")
 				checkdir = repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if repolevel < 3:
+				if scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if repolevel < 2:
+				if scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in changed.changelogs
+				changelog_modified = changelog_path in scanner.changed.changelogs
 				if changelog_modified and options.echangelog != 'force':
 					continue
 
@@ -1459,7 +759,7 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if repolevel == 1:
+		if scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
@@ -1467,7 +767,7 @@ def repoman_main(argv):
 		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 				digestgen(mysettings=repoman_settings, myportdb=portdb)
 
@@ -1480,7 +780,7 @@ def repoman_main(argv):
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					repolevel, reposplit, categories)):
+					scanner.repolevel, scanner.reposplit, scanner.categories)):
 					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
new file mode 100644
index 0000000..44ff33b
--- /dev/null
+++ b/pym/repoman/scanner.py
@@ -0,0 +1,715 @@
+
+import copy
+import io
+import logging
+import re
+import sys
+from itertools import chain
+from pprint import pformat
+
+from _emerge.Package import Package
+
+import portage
+from portage import normalize_path
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.dep import Atom
+from portage.output import green
+from repoman.checks.directories.files import FileChecks
+from repoman.checks.ebuilds.checks import run_checks
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
+from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
+from repoman.checks.ebuilds.fetches import FetchChecks
+from repoman.checks.ebuilds.keywords import KeywordChecks
+from repoman.checks.ebuilds.isebuild import IsEbuild
+from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
+from repoman.checks.ebuilds.manifests import Manifests
+from repoman.check_missingslot import check_missingslot
+from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
+from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
+from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.description import DescriptionChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
+from repoman.checks.ebuilds.variables.license import LicenseChecks
+from repoman.checks.ebuilds.variables.restrict import RestrictChecks
+from repoman.ebuild import Ebuild
+from repoman.modules.commit import repochecks
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
+from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
+from repoman.qa_tracker import QATracker
+from repoman.repos import repo_metadata
+from repoman.scan import Changes, scan
+from repoman.vcs.vcsstatus import VCSStatus
+from repoman.vcs.vcs import vcs_files_to_cps
+
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+def sort_key(item):
+	return item[2].sub_path
+
+
+
+class Scanner(object):
+	'''Primary scan class.  Operates all the small Q/A tests and checks'''
+
+	def __init__(self, repo_settings, myreporoot, config_root, options,
+				vcs_settings, mydir, env):
+		'''Class __init__'''
+		self.repo_settings = repo_settings
+		self.config_root = config_root
+		self.options = options
+		self.vcs_settings = vcs_settings
+		self.env = env
+
+		# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
+		# behave incrementally.
+		self.repoman_incrementals = tuple(
+			x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
+
+		self.categories = []
+		for path in self.repo_settings.repo_config.eclass_db.porttrees:
+			self.categories.extend(portage.util.grabfile(
+				os.path.join(path, 'profiles', 'categories')))
+		self.repo_settings.repoman_settings.categories = frozenset(
+			portage.util.stack_lists([self.categories], incremental=1))
+		self.categories = self.repo_settings.repoman_settings.categories
+
+		self.portdb = repo_settings.portdb
+		self.portdb.settings = self.repo_settings.repoman_settings
+		# We really only need to cache the metadata that's necessary for visibility
+		# filtering. Anything else can be discarded to reduce memory consumption.
+		self.portdb._aux_cache_keys.clear()
+		self.portdb._aux_cache_keys.update(
+			["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
+
+		self.reposplit = myreporoot.split(os.path.sep)
+		self.repolevel = len(self.reposplit)
+
+		if self.options.mode == 'commit':
+			repochecks.commit_check(self.repolevel, self.reposplit)
+			repochecks.conflict_check(self.vcs_settings, self.options)
+
+		# Make startdir relative to the canonical repodir, so that we can pass
+		# it to digestgen and it won't have to be canonicalized again.
+		if self.repolevel == 1:
+			startdir = self.repo_settings.repodir
+		else:
+			startdir = normalize_path(mydir)
+			startdir = os.path.join(
+				self.repo_settings.repodir, *startdir.split(os.sep)[-2 - self.repolevel + 3:])
+
+		# get lists of valid keywords, licenses, and use
+		new_data = repo_metadata(self.portdb, self.repo_settings.repoman_settings)
+		kwlist, liclist, uselist, profile_list, \
+			global_pmaskdict, liclist_deprecated = new_data
+		self.repo_metadata = {
+			'kwlist': kwlist,
+			'liclist': liclist,
+			'uselist': uselist,
+			'profile_list': profile_list,
+			'pmaskdict': global_pmaskdict,
+			'lic_deprecated': liclist_deprecated,
+		}
+
+		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
+		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
+
+		self.profiles = setup_profile(profile_list)
+
+		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+
+		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
+
+		self.dev_keywords = dev_profile_keywords(self.profiles)
+
+		self.qatracker = QATracker()
+
+		if self.options.echangelog is None and self.repo_settings.repo_config.update_changelog:
+			self.options.echangelog = 'y'
+
+		if self.vcs_settings.vcs is None:
+			self.options.echangelog = 'n'
+
+		self.check = {}
+		# The --echangelog option causes automatic ChangeLog generation,
+		# which invalidates changelog.ebuildadded and changelog.missing
+		# checks.
+		# Note: Some don't use ChangeLogs in distributed SCMs.
+		# It will be generated on server side from scm log,
+		# before package moves to the rsync server.
+		# This is needed because they try to avoid merge collisions.
+		# Gentoo's Council decided to always use the ChangeLog file.
+		# TODO: shouldn't this just be switched on the repo, iso the VCS?
+		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
+		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
+		self.check['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+
+		if self.options.mode == "manifest":
+			pass
+		elif self.options.pretend:
+			print(green("\nRepoMan does a once-over of the neighborhood..."))
+		else:
+			print(green("\nRepoMan scours the neighborhood..."))
+
+		self.changed = Changes(self.options)
+		self.changed.scan(self.vcs_settings)
+
+		self.have = {
+			'pmasked': False,
+			'dev_keywords': False,
+		}
+
+		# NOTE: match-all caches are not shared due to potential
+		# differences between profiles in _get_implicit_iuse.
+		self.caches = {
+			'arch': {},
+			'arch_xmatch': {},
+			'shared_xmatch': {"cp-list": {}},
+		}
+
+		self.include_arches = None
+		if self.options.include_arches:
+			self.include_arches = set()
+			self.include_arches.update(*[x.split() for x in self.options.include_arches])
+
+		# Disable the "ebuild.notadded" check when not in commit mode and
+		# running `svn status` in every package dir will be too expensive.
+		self.check['ebuild_notadded'] = not \
+			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
+
+		self.effective_scanlist = scanlist
+		if self.options.if_modified == "y":
+			self.effective_scanlist = sorted(vcs_files_to_cps(
+				chain(self.changed.changed, self.changed.new, self.changed.removed),
+				self.repolevel, self.reposplit, self.categories))
+
+		self.live_eclasses = portage.const.LIVE_ECLASSES
+
+		# initialize our checks classes here before the big xpkg loop
+		self.manifester = Manifests(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.is_ebuild = IsEbuild(self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.qatracker)
+		self.filescheck = FileChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.status_check = VCSStatus(self.vcs_settings, self.qatracker)
+		self.fetchcheck = FetchChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.pkgmeta = PkgMetadata(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
+		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
+		self.keywordcheck = KeywordChecks(self.qatracker, self.options)
+		self.liveeclasscheck = LiveEclassChecks(self.qatracker)
+		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
+		self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
+		self.descriptioncheck = DescriptionChecks(self.qatracker)
+		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
+		self.restrictcheck = RestrictChecks(self.qatracker)
+
+
+	def scan_pkgs(self, can_force):
+		for xpkg in self.effective_scanlist:
+			# ebuilds and digests added to cvs respectively.
+			logging.info("checking package %s" % xpkg)
+			# save memory by discarding xmatch caches from previous package(s)
+			self.caches['arch_xmatch'].clear()
+			self.eadded = []
+			catdir, pkgdir = xpkg.split("/")
+			checkdir = self.repo_settings.repodir + "/" + xpkg
+			checkdir_relative = ""
+			if self.repolevel < 3:
+				checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+			if self.repolevel < 2:
+				checkdir_relative = os.path.join(catdir, checkdir_relative)
+			checkdir_relative = os.path.join(".", checkdir_relative)
+
+			if self.manifester.run(checkdir, self.portdb):
+				continue
+			if not self.manifester.generated_manifest:
+				self.manifester.digest_check(xpkg, checkdir)
+			if self.options.mode == 'manifest-check':
+				continue
+
+			checkdirlist = os.listdir(checkdir)
+
+			self.pkgs, self.allvalid = self.is_ebuild.check(checkdirlist, checkdir, xpkg)
+			if self.is_ebuild.continue_:
+				# If we can't access all the metadata then it's totally unsafe to
+				# commit since there's no way to generate a correct Manifest.
+				# Do not try to do any more QA checks on this package since missing
+				# metadata leads to false positives for several checks, and false
+				# positives confuse users.
+				can_force = False
+				continue
+
+			self.keywordcheck.prepare()
+
+			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+			ebuildlist = sorted(self.pkgs.values())
+			ebuildlist = [pkg.pf for pkg in ebuildlist]
+
+			self.filescheck.check(
+				checkdir, checkdirlist, checkdir_relative, self.changed.changed, self.changed.new)
+
+			self.status_check.check(self.check['ebuild_notadded'], checkdir, checkdir_relative, xpkg)
+			self.eadded.extend(self.status_check.eadded)
+
+			self.fetchcheck.check(
+				xpkg, checkdir, checkdir_relative, self.changed.changed, self.changed.new)
+
+			if self.check['changelog'] and "ChangeLog" not in checkdirlist:
+				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
+
+			self.pkgmeta.check(xpkg, checkdir, checkdirlist, self.repolevel)
+			self.muselist = frozenset(self.pkgmeta.musedict)
+
+			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+			self.changelog_modified = changelog_path in self.changed.changelogs
+
+			self._scan_ebuilds(ebuildlist, xpkg, catdir, pkgdir)
+		return self.qatracker, can_force
+
+
+	def _scan_ebuilds(self, ebuildlist, xpkg, catdir, pkgdir):
+		# detect unused local USE-descriptions
+		used_useflags = set()
+
+		for y_ebuild in ebuildlist:
+
+			ebuild = Ebuild(
+				self.repo_settings, self.repolevel, pkgdir, catdir, self.vcs_settings,
+				xpkg, y_ebuild)
+
+			if self.check['changelog'] and not self.changelog_modified \
+				and ebuild.ebuild_path in self.changed.new_ebuilds:
+				self.qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
+
+			if ebuild.untracked(self.check['ebuild_notadded'], y_ebuild, self.eadded):
+				# ebuild not added to vcs
+				self.qatracker.add_error(
+					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
+
+			if bad_split_check(xpkg, y_ebuild, pkgdir, self.qatracker):
+				continue
+
+			pkg = self.pkgs[y_ebuild]
+			if pkg_invalid(pkg, self.qatracker, ebuild):
+				self.allvalid = False
+				continue
+
+			myaux = pkg._metadata
+			eapi = myaux["EAPI"]
+			inherited = pkg.inherited
+			live_ebuild = self.live_eclasses.intersection(inherited)
+
+			self.eapicheck.check(pkg, ebuild)
+
+			for k, v in myaux.items():
+				if not isinstance(v, basestring):
+					continue
+				m = NON_ASCII_RE.search(v)
+				if m is not None:
+					self.qatracker.add_error(
+						"variable.invalidchar",
+						"%s: %s variable contains non-ASCII "
+						"character at position %s" %
+						(ebuild.relative_path, k, m.start() + 1))
+
+			if not self.fetchcheck.src_uri_error:
+				self.thirdparty.check(myaux, ebuild.relative_path)
+
+			if myaux.get("PROVIDE"):
+				self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
+			for pos, missing_var in enumerate(missingvars):
+				if not myaux.get(missing_var):
+					if catdir == "virtual" and \
+						missing_var in ("HOMEPAGE", "LICENSE"):
+						continue
+					if live_ebuild and missing_var == "KEYWORDS":
+						continue
+					myqakey = missingvars[pos] + ".missing"
+					self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
+
+			if catdir == "virtual":
+				for var in ("HOMEPAGE", "LICENSE"):
+					if myaux.get(var):
+						myqakey = var + ".virtual"
+						self.qatracker.add_error(myqakey, ebuild.relative_path)
+
+			self.descriptioncheck.check(pkg, ebuild)
+
+			keywords = myaux["KEYWORDS"].split()
+
+			ebuild_archs = set(
+				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
+
+			self.keywordcheck.check(
+				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, self.changed,
+				live_ebuild, self.repo_metadata['kwlist'], self.profiles)
+
+			if live_ebuild and self.repo_settings.repo_config.name == "gentoo":
+				self.liveeclasscheck.check(
+					pkg, xpkg, ebuild, y_ebuild, keywords, self.repo_metadata['pmaskdict'])
+
+			if self.options.ignore_arches:
+				arches = [[
+					self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
+					self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
+			else:
+				arches = set()
+				for keyword in keywords:
+					if keyword[0] == "-":
+						continue
+					elif keyword[0] == "~":
+						arch = keyword[1:]
+						if arch == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (
+										expanded_arch, "~" + expanded_arch)))
+						else:
+							arches.add((keyword, arch, (arch, keyword)))
+					else:
+						if keyword == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (expanded_arch,)))
+						else:
+							arches.add((keyword, keyword, (keyword,)))
+				if not arches:
+					# Use an empty profile for checking dependencies of
+					# packages that have empty KEYWORDS.
+					arches.add(('**', '**', ('**',)))
+
+			unknown_pkgs = set()
+			baddepsyntax = False
+			badlicsyntax = False
+			badprovsyntax = False
+			# catpkg = catdir + "/" + y_ebuild
+
+			inherited_java_eclass = "java-pkg-2" in inherited or \
+				"java-pkg-opt-2" in inherited
+			inherited_wxwidgets_eclass = "wxwidgets" in inherited
+			# operator_tokens = set(["||", "(", ")"])
+			type_list, badsyntax = [], []
+			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+				mydepstr = myaux[mytype]
+
+				buildtime = mytype in Package._buildtime_keys
+				runtime = mytype in Package._runtime_keys
+				token_class = None
+				if mytype.endswith("DEPEND"):
+					token_class = portage.dep.Atom
+
+				try:
+					atoms = portage.dep.use_reduce(
+						mydepstr, matchall=1, flat=True,
+						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+				except portage.exception.InvalidDependString as e:
+					atoms = None
+					badsyntax.append(str(e))
+
+				if atoms and mytype.endswith("DEPEND"):
+					if runtime and \
+						"test?" in mydepstr.split():
+						self.qatracker.add_error(
+							mytype + '.suspect',
+							"%s: 'test?' USE conditional in %s" %
+							(ebuild.relative_path, mytype))
+
+					for atom in atoms:
+						if atom == "||":
+							continue
+
+						is_blocker = atom.blocker
+
+						# Skip dependency.unknown for blockers, so that we
+						# don't encourage people to remove necessary blockers,
+						# as discussed in bug 382407. We use atom.without_use
+						# due to bug 525376.
+						if not is_blocker and \
+							not self.portdb.xmatch("match-all", atom.without_use) and \
+							not atom.cp.startswith("virtual/"):
+							unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+						if catdir != "virtual":
+							if not is_blocker and \
+								atom.cp in suspect_virtual:
+								self.qatracker.add_error(
+									'virtual.suspect', ebuild.relative_path +
+									": %s: consider using '%s' instead of '%s'" %
+									(mytype, suspect_virtual[atom.cp], atom))
+							if not is_blocker and \
+								atom.cp.startswith("perl-core/"):
+								self.qatracker.add_error('dependency.perlcore',
+									ebuild.relative_path +
+									": %s: please use '%s' instead of '%s'" %
+									(mytype,
+									atom.replace("perl-core/","virtual/perl-"),
+									atom))
+
+						if buildtime and \
+							not is_blocker and \
+							not inherited_java_eclass and \
+							atom.cp == "virtual/jdk":
+							self.qatracker.add_error(
+								'java.eclassesnotused', ebuild.relative_path)
+						elif buildtime and \
+							not is_blocker and \
+							not inherited_wxwidgets_eclass and \
+							atom.cp == "x11-libs/wxGTK":
+							self.qatracker.add_error(
+								'wxwidgets.eclassnotused',
+								"%s: %ss on x11-libs/wxGTK without inheriting"
+								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
+						elif runtime:
+							if not is_blocker and \
+								atom.cp in suspect_rdepend:
+								self.qatracker.add_error(
+									mytype + '.suspect',
+									ebuild.relative_path + ": '%s'" % atom)
+
+						if atom.operator == "~" and \
+							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+							qacat = 'dependency.badtilde'
+							self.qatracker.add_error(
+								qacat, "%s: %s uses the ~ operator"
+								" with a non-zero revision: '%s'" %
+								(ebuild.relative_path, mytype, atom))
+
+						check_missingslot(atom, mytype, eapi, self.portdb, self.qatracker,
+							ebuild.relative_path, myaux)
+
+				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+			for m, b in zip(type_list, badsyntax):
+				if m.endswith("DEPEND"):
+					qacat = "dependency.syntax"
+				else:
+					qacat = m + ".syntax"
+				self.qatracker.add_error(
+					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+
+			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+			badlicsyntax = badlicsyntax > 0
+			badprovsyntax = badprovsyntax > 0
+
+			self.use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, self.muselist)
+
+			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
+			used_useflags = used_useflags.union(ebuild_used_useflags)
+
+			self.rubyeclasscheck.check(pkg, ebuild)
+
+			# license checks
+			if not badlicsyntax:
+				self.licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			self.restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			# Syntax Checks
+			if not self.vcs_settings.vcs_preserves_mtime:
+				if ebuild.ebuild_path not in self.changed.new_ebuilds and \
+					ebuild.ebuild_path not in self.changed.ebuilds:
+					pkg.mtime = None
+			try:
+				# All ebuilds should have utf_8 encoding.
+				f = io.open(
+					_unicode_encode(
+						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
+					mode='r', encoding=_encodings['repo.content'])
+				try:
+					for check_name, e in run_checks(f, pkg):
+						self.qatracker.add_error(
+							check_name, ebuild.relative_path + ': %s' % e)
+				finally:
+					f.close()
+			except UnicodeDecodeError:
+				# A file.UTF8 failure will have already been recorded above.
+				pass
+
+			if self.options.force:
+				# The dep_check() calls are the most expensive QA test. If --force
+				# is enabled, there's no point in wasting time on these since the
+				# user is intent on forcing the commit anyway.
+				continue
+
+			relevant_profiles = []
+			for keyword, arch, groups in arches:
+				if arch not in self.profiles:
+					# A missing profile will create an error further down
+					# during the KEYWORDS verification.
+					continue
+
+				if self.include_arches is not None:
+					if arch not in self.include_arches:
+						continue
+
+				relevant_profiles.extend(
+					(keyword, groups, prof) for prof in self.profiles[arch])
+
+			relevant_profiles.sort(key=sort_key)
+
+			for keyword, groups, prof in relevant_profiles:
+
+				is_stable_profile = prof.status == "stable"
+				is_dev_profile = prof.status == "dev" and \
+					self.options.include_dev
+				is_exp_profile = prof.status == "exp" and \
+					self.options.include_exp_profiles == 'y'
+				if not (is_stable_profile or is_dev_profile or is_exp_profile):
+					continue
+
+				dep_settings = self.caches['arch'].get(prof.sub_path)
+				if dep_settings is None:
+					dep_settings = portage.config(
+						config_profile_path=prof.abs_path,
+						config_incrementals=self.repoman_incrementals,
+						config_root=self.config_root,
+						local_config=False,
+						_unmatched_removal=self.options.unmatched_removal,
+						env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+					dep_settings.categories = self.repo_settings.repoman_settings.categories
+					if self.options.without_mask:
+						dep_settings._mask_manager_obj = \
+							copy.deepcopy(dep_settings._mask_manager)
+						dep_settings._mask_manager._pmaskdict.clear()
+					self.caches['arch'][prof.sub_path] = dep_settings
+
+				xmatch_cache_key = (prof.sub_path, tuple(groups))
+				xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+				if xcache is None:
+					self.portdb.melt()
+					self.portdb.freeze()
+					xcache = self.portdb.xcache
+					xcache.update(self.caches['shared_xmatch'])
+					self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+				self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+				self.portdb.settings = dep_settings
+				self.portdb.xcache = xcache
+
+				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+				# just in case, prevent config.reset() from nuking these.
+				dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+				# This attribute is used in dbapi._match_use() to apply
+				# use.stable.{mask,force} settings based on the stable
+				# status of the parent package. This is required in order
+				# for USE deps of unstable packages to be resolved correctly,
+				# since otherwise use.stable.{mask,force} settings of
+				# dependencies may conflict (see bug #456342).
+				dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+				# Handle package.use*.{force,mask) calculation, for use
+				# in dep_check.
+				dep_settings.useforce = dep_settings._use_manager.getUseForce(
+					pkg, stable=dep_settings._parent_stable)
+				dep_settings.usemask = dep_settings._use_manager.getUseMask(
+					pkg, stable=dep_settings._parent_stable)
+
+				if not baddepsyntax:
+					ismasked = not ebuild_archs or \
+						pkg.cpv not in self.portdb.xmatch("match-visible",
+						Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+					if ismasked:
+						if not self.have['pmasked']:
+							self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+								pkg.cpv, pkg._metadata))
+						if self.options.ignore_masked:
+							continue
+						# we are testing deps for a masked package; give it some lee-way
+						suffix = "masked"
+						matchmode = "minimum-all"
+					else:
+						suffix = ""
+						matchmode = "minimum-visible"
+
+					if not self.have['dev_keywords']:
+						self.have['dev_keywords'] = \
+							bool(self.dev_keywords.intersection(keywords))
+
+					if prof.status == "dev":
+						suffix = suffix + "indev"
+
+					for mytype in Package._dep_keys:
+
+						mykey = "dependency.bad" + suffix
+						myvalue = myaux[mytype]
+						if not myvalue:
+							continue
+
+						success, atoms = portage.dep_check(
+							myvalue, self.portdb, dep_settings,
+							use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+						if success:
+							if atoms:
+
+								# Don't bother with dependency.unknown for
+								# cases in which *DEPEND.bad is triggered.
+								for atom in atoms:
+									# dep_check returns all blockers and they
+									# aren't counted for *DEPEND.bad, so we
+									# ignore them here.
+									if not atom.blocker:
+										unknown_pkgs.discard(
+											(mytype, atom.unevaluated_atom))
+
+								if not prof.sub_path:
+									# old-style virtuals currently aren't
+									# resolvable with empty profile, since
+									# 'virtuals' mappings are unavailable
+									# (it would be expensive to search
+									# for PROVIDE in all ebuilds)
+									atoms = [
+										atom for atom in atoms if not (
+											atom.cp.startswith('virtual/')
+											and not self.portdb.cp_list(atom.cp))]
+
+								# we have some unsolvable deps
+								# remove ! deps, which always show up as unsatisfiable
+								atoms = [
+									str(atom.unevaluated_atom)
+									for atom in atoms if not atom.blocker]
+
+								# if we emptied out our list, continue:
+								if not atoms:
+									continue
+								self.qatracker.add_error(mykey,
+									"%s: %s: %s(%s)\n%s"
+									% (ebuild.relative_path, mytype, keyword, prof,
+										pformat(atoms, indent=6)))
+						else:
+							self.qatracker.add_error(mykey,
+								"%s: %s: %s(%s)\n%s"
+								% (ebuild.relative_path, mytype, keyword, prof,
+									pformat(atoms, indent=6)))
+
+			if not baddepsyntax and unknown_pkgs:
+				type_map = {}
+				for mytype, atom in unknown_pkgs:
+					type_map.setdefault(mytype, set()).add(atom)
+				for mytype, atoms in type_map.items():
+					self.qatracker.add_error(
+						"dependency.unknown", "%s: %s: %s"
+						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+
+		# check if there are unused local USE-descriptions in metadata.xml
+		# (unless there are any invalids, to avoid noise)
+		if self.allvalid:
+			for myflag in self.muselist.difference(used_useflags):
+				self.qatracker.add_error(
+					"metadata.warning",
+					"%s/metadata.xml: unused local USE-description: '%s'"
+					% (xpkg, myflag))


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     29ad7e00f57b6bfb3b5f6916add9ed0dcba969f5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:10:03 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=29ad7e00

repoman/actions.py: Split out priming_commit()

 pym/repoman/actions.py | 91 ++++++++++++++++++++++++++------------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 2318ce2..af50c1b 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -208,49 +208,7 @@ class Actions(object):
 		# will change and need a priming commit before the Manifest
 		# can be committed.
 		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [self.vcs_settings.vcs]
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+			self.priming_commit(myupdates, myremoved, commitmessage)
 
 		# When files are removed and re-added, the cvs server will put /Attic/
 		# inside the $Header path. This code detects the problem and corrects it
@@ -809,3 +767,50 @@ class Actions(object):
 				os.unlink(commitmessagefile)
 			except OSError:
 				pass
+
+
+	def priming_commit(self, myupdates, myremoved, commitmessage):
+		myfiles = myupdates + myremoved
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		separator = '-' * 78
+
+		print()
+		print(green("Using commit message:"))
+		print(green(separator))
+		print(commitmessage)
+		print(green(separator))
+		print()
+
+		# Having a leading ./ prefix on file paths can trigger a bug in
+		# the cvs server when committing files to multiple directories,
+		# so strip the prefix.
+		myfiles = [f.lstrip("./") for f in myfiles]
+
+		commit_cmd = [self.vcs_settings.vcs]
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		commit_cmd.extend(["-F", commitmessagefile])
+		commit_cmd.extend(myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     70f468194c669a265d9635740b27a6ddbb1f7dbd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:26:39 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=70f46819

repoman/actions.py: Splitout clear_attic()

 pym/repoman/actions.py | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 974de62..5b55ff8 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -166,23 +166,7 @@ class Actions(object):
 		# inside the $Header path. This code detects the problem and corrects it
 		# so that the Manifest will generate correctly. See bug #169500.
 		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+		self.clear_attic(myheaders)
 
 		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
@@ -817,3 +801,23 @@ class Actions(object):
 			print(
 				"* Files with headers will"
 				" cause the manifests to be changed and committed separately.")
+
+
+	def clear_attic(self, myheaders):
+		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
+		attic_str = b'/Attic/'
+		attic_replace = b'/'
+		for x in myheaders:
+			f = open(
+				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
+				mode='rb')
+			mylines = f.readlines()
+			f.close()
+			modified = False
+			for i, line in enumerate(mylines):
+				if cvs_header_re.match(line) is not None and \
+					attic_str in line:
+					mylines[i] = line.replace(attic_str, attic_replace)
+					modified = True
+			if modified:
+				portage.util.write_atomic(x, b''.join(mylines), mode='wb')


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     e2adc59fff70a8d464d3be03231103bce67ab6a2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:25:28 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e2adc59f

repoman/actions.py: Split out the changelog code to it's own function

 pym/repoman/actions.py | 191 +++++++++++++++++++++++++------------------------
 1 file changed, 99 insertions(+), 92 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index e9bf147..d70dd82 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -132,102 +132,14 @@ class Actions(object):
 				print("* no commit message?  aborting commit.")
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
+
+		myupdates, broken_changelog_manifests = self.changelogs(
+					myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, commitmessage)
 
 		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
-		broken_changelog_manifests = []
-		if self.options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=self.repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = self.repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if self.scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if self.scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in self.scanner.changed.changelogs
-				if changelog_modified and self.options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and self.options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=self.options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if self.options.ask and not self.options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					self.repoman_settings["O"] = checkdir
-					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [self.vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if self.options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
 		if self.vcs_settings.vcs not in ('cvs', 'svn'):
@@ -800,3 +712,98 @@ class Actions(object):
 				commit_footer += ", unsigned Manifest commit"
 			commit_footer += ")"
 		return commit_footer
+
+
+	def changelogs(self, myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, changelog_msg):
+		broken_changelog_manifests = []
+		if self.options.echangelog in ('y', 'force'):
+			logging.info("checking for unmodified ChangeLog files")
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, mymanifests, myremoved),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				catdir, pkgdir = x.split("/")
+				checkdir = self.repo_settings.repodir + "/" + x
+				checkdir_relative = ""
+				if self.scanner.repolevel < 3:
+					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+				if self.scanner.repolevel < 2:
+					checkdir_relative = os.path.join(catdir, checkdir_relative)
+				checkdir_relative = os.path.join(".", checkdir_relative)
+
+				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
+					continue
+
+				# get changes for this package
+				cdrlen = len(checkdir_relative)
+				check_relative = lambda e: e.startswith(checkdir_relative)
+				split_relative = lambda e: e[cdrlen:]
+				clnew = list(map(split_relative, filter(check_relative, mynew)))
+				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
+				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
+
+				# Skip ChangeLog generation if only the Manifest was modified,
+				# as discussed in bug #398009.
+				nontrivial_cl_files = set()
+				nontrivial_cl_files.update(clnew, clremoved, clchanged)
+				nontrivial_cl_files.difference_update(['Manifest'])
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
+					continue
+
+				new_changelog = utilities.UpdateChangeLog(
+					checkdir_relative, committer_name, changelog_msg,
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
+					catdir, pkgdir,
+					new=clnew, removed=clremoved, changed=clchanged,
+					pretend=self.options.pretend)
+				if new_changelog is None:
+					writemsg_level(
+						"!!! Updating the ChangeLog failed\n",
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(1)
+
+				# if the ChangeLog was just created, add it to vcs
+				if new_changelog:
+					myautoadd.append(changelog_path)
+					# myautoadd is appended to myupdates below
+				else:
+					myupdates.append(changelog_path)
+
+				if self.options.ask and not self.options.pretend:
+					# regenerate Manifest for modified ChangeLog (bug #420735)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
+				else:
+					broken_changelog_manifests.append(x)
+
+		if myautoadd:
+			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
+			add_cmd = [self.vcs_settings.vcs, "add"]
+			add_cmd += myautoadd
+			if self.options.pretend:
+				portage.writemsg_stdout(
+					"(%s)\n" % " ".join(add_cmd),
+					noiselevel=-1)
+			else:
+
+				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+					not os.path.isabs(add_cmd[0]):
+					# Python 3.1 _execvp throws TypeError for non-absolute executable
+					# path passed as bytes (see http://bugs.python.org/issue8513).
+					fullname = find_binary(add_cmd[0])
+					if fullname is None:
+						raise portage.exception.CommandNotFound(add_cmd[0])
+					add_cmd[0] = fullname
+
+				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
+				retcode = subprocess.call(add_cmd)
+				if retcode != os.EX_OK:
+					logging.error(
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
+					sys.exit(retcode)
+
+			myupdates += myautoadd
+		return myupdates, broken_changelog_manifests


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     37b282b789db59e7d12abd7904cf49c550e38142
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:03:54 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=37b282b7

repoman/actions.py: Remove unused variable

 pym/repoman/actions.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 405a8c7..2318ce2 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -110,8 +110,6 @@ class Actions(object):
 						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
 			if self.scanner.repolevel > 1:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     2f194c3aa5182694c1c94e9225a78bac9a54ebbd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:07:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 02:00:29 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f194c3a

repoman/actions.py: Break out changes detectection into sudo vcs plugins

 pym/repoman/actions.py | 215 +++++++++++++++++++++++++++----------------------
 1 file changed, 120 insertions(+), 95 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 611c0dd..1f70815 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -74,102 +74,9 @@ class Actions(object):
 
 		self._vcs_deleted(mydeleted)
 
-		if self.vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if self.vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif self.vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if self.vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if self.vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		changes = self.get_vcs_changed(mydeleted)
 
-		if self.vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
+		mynew, mychanged, myremoved, no_expansion, expansion = changes
 
 		# Manifests need to be regenerated after all other commits, so don't commit
 		# them now even if they have changed.
@@ -772,3 +679,121 @@ class Actions(object):
 			print()
 			print()
 			sys.exit(1)
+
+
+	def get_vcs_changed(self, mydeleted):
+		'''Holding function which calls the approriate VCS module for the data'''
+		changed = ([], [], [], [], [])
+		if self.vcs_settings.vcs:
+			vcs_module = getattr(self, '_get_changed_%s_' % self.vcs_settings.vcs)
+			changed = vcs_module(mydeleted)
+			mynew, mychanged, myremoved, no_expansion, expansion = changed
+
+			a_file_is_changed = mychanged or mynew or myremoved
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
+
+			if not (a_file_is_changed or a_file_is_deleted_hg):
+				utilities.repoman_sez(
+					"\"Doing nothing is not always good for QA.\"")
+				print()
+				print("(Didn't find any changed files...)")
+				print()
+				sys.exit(1)
+		return changed
+
+
+	def _get_changed_cvs_(self, mydeleted):
+		mycvstree = cvstree.getentries("./", recursive=1)
+		mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
+		mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
+		myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
+		bin_blob_pattern = re.compile("^-kb$")
+		no_expansion = set(portage.cvstree.findoption(
+			mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_svn_(self, mydeleted):
+		with repoman_popen("svn status") as f:
+			svnstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if (elem[:1] in "MR" or elem[1:2] in "M")]
+		mynew = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("A")]
+		myremoved = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("D")]
+		# Subversion expands keywords specified in svn:keywords properties.
+		with repoman_popen("svn propget -R svn:keywords") as f:
+			props = f.readlines()
+		expansion = dict(
+			("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
+			for prop in props if " - " in prop)
+		no_expansion = set()
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_git_(self, mydeleted):
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=M HEAD") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem[:-1] for elem in mychanged]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=A HEAD") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem[:-1] for elem in mynew]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=D HEAD") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem[:-1] for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_bzr_(self, mydeleted):
+		with repoman_popen("bzr status -S .") as f:
+			bzrstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and elem[1:2] == "M"]
+		mynew = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
+		myremoved = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem.startswith("-")]
+		myremoved = [
+			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+		# Bazaar expands nothing.
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_hg_(self, mydeleted):
+		with repoman_popen("hg status --no-status --modified .") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem.rstrip() for elem in mychanged]
+
+		with repoman_popen("hg status --no-status --added .") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem.rstrip() for elem in mynew]
+
+		with repoman_popen("hg status --no-status --removed .") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     5119898c569923ff47671f6dd61b8c0dd38cbbc3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 04:06:24 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5119898c

repoman: Change name of dev_keywords() due to variable name conflict

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 4 ++--
 pym/repoman/profile.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e276aba..006afc9 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -68,7 +68,7 @@ from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_keywords, setup_profile
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, missingvars,
@@ -243,7 +243,7 @@ scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
 ####################
 
-dev_keywords = dev_keywords(profiles)
+dev_keywords = dev_profile_keywords(profiles)
 
 qatracker = QATracker()
 

diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py
index 11b93c7..0aedbe8 100644
--- a/pym/repoman/profile.py
+++ b/pym/repoman/profile.py
@@ -28,7 +28,7 @@ class ProfileDesc(object):
 valid_profile_types = frozenset(['dev', 'exp', 'stable'])
 
 
-def dev_keywords(profiles):
+def dev_profile_keywords(profiles):
 	"""
 	Create a set of KEYWORDS values that exist in 'dev'
 	profiles. These are used


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     9b4efd06b50219decd19e49278155d9bb82e2462
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:39:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b4efd06

repoman/repos.py: Fix a regression where the repo is not in repos.conf

The regression was introduced when a variable was used to reduce the size of
some long lines.  The variable was not being reset after the repo was added, so
the remaining code was looking at a stale config.
It turned out the variable was a dupe of an already properly updated class wide
one.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 700c064..de99fdf 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -30,12 +30,12 @@ class RepoSettings(object):
 		self.repoman_settings = repoman_settings
 		self.vcs_settings = vcs_settings
 
-		repoman_repos = self.repoman_settings.repositories
+		self.repositories = self.repoman_settings.repositories
 
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
-			repoman_repos.get_repo_for_location(self.repodir)
+			self.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
 			self._add_repo(config_root, portdir_overlay)
 
@@ -47,15 +47,15 @@ class RepoSettings(object):
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_repos.get_repo_for_location(self.repodir)
+		self.repo_config = self.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_repos):
+		for repo in list(self.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_repos[repo.name]
+				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     9add60dcaac5837a1c47b3675b1e86ced9fbfb65
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9add60dc

repoman/main.py: Move some functions out of the main code definition

Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.
Add new file gpg.py

 pym/repoman/gpg.py  | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 pym/repoman/main.py | 78 +++++-----------------------------------------------
 2 files changed, 86 insertions(+), 71 deletions(-)

diff --git a/pym/repoman/gpg.py b/pym/repoman/gpg.py
new file mode 100644
index 0000000..a6c4c5f
--- /dev/null
+++ b/pym/repoman/gpg.py
@@ -0,0 +1,79 @@
+
+import errno
+import logging
+import subprocess
+import sys
+
+import portage
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.exception import MissingParameter
+from portage.process import find_binary
+
+
+# Setup the GPG commands
+def gpgsign(filename, repoman_settings, options):
+	gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
+	if gpgcmd in [None, '']:
+		raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
+			" Is make.globals missing?")
+	if "${PORTAGE_GPG_KEY}" in gpgcmd and \
+		"PORTAGE_GPG_KEY" not in repoman_settings:
+		raise MissingParameter("PORTAGE_GPG_KEY is unset!")
+	if "${PORTAGE_GPG_DIR}" in gpgcmd:
+		if "PORTAGE_GPG_DIR" not in repoman_settings:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser("~/.gnupg")
+			logging.info(
+				"Automatically setting PORTAGE_GPG_DIR to '%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+		else:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
+		if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
+			raise portage.exception.InvalidLocation(
+				"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+	gpgvars = {"FILE": filename}
+	for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
+		v = repoman_settings.get(k)
+		if v is not None:
+			gpgvars[k] = v
+	gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
+	if options.pretend:
+		print("(" + gpgcmd + ")")
+	else:
+		# Encode unicode manually for bug #310789.
+		gpgcmd = portage.util.shlex_split(gpgcmd)
+
+		if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+			not os.path.isabs(gpgcmd[0]):
+			# Python 3.1 _execvp throws TypeError for non-absolute executable
+			# path passed as bytes (see http://bugs.python.org/issue8513).
+			fullname = find_binary(gpgcmd[0])
+			if fullname is None:
+				raise portage.exception.CommandNotFound(gpgcmd[0])
+			gpgcmd[0] = fullname
+
+		gpgcmd = [
+			_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
+			for arg in gpgcmd]
+		rValue = subprocess.call(gpgcmd)
+		if rValue == os.EX_OK:
+			os.rename(filename + ".asc", filename)
+		else:
+			raise portage.exception.PortageException(
+				"!!! gpg exited with '" + str(rValue) + "' status")
+
+def need_signature(filename):
+	try:
+		with open(
+			_unicode_encode(
+				filename, encoding=_encodings['fs'], errors='strict'),
+			'rb') as f:
+			return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
+	except IOError as e:
+		if e.errno in (errno.ENOENT, errno.ESTALE):
+			return False
+		raise

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 4dbc09e..e276aba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -38,7 +38,6 @@ import portage.repository.config
 from portage import cvstree, normalize_path
 from portage import util
 from portage.dep import Atom
-from portage.exception import MissingParameter
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -67,6 +66,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (
@@ -97,6 +97,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
+
+def sort_key(item):
+	return item[2].sub_path
+
+
 # Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
 # behave incrementally.
 repoman_incrementals = tuple(
@@ -673,9 +678,6 @@ for xpkg in effective_scanlist:
 			relevant_profiles.extend(
 				(keyword, groups, prof) for prof in profiles[arch])
 
-		def sort_key(item):
-			return item[2].sub_path
-
 		relevant_profiles.sort(key=sort_key)
 
 		for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1443,6 @@ else:
 			except OSError:
 				pass
 
-	# Setup the GPG commands
-	def gpgsign(filename):
-		gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
-		if gpgcmd in [None, '']:
-			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
-				" Is make.globals missing?")
-		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
-			"PORTAGE_GPG_KEY" not in repoman_settings:
-			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "${PORTAGE_GPG_DIR}" in gpgcmd:
-			if "PORTAGE_GPG_DIR" not in repoman_settings:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser("~/.gnupg")
-				logging.info(
-					"Automatically setting PORTAGE_GPG_DIR to '%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-			else:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
-			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
-				raise portage.exception.InvalidLocation(
-					"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-		gpgvars = {"FILE": filename}
-		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			v = repoman_settings.get(k)
-			if v is not None:
-				gpgvars[k] = v
-		gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
-		if options.pretend:
-			print("(" + gpgcmd + ")")
-		else:
-			# Encode unicode manually for bug #310789.
-			gpgcmd = portage.util.shlex_split(gpgcmd)
-
-			if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-				not os.path.isabs(gpgcmd[0]):
-				# Python 3.1 _execvp throws TypeError for non-absolute executable
-				# path passed as bytes (see http://bugs.python.org/issue8513).
-				fullname = find_binary(gpgcmd[0])
-				if fullname is None:
-					raise portage.exception.CommandNotFound(gpgcmd[0])
-				gpgcmd[0] = fullname
-
-			gpgcmd = [
-				_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
-				for arg in gpgcmd]
-			rValue = subprocess.call(gpgcmd)
-			if rValue == os.EX_OK:
-				os.rename(filename + ".asc", filename)
-			else:
-				raise portage.exception.PortageException(
-					"!!! gpg exited with '" + str(rValue) + "' status")
-
-	def need_signature(filename):
-		try:
-			with open(
-				_unicode_encode(
-					filename, encoding=_encodings['fs'], errors='strict'),
-				'rb') as f:
-				return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
-		except IOError as e:
-			if e.errno in (errno.ENOENT, errno.ESTALE):
-				return False
-			raise
-
 	# When files are removed and re-added, the cvs server will put /Attic/
 	# inside the $Header path. This code detects the problem and corrects it
 	# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1493,7 @@ else:
 				manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 				if not need_signature(manifest_path):
 					continue
-				gpgsign(manifest_path)
+				gpgsign(manifest_path, repoman_settings, options)
 		except portage.exception.PortageException as e:
 			portage.writemsg("!!! %s\n" % str(e))
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     94d363c70053449ae52ff26ac2b184f3888cca99
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:43:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:09 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=94d363c7

repoamn/repos.py: Indent fix

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index de99fdf..f16bf7a 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -128,29 +128,29 @@ class RepoSettings(object):
 				sys.exit(1)
 
 	def _add_repo(self, config_root, portdir_overlay):
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
-				portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				self.repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			self.repoman_settings = portage.config(
-				config_root=config_root, local_config=False,
-				repositories=self.repositories)
+		self.repo_conf = portage.repository.config
+		self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
+			portdir_overlay)[0]
+		self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+		if self.layout_conf_data['repo-name']:
+			self.repo_name = self.layout_conf_data['repo-name']
+		tmp_conf_file = io.StringIO(textwrap.dedent("""
+			[%s]
+			location = %s
+			""") % (self.repo_name, portdir_overlay))
+		# Ensure that the repository corresponding to $PWD overrides a
+		# repository of the same name referenced by the existing PORTDIR
+		# or PORTDIR_OVERLAY settings.
+		self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+			self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+			portage._shell_quote(portdir_overlay))
+		self.repositories = self.repo_conf.load_repository_config(
+			self.repoman_settings, extra_files=[tmp_conf_file])
+		# We have to call the config constructor again so that attributes
+		# dependent on config.repositories are initialized correctly.
+		self.repoman_settings = portage.config(
+			config_root=config_root, local_config=False,
+			repositories=self.repositories)
 
 	##########
 	# future vcs plugin functions


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  2:06 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  2:06 UTC (permalink / raw
  To: gentoo-commits

commit:     00e55dbca2cb5597f00786e4a2b98b41353294ee
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 01:54:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=00e55dbc

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8497833..4dbc09e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-20  0:20 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-20  0:20 UTC (permalink / raw
  To: gentoo-commits

commit:     6c227bc298a62e2fcaec2a5530af121943b13240
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 00:18:47 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 00:18:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6c227bc2

Fix regression from which always runs commit mode

fixes commit: e7607003f01c16b34def04d2069a72f140dfe999

 pym/repoman/actions.py | 2 ++
 pym/repoman/main.py    | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index fef53da..9d97b20 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -58,11 +58,13 @@ class Actions(object):
 			self._suggest()
 		if self.options.mode != 'commit':
 			self._non_commit(result)
+			return False
 		else:
 			self._fail(result, can_force)
 			if self.options.pretend:
 				utilities.repoman_sez(
 					"\"So, you want to play it safe. Good call.\"\n")
+			return True
 
 
 	def perform(self, qa_output):

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index b6f88b2..1393ff7 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -165,8 +165,8 @@ def repoman_main(argv):
 
 	# output the results
 	actions = Actions(repo_settings, options, scanner, vcs_settings)
-	actions.inform(can_force, result)
-	# perform any other actions
-	actions.perform(qa_output)
+	if actions.inform(can_force, result)
+		# perform any other actions
+		actions.perform(qa_output)
 
 	sys.exit(0)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19 17:32 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19 17:32 UTC (permalink / raw
  To: gentoo-commits

commit:     e58efdf56ed834e46f96fc9dc18fad807bc67d8b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 17:30:44 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 17:30:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e58efdf5

repoman/actions.py: Fix missed repoman_settings assignment

 pym/repoman/actions.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 504e573..fef53da 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -41,6 +41,7 @@ class Actions(object):
 		self.options = options
 		self.scanner = scanner
 		self.vcs_settings = vcs_settings
+		self.repoman_settings = repo_settings.repoman_settings
 		self.suggest = {
 			'ignore_masked': False,
 			'include_dev': False,


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19 16:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19 16:48 UTC (permalink / raw
  To: gentoo-commits

commit:     fcf54ef65f910d84cc96cd9951175658967659a7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 16:47:44 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 16:47:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fcf54ef6

repoamn: add missed new file gpg.py

 pym/repoman/gpg.py | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/pym/repoman/gpg.py b/pym/repoman/gpg.py
new file mode 100644
index 0000000..a6c4c5f
--- /dev/null
+++ b/pym/repoman/gpg.py
@@ -0,0 +1,79 @@
+
+import errno
+import logging
+import subprocess
+import sys
+
+import portage
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.exception import MissingParameter
+from portage.process import find_binary
+
+
+# Setup the GPG commands
+def gpgsign(filename, repoman_settings, options):
+	gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
+	if gpgcmd in [None, '']:
+		raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
+			" Is make.globals missing?")
+	if "${PORTAGE_GPG_KEY}" in gpgcmd and \
+		"PORTAGE_GPG_KEY" not in repoman_settings:
+		raise MissingParameter("PORTAGE_GPG_KEY is unset!")
+	if "${PORTAGE_GPG_DIR}" in gpgcmd:
+		if "PORTAGE_GPG_DIR" not in repoman_settings:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser("~/.gnupg")
+			logging.info(
+				"Automatically setting PORTAGE_GPG_DIR to '%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+		else:
+			repoman_settings["PORTAGE_GPG_DIR"] = \
+				os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
+		if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
+			raise portage.exception.InvalidLocation(
+				"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
+				repoman_settings["PORTAGE_GPG_DIR"])
+	gpgvars = {"FILE": filename}
+	for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
+		v = repoman_settings.get(k)
+		if v is not None:
+			gpgvars[k] = v
+	gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
+	if options.pretend:
+		print("(" + gpgcmd + ")")
+	else:
+		# Encode unicode manually for bug #310789.
+		gpgcmd = portage.util.shlex_split(gpgcmd)
+
+		if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+			not os.path.isabs(gpgcmd[0]):
+			# Python 3.1 _execvp throws TypeError for non-absolute executable
+			# path passed as bytes (see http://bugs.python.org/issue8513).
+			fullname = find_binary(gpgcmd[0])
+			if fullname is None:
+				raise portage.exception.CommandNotFound(gpgcmd[0])
+			gpgcmd[0] = fullname
+
+		gpgcmd = [
+			_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
+			for arg in gpgcmd]
+		rValue = subprocess.call(gpgcmd)
+		if rValue == os.EX_OK:
+			os.rename(filename + ".asc", filename)
+		else:
+			raise portage.exception.PortageException(
+				"!!! gpg exited with '" + str(rValue) + "' status")
+
+def need_signature(filename):
+	try:
+		with open(
+			_unicode_encode(
+				filename, encoding=_encodings['fs'], errors='strict'),
+			'rb') as f:
+			return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
+	except IOError as e:
+		if e.errno in (errno.ENOENT, errno.ESTALE):
+			return False
+		raise


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19 16:28 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19 16:28 UTC (permalink / raw
  To: gentoo-commits

commit:     7c6cbf30221368c5526f8036f0b6d9b7b28210dc
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 16:26:23 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 16:26:23 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c6cbf30

repoman/repos.py: Detect the lack of a vcs type in vcs_settings to not do a function call

 pym/repoman/repos.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 1a3a0d5..f16bf7a 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -61,8 +61,11 @@ class RepoSettings(object):
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
-			func()
+			if vcs_settings.vcs:
+				func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+				func()
+			else:
+				logging.warning("No VCS type detected, unable to sign the commit")
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19 16:28 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19 16:28 UTC (permalink / raw
  To: gentoo-commits

commit:     a88687ef2fa38f7424ea76470b6b579f986fd4c1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:58:18 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:58:18 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a88687ef

repoman/actions.py: add a return to perform()

 pym/repoman/actions.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 44b2c04..504e573 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -203,6 +203,7 @@ class Actions(object):
 				" that he forgot to commit anything")
 		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"\n")
+		return
 
 
 	def _suggest(self):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     f180baffdc7d1eb010a822e3d6585b4a1a635772
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:10:03 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:10:03 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f180baff

repoman/actions.py: Split out priming_commit()

 pym/repoman/actions.py | 91 ++++++++++++++++++++++++++------------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 06f57a3..a538174 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -205,49 +205,7 @@ class Actions(object):
 		# will change and need a priming commit before the Manifest
 		# can be committed.
 		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [self.vcs_settings.vcs]
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+			self.priming_commit(myupdates, myremoved, commitmessage)
 
 		# When files are removed and re-added, the cvs server will put /Attic/
 		# inside the $Header path. This code detects the problem and corrects it
@@ -805,3 +763,50 @@ class Actions(object):
 				os.unlink(commitmessagefile)
 			except OSError:
 				pass
+
+
+	def priming_commit(self, myupdates, myremoved, commitmessage):
+		myfiles = myupdates + myremoved
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		separator = '-' * 78
+
+		print()
+		print(green("Using commit message:"))
+		print(green(separator))
+		print(commitmessage)
+		print(green(separator))
+		print()
+
+		# Having a leading ./ prefix on file paths can trigger a bug in
+		# the cvs server when committing files to multiple directories,
+		# so strip the prefix.
+		myfiles = [f.lstrip("./") for f in myfiles]
+
+		commit_cmd = [self.vcs_settings.vcs]
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		commit_cmd.extend(["-F", commitmessagefile])
+		commit_cmd.extend(myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     1cd578b21b5e295cbd432b525ed5833285468c56
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:26:39 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:26:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1cd578b2

repoman/actions.py: Splitout clear_attic()

 pym/repoman/actions.py | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index ba1e0a2..1751396 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -163,23 +163,7 @@ class Actions(object):
 		# inside the $Header path. This code detects the problem and corrects it
 		# so that the Manifest will generate correctly. See bug #169500.
 		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+		self.clear_attic(myheaders)
 
 		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
@@ -813,3 +797,23 @@ class Actions(object):
 			print(
 				"* Files with headers will"
 				" cause the manifests to be changed and committed separately.")
+
+
+	def clear_attic(self, myheaders):
+		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
+		attic_str = b'/Attic/'
+		attic_replace = b'/'
+		for x in myheaders:
+			f = open(
+				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
+				mode='rb')
+			mylines = f.readlines()
+			f.close()
+			modified = False
+			for i, line in enumerate(mylines):
+				if cvs_header_re.match(line) is not None and \
+					attic_str in line:
+					mylines[i] = line.replace(attic_str, attic_replace)
+					modified = True
+			if modified:
+				portage.util.write_atomic(x, b''.join(mylines), mode='wb')


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     9311ffcfde2c6a8528ab3af23960cf995c614fa7
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:34:01 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:34:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9311ffcf

repoman/actions.py: Split out get_new_commit_message()

 pym/repoman/actions.py | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 97d3458..44b2c04 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -108,24 +108,8 @@ class Actions(object):
 				else:
 					raise
 		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if self.scanner.repolevel > 1:
-				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+			commitmessage = self.get_new_commit_message(qa_output)
 
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 
 		myupdates, broken_changelog_manifests = self.changelogs(
@@ -822,3 +806,24 @@ class Actions(object):
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")
 			self.repo_settings.sign_manifests = False
 
+
+	def get_new_commit_message(self, qa_output):
+		msg_prefix = ""
+		if self.scanner.repolevel > 1:
+			msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
+
+		try:
+			editor = os.environ.get("EDITOR")
+			if editor and utilities.editor_is_executable(editor):
+				commitmessage = utilities.get_commit_message_with_editor(
+					editor, message=qa_output, prefix=msg_prefix)
+			else:
+				commitmessage = utilities.get_commit_message_with_stdin()
+		except KeyboardInterrupt:
+			logging.fatal("Interrupted; exiting...")
+			sys.exit(1)
+		if (not commitmessage or not commitmessage.strip()
+				or commitmessage.strip() == msg_prefix):
+			print("* no commit message?  aborting commit.")
+			sys.exit(1)
+		return commitmessage


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     243ab8230f96527d407bccfd1d48e29ce8b93458
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:59:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 03:35:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=243ab823

repoman/actions.py: Split out the commit footer to a function

 pym/repoman/actions.py | 95 ++++++++++++++++++++++++++------------------------
 1 file changed, 49 insertions(+), 46 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 2693431..d2d3461 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -130,53 +130,8 @@ class Actions(object):
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if self.options.force:
-			report_options.append("--force")
-		if self.options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if self.scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(self.scanner.include_arches)))
-
-		if self.vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, self.vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if self.repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
 
+		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
@@ -793,3 +748,51 @@ class Actions(object):
 		expansion = {}
 		return  (mynew, mychanged, myremoved, no_expansion, expansion)
 
+
+	def get_commit_footer(self):
+		portage_version = getattr(portage, "VERSION", None)
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		report_options = []
+		if self.options.force:
+			report_options.append("--force")
+		if self.options.ignore_arches:
+			report_options.append("--ignore-arches")
+		if self.scanner.include_arches is not None:
+			report_options.append(
+				"--include-arches=\"%s\"" %
+				" ".join(sorted(self.scanner.include_arches)))
+
+		if portage_version is None:
+			sys.stderr.write("Failed to insert portage version in message!\n")
+			sys.stderr.flush()
+			portage_version = "Unknown"
+		# Use new footer only for git (see bug #438364).
+		if self.vcs_settings.vcs in ["git"]:
+			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
+			if report_options:
+				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
+			if dco_sob:
+				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
+		else:
+			unameout = platform.system() + " "
+			if platform.system() in ["Darwin", "SunOS"]:
+				unameout += platform.processor()
+			else:
+				unameout += platform.machine()
+			commit_footer = "\n\n"
+			if dco_sob:
+				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
+			commit_footer += "(Portage version: %s/%s/%s" % \
+				(portage_version, self.vcs_settings.vcs, unameout)
+			if report_options:
+				commit_footer += ", RepoMan options: " + " ".join(report_options)
+			if self.repo_settings.sign_manifests:
+				commit_footer += ", signed Manifest commit with key %s" % \
+					(gpg_key, )
+			else:
+				commit_footer += ", unsigned Manifest commit"
+			commit_footer += ")"
+		return commit_footer


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     026d19d96d96e1fb143fcfdfdd973511882f67f1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:59:10 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 03:59:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=026d19d9

repoman/actions.py: split out a manifest function

 pym/repoman/actions.py | 110 +++++++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 2794307..78db5bb 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -327,59 +327,7 @@ class Actions(object):
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if self.options.pretend and self.vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(self.vcs_settings.vcs)
-			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
-			if self.vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if self.options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (self.vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
+		self.add_manifest(mymanifests, myheaders, myupdates, myremoved, commitmessage)
 
 		print()
 		if self.vcs_settings.vcs:
@@ -803,3 +751,59 @@ class Actions(object):
 
 			myupdates += myautoadd
 		return myupdates, broken_changelog_manifests
+
+
+	def add_manifest(self, mymanifests, myheaders, myupdates, myremoved,
+					commitmessage):
+		myfiles = mymanifests[:]
+		# If there are no header (SVN/CVS keywords) changes in
+		# the files, this Manifest commit must include the
+		# other (yet uncommitted) files.
+		if not myheaders:
+			myfiles += myupdates
+			myfiles += myremoved
+		myfiles.sort()
+
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "wb")
+		mymsg.write(_unicode_encode(commitmessage))
+		mymsg.close()
+
+		commit_cmd = []
+		if self.options.pretend and self.vcs_settings.vcs is None:
+			# substitute a bogus value for pretend output
+			commit_cmd.append("cvs")
+		else:
+			commit_cmd.append(self.vcs_settings.vcs)
+		commit_cmd.extend(self.vcs_settings.vcs_global_opts)
+		commit_cmd.append("commit")
+		commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+		if self.vcs_settings.vcs == "hg":
+			commit_cmd.extend(["--logfile", commitmessagefile])
+			commit_cmd.extend(myfiles)
+		else:
+			commit_cmd.extend(["-F", commitmessagefile])
+			commit_cmd.extend(f.lstrip("./") for f in myfiles)
+
+		try:
+			if self.options.pretend:
+				print("(%s)" % (" ".join(commit_cmd),))
+			else:
+				retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
+				if retval != os.EX_OK:
+					if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
+						not git_supports_gpg_sign():
+						# Inform user that newer git is needed (bug #403323).
+						logging.error(
+							"Git >=1.7.9 is required for signed commits!")
+
+					writemsg_level(
+						"!!! Exiting on %s (shell) "
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(retval)
+		finally:
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     95d50e712f5d08a0da63887453e4537654b7a810
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:25:28 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 03:38:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=95d50e71

repoman/actions.py: Split out the changelog code to it's own function

 pym/repoman/actions.py | 191 +++++++++++++++++++++++++------------------------
 1 file changed, 99 insertions(+), 92 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index d2d3461..2794307 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -129,102 +129,14 @@ class Actions(object):
 				print("* no commit message?  aborting commit.")
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
+
+		myupdates, broken_changelog_manifests = self.changelogs(
+					myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, commitmessage)
 
 		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
-		broken_changelog_manifests = []
-		if self.options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=self.repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = self.repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if self.scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if self.scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in self.scanner.changed.changelogs
-				if changelog_modified and self.options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and self.options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=self.options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if self.options.ask and not self.options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					self.repoman_settings["O"] = checkdir
-					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [self.vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if self.options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
 		if self.vcs_settings.vcs not in ('cvs', 'svn'):
@@ -796,3 +708,98 @@ class Actions(object):
 				commit_footer += ", unsigned Manifest commit"
 			commit_footer += ")"
 		return commit_footer
+
+
+	def changelogs(self, myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, changelog_msg):
+		broken_changelog_manifests = []
+		if self.options.echangelog in ('y', 'force'):
+			logging.info("checking for unmodified ChangeLog files")
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, mymanifests, myremoved),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				catdir, pkgdir = x.split("/")
+				checkdir = self.repo_settings.repodir + "/" + x
+				checkdir_relative = ""
+				if self.scanner.repolevel < 3:
+					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+				if self.scanner.repolevel < 2:
+					checkdir_relative = os.path.join(catdir, checkdir_relative)
+				checkdir_relative = os.path.join(".", checkdir_relative)
+
+				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
+					continue
+
+				# get changes for this package
+				cdrlen = len(checkdir_relative)
+				check_relative = lambda e: e.startswith(checkdir_relative)
+				split_relative = lambda e: e[cdrlen:]
+				clnew = list(map(split_relative, filter(check_relative, mynew)))
+				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
+				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
+
+				# Skip ChangeLog generation if only the Manifest was modified,
+				# as discussed in bug #398009.
+				nontrivial_cl_files = set()
+				nontrivial_cl_files.update(clnew, clremoved, clchanged)
+				nontrivial_cl_files.difference_update(['Manifest'])
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
+					continue
+
+				new_changelog = utilities.UpdateChangeLog(
+					checkdir_relative, committer_name, changelog_msg,
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
+					catdir, pkgdir,
+					new=clnew, removed=clremoved, changed=clchanged,
+					pretend=self.options.pretend)
+				if new_changelog is None:
+					writemsg_level(
+						"!!! Updating the ChangeLog failed\n",
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(1)
+
+				# if the ChangeLog was just created, add it to vcs
+				if new_changelog:
+					myautoadd.append(changelog_path)
+					# myautoadd is appended to myupdates below
+				else:
+					myupdates.append(changelog_path)
+
+				if self.options.ask and not self.options.pretend:
+					# regenerate Manifest for modified ChangeLog (bug #420735)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
+				else:
+					broken_changelog_manifests.append(x)
+
+		if myautoadd:
+			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
+			add_cmd = [self.vcs_settings.vcs, "add"]
+			add_cmd += myautoadd
+			if self.options.pretend:
+				portage.writemsg_stdout(
+					"(%s)\n" % " ".join(add_cmd),
+					noiselevel=-1)
+			else:
+
+				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+					not os.path.isabs(add_cmd[0]):
+					# Python 3.1 _execvp throws TypeError for non-absolute executable
+					# path passed as bytes (see http://bugs.python.org/issue8513).
+					fullname = find_binary(add_cmd[0])
+					if fullname is None:
+						raise portage.exception.CommandNotFound(add_cmd[0])
+					add_cmd[0] = fullname
+
+				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
+				retcode = subprocess.call(add_cmd)
+				if retcode != os.EX_OK:
+					logging.error(
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
+					sys.exit(retcode)
+
+			myupdates += myautoadd
+		return myupdates, broken_changelog_manifests


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     d14d811d8d26423c53704fe841b0d9a9843b310f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:25:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:25:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d14d811d

repoman/actions.py: Split out thick_manifest()

 pym/repoman/actions.py | 101 +++++++++++++++++++++++++------------------------
 1 file changed, 52 insertions(+), 49 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index a538174..ba1e0a2 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -143,55 +143,7 @@ class Actions(object):
 			# committed in one big commit at the end.
 			print()
 		elif not self.repo_settings.repo_config.thin_manifest:
-			if self.vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif self.vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if self.vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif self.vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
+			self.thick_manifest(myupdates, myheaders, no_expansion, expansion)
 
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
@@ -810,3 +762,54 @@ class Actions(object):
 			except OSError:
 				pass
 
+
+	def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
+			if self.vcs_settings.vcs == 'cvs':
+				headerstring = "'\$(Header|Id).*\$'"
+			elif self.vcs_settings.vcs == "svn":
+				svn_keywords = dict((k.lower(), k) for k in [
+					"Rev",
+					"Revision",
+					"LastChangedRevision",
+					"Date",
+					"LastChangedDate",
+					"Author",
+					"LastChangedBy",
+					"URL",
+					"HeadURL",
+					"Id",
+					"Header",
+				])
+
+			for myfile in myupdates:
+
+				# for CVS, no_expansion contains files that are excluded from expansion
+				if self.vcs_settings.vcs == "cvs":
+					if myfile in no_expansion:
+						continue
+
+				# for SVN, expansion contains files that are included in expansion
+				elif self.vcs_settings.vcs == "svn":
+					if myfile not in expansion:
+						continue
+
+					# Subversion keywords are case-insensitive
+					# in svn:keywords properties,
+					# but case-sensitive in contents of files.
+					enabled_keywords = []
+					for k in expansion[myfile]:
+						keyword = svn_keywords.get(k.lower())
+						if keyword is not None:
+							enabled_keywords.append(keyword)
+
+					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
+
+				myout = repoman_getstatusoutput(
+					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
+				if myout[0] == 0:
+					myheaders.append(myfile)
+
+			print("%s have headers that will change." % green(str(len(myheaders))))
+			print(
+				"* Files with headers will"
+				" cause the manifests to be changed and committed separately.")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     905d8108272152aab3407b8f99ce2dc7911366c9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:27:19 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:27:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=905d8108

repoamn/actions.py: Split out sign_manifest()

 pym/repoman/actions.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 1751396..97d3458 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -183,19 +183,7 @@ class Actions(object):
 				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		if self.repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
-					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, self.repoman_settings, self.options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				self.repo_settings.sign_manifests = False
+			self.sign_manifests(myupdates, myremoved, mymanifests)
 
 		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
@@ -817,3 +805,20 @@ class Actions(object):
 					modified = True
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
+
+
+	def sign_manifest(self, myupdates, myremoved, mymanifests):
+		try:
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, myremoved, mymanifests),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
+				if not need_signature(manifest_path):
+					continue
+				gpgsign(manifest_path, self.repoman_settings, self.options)
+		except portage.exception.PortageException as e:
+			portage.writemsg("!!! %s\n" % str(e))
+			portage.writemsg("!!! Disabled FEATURES='sign'\n")
+			self.repo_settings.sign_manifests = False
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     4c7a3a016c573b011a31cccf0735e5b5b18b88d4
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 02:07:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 02:07:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c7a3a01

repoman/actions.py: Break out changes detectection into sudo vcs plugins

 pym/repoman/actions.py | 215 +++++++++++++++++++++++++++----------------------
 1 file changed, 120 insertions(+), 95 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 615d5f4..2693431 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -71,102 +71,9 @@ class Actions(object):
 
 		self._vcs_deleted(mydeleted)
 
-		if self.vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if self.vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif self.vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if self.vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if self.vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		changes = self.get_vcs_changed(mydeleted)
 
-		if self.vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
+		mynew, mychanged, myremoved, no_expansion, expansion = changes
 
 		# Manifests need to be regenerated after all other commits, so don't commit
 		# them now even if they have changed.
@@ -768,3 +675,121 @@ class Actions(object):
 			print()
 			print()
 			sys.exit(1)
+
+
+	def get_vcs_changed(self, mydeleted):
+		'''Holding function which calls the approriate VCS module for the data'''
+		changed = ([], [], [], [], [])
+		if self.vcs_settings.vcs:
+			vcs_module = getattr(self, '_get_changed_%s_' % self.vcs_settings.vcs)
+			changed = vcs_module(mydeleted)
+			mynew, mychanged, myremoved, no_expansion, expansion = changed
+
+			a_file_is_changed = mychanged or mynew or myremoved
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
+
+			if not (a_file_is_changed or a_file_is_deleted_hg):
+				utilities.repoman_sez(
+					"\"Doing nothing is not always good for QA.\"")
+				print()
+				print("(Didn't find any changed files...)")
+				print()
+				sys.exit(1)
+		return changed
+
+
+	def _get_changed_cvs_(self, mydeleted):
+		mycvstree = cvstree.getentries("./", recursive=1)
+		mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
+		mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
+		myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
+		bin_blob_pattern = re.compile("^-kb$")
+		no_expansion = set(portage.cvstree.findoption(
+			mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_svn_(self, mydeleted):
+		with repoman_popen("svn status") as f:
+			svnstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if (elem[:1] in "MR" or elem[1:2] in "M")]
+		mynew = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("A")]
+		myremoved = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("D")]
+		# Subversion expands keywords specified in svn:keywords properties.
+		with repoman_popen("svn propget -R svn:keywords") as f:
+			props = f.readlines()
+		expansion = dict(
+			("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
+			for prop in props if " - " in prop)
+		no_expansion = set()
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_git_(self, mydeleted):
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=M HEAD") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem[:-1] for elem in mychanged]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=A HEAD") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem[:-1] for elem in mynew]
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=D HEAD") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem[:-1] for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_bzr_(self, mydeleted):
+		with repoman_popen("bzr status -S .") as f:
+			bzrstatus = f.readlines()
+		mychanged = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and elem[1:2] == "M"]
+		mynew = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
+		myremoved = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem.startswith("-")]
+		myremoved = [
+			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+		# Bazaar expands nothing.
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+
+	def _get_changed_hg_(self, mydeleted):
+		with repoman_popen("hg status --no-status --modified .") as f:
+			mychanged = f.readlines()
+		mychanged = ["./" + elem.rstrip() for elem in mychanged]
+
+		with repoman_popen("hg status --no-status --added .") as f:
+			mynew = f.readlines()
+		mynew = ["./" + elem.rstrip() for elem in mynew]
+
+		with repoman_popen("hg status --no-status --removed .") as f:
+			myremoved = f.readlines()
+		myremoved = ["./" + elem.rstrip() for elem in myremoved]
+		no_expansion = set()
+		expansion = {}
+		return  (mynew, mychanged, myremoved, no_expansion, expansion)
+


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  4:36 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  4:36 UTC (permalink / raw
  To: gentoo-commits

commit:     48141c30ba2e20407d24068a62383eaea01e015c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:03:54 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 04:03:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=48141c30

repoman/actions.py: Remove unused variable

 pym/repoman/actions.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 78db5bb..06f57a3 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -107,8 +107,6 @@ class Actions(object):
 						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
 			if self.scanner.repolevel > 1:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  1:22 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     42c4a6a7ed9233ae9caa1a3aa9e5c583432cae5a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 15:29:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 00:03:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=42c4a6a7

repoman: Move the primary checks loop to it's own class and file

Only minimal changes were done for this initial move.
The _scan_ebuilds() needs major hacking up into manageable chunks.
Clean out code separation demarcation lines
These lines were originally used to mark places where code was removed.
And replaced with a class instance and/or function call.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 756 ++-----------------------------------------------
 pym/repoman/scanner.py | 715 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 743 insertions(+), 728 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e3d0472..2b2f91d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,7 +4,6 @@
 
 from __future__ import print_function, unicode_literals
 
-import copy
 import errno
 import io
 import logging
@@ -15,7 +14,6 @@ import sys
 import tempfile
 import platform
 from itertools import chain
-from pprint import pformat
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -30,14 +28,12 @@ portage._disable_legacy_globals()
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.Package import Package
 from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree, normalize_path
+from portage import cvstree
 from portage import util
-from portage.dep import Atom
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -47,40 +43,18 @@ from portage.util import writemsg_level
 from portage.package.ebuild.digestgen import digestgen
 
 from repoman.argparser import parse_args
-from repoman.checks.directories.files import FileChecks
-from repoman.checks.ebuilds.checks import run_checks, checks_init
-from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.checks.ebuilds.fetches import FetchChecks
-from repoman.checks.ebuilds.keywords import KeywordChecks
-from repoman.checks.ebuilds.isebuild import IsEbuild
-from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
-from repoman.checks.ebuilds.manifests import Manifests
-from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
-from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
-from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
-from repoman.checks.ebuilds.variables.eapi import EAPIChecks
-from repoman.checks.ebuilds.variables.license import LicenseChecks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
-from repoman.ebuild import Ebuild
+from repoman.checks.ebuilds.checks import checks_init
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats, missingvars,
-	suspect_virtual, suspect_rdepend)
-from repoman.qa_tracker import QATracker
-from repoman.repos import RepoSettings, repo_metadata
-from repoman.scan import Changes, scan
+	qawarnings, qacats)
+from repoman.repos import RepoSettings
+from repoman.scanner import Scanner
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (
 	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-from repoman.vcs.vcsstatus import VCSStatus
 
 
 if sys.hexversion >= 0x3000000:
@@ -90,21 +64,11 @@ util.initialize_logger()
 
 bad = create_color_func("BAD")
 
-live_eclasses = portage.const.LIVE_ECLASSES
-non_ascii_re = re.compile(r'[^\x00-\x7f]')
-
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
-def sort_key(item):
-	return item[2].sub_path
-
 
 def repoman_main(argv):
-	# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
-	# behave incrementally.
-	repoman_incrementals = tuple(
-		x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
 	config_root = os.environ.get("PORTAGE_CONFIGROOT")
 	repoman_settings = portage.config(config_root=config_root, local_config=False)
 
@@ -142,30 +106,9 @@ def repoman_main(argv):
 	repo_settings = RepoSettings(
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
-
 	repoman_settings = repo_settings.repoman_settings
-
 	portdb = repo_settings.portdb
 
-	if options.echangelog is None and repo_settings.repo_config.update_changelog:
-		options.echangelog = 'y'
-
-	if vcs_settings.vcs is None:
-		options.echangelog = 'n'
-
-	# The --echangelog option causes automatic ChangeLog generation,
-	# which invalidates changelog.ebuildadded and changelog.missing
-	# checks.
-	# Note: Some don't use ChangeLogs in distributed SCMs.
-	# It will be generated on server side from scm log,
-	# before package moves to the rsync server.
-	# This is needed because they try to avoid merge collisions.
-	# Gentoo's Council decided to always use the ChangeLog file.
-	# TODO: shouldn't this just be switched on the repo, iso the VCS?
-	is_echangelog_enabled = options.echangelog in ('y', 'force')
-	vcs_settings.vcs_is_cvs_or_svn = vcs_settings.vcs in ('cvs', 'svn')
-	check_changelog = not is_echangelog_enabled and vcs_settings.vcs_is_cvs_or_svn
-
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
 
@@ -178,663 +121,16 @@ def repoman_main(argv):
 	env = os.environ.copy()
 	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
 
-	categories = []
-	for path in repo_settings.repo_config.eclass_db.porttrees:
-		categories.extend(portage.util.grabfile(
-			os.path.join(path, 'profiles', 'categories')))
-	repoman_settings.categories = frozenset(
-		portage.util.stack_lists([categories], incremental=1))
-	categories = repoman_settings.categories
-
-	portdb.settings = repoman_settings
-	# We really only need to cache the metadata that's necessary for visibility
-	# filtering. Anything else can be discarded to reduce memory consumption.
-	portdb._aux_cache_keys.clear()
-	portdb._aux_cache_keys.update(
-		["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
-
-	reposplit = myreporoot.split(os.path.sep)
-	repolevel = len(reposplit)
-
-	###################
-	commitmessage = None
-	if options.mode == 'commit':
-		repochecks.commit_check(repolevel, reposplit)
-		repochecks.conflict_check(vcs_settings, options)
-
-	###################
-
-	# Make startdir relative to the canonical repodir, so that we can pass
-	# it to digestgen and it won't have to be canonicalized again.
-	if repolevel == 1:
-		startdir = repo_settings.repodir
-	else:
-		startdir = normalize_path(mydir)
-		startdir = os.path.join(
-			repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-	###################
-
-
-	# get lists of valid keywords, licenses, and use
-	new_data = repo_metadata(repo_settings.portdb, repoman_settings)
-	kwlist, liclist, uselist, profile_list, \
-		global_pmaskdict, liclist_deprecated = new_data
-
-	repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
-	repoman_settings.backup_changes('PORTAGE_ARCHLIST')
-
-	####################
-
-	profiles = setup_profile(profile_list)
-
-	####################
-
-	check_profiles(profiles, repoman_settings.archlist())
-
-	####################
-
-	scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
-
-	####################
-
-	dev_keywords = dev_profile_keywords(profiles)
-
-	qatracker = QATracker()
-
-
-	if options.mode == "manifest":
-		pass
-	elif options.pretend:
-		print(green("\nRepoMan does a once-over of the neighborhood..."))
-	else:
-		print(green("\nRepoMan scours the neighborhood..."))
-
-	#####################
-
-	changed = Changes(options)
-	changed.scan(vcs_settings)
-
-	######################
-
-	have_pmasked = False
-	have_dev_keywords = False
-	dofail = 0
-
-	# NOTE: match-all caches are not shared due to potential
-	# differences between profiles in _get_implicit_iuse.
-	arch_caches = {}
-	arch_xmatch_caches = {}
-	shared_xmatch_caches = {"cp-list": {}}
-
-	include_arches = None
-	if options.include_arches:
-		include_arches = set()
-		include_arches.update(*[x.split() for x in options.include_arches])
-
-	# Disable the "ebuild.notadded" check when not in commit mode and
-	# running `svn status` in every package dir will be too expensive.
-
-	check_ebuild_notadded = not \
-		(vcs_settings.vcs == "svn" and repolevel < 3 and options.mode != "commit")
-
-	effective_scanlist = scanlist
-	if options.if_modified == "y":
-		effective_scanlist = sorted(vcs_files_to_cps(
-			chain(changed.changed, changed.new, changed.removed),
-			repolevel, reposplit, categories))
-
-	######################
-	# initialize our checks classes here before the big xpkg loop
-	manifester = Manifests(options, qatracker, repoman_settings)
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
-	filescheck = FileChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	status_check = VCSStatus(vcs_settings, qatracker)
-	fetchcheck = FetchChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
-	thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
-	use_flag_checks = USEFlagChecks(qatracker, uselist)
-	keywordcheck = KeywordChecks(qatracker, options)
-	liveeclasscheck = LiveEclassChecks(qatracker)
-	rubyeclasscheck = RubyEclassChecks(qatracker)
-	eapicheck = EAPIChecks(qatracker, repo_settings)
-	descriptioncheck = DescriptionChecks(qatracker)
-	licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated)
-	restrictcheck = RestrictChecks(qatracker)
-	######################
-
-	for xpkg in effective_scanlist:
-		# ebuilds and digests added to cvs respectively.
-		logging.info("checking package %s" % xpkg)
-		# save memory by discarding xmatch caches from previous package(s)
-		arch_xmatch_caches.clear()
-		eadded = []
-		catdir, pkgdir = xpkg.split("/")
-		checkdir = repo_settings.repodir + "/" + xpkg
-		checkdir_relative = ""
-		if repolevel < 3:
-			checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-		if repolevel < 2:
-			checkdir_relative = os.path.join(catdir, checkdir_relative)
-		checkdir_relative = os.path.join(".", checkdir_relative)
-
-	#####################
-		if manifester.run(checkdir, portdb):
-			continue
-		if not manifester.generated_manifest:
-			manifester.digest_check(xpkg, checkdir)
-	######################
-
-		if options.mode == 'manifest-check':
-			continue
-
-		checkdirlist = os.listdir(checkdir)
-
-	######################
-		pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
-		if is_ebuild.continue_:
-			# If we can't access all the metadata then it's totally unsafe to
-			# commit since there's no way to generate a correct Manifest.
-			# Do not try to do any more QA checks on this package since missing
-			# metadata leads to false positives for several checks, and false
-			# positives confuse users.
-			can_force = False
-			continue
-	######################
-
-		keywordcheck.prepare()
-
-		# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
-		ebuildlist = sorted(pkgs.values())
-		ebuildlist = [pkg.pf for pkg in ebuildlist]
-	#######################
-		filescheck.check(
-			checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new)
-	#######################
-		status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
-		eadded.extend(status_check.eadded)
-
-	#################
-		fetchcheck.check(
-			xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
-	#################
-
-		if check_changelog and "ChangeLog" not in checkdirlist:
-			qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
-	#################
-		pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
-		muselist = frozenset(pkgmeta.musedict)
-	#################
-
-		changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-		changelog_modified = changelog_path in changed.changelogs
-
-		# detect unused local USE-descriptions
-		used_useflags = set()
-
-		for y_ebuild in ebuildlist:
-			##################
-			ebuild = Ebuild(
-				repo_settings, repolevel, pkgdir, catdir, vcs_settings,
-				xpkg, y_ebuild)
-			##################
-
-			if check_changelog and not changelog_modified \
-				and ebuild.ebuild_path in changed.new_ebuilds:
-				qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
-
-			if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded):
-				# ebuild not added to vcs
-				qatracker.add_error(
-					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
-
-	##################
-			if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker):
-				continue
-	###################
-			pkg = pkgs[y_ebuild]
-			if pkg_invalid(pkg, qatracker, ebuild):
-				allvalid = False
-				continue
-
-			myaux = pkg._metadata
-			eapi = myaux["EAPI"]
-			inherited = pkg.inherited
-			live_ebuild = live_eclasses.intersection(inherited)
-
-			#######################
-			eapicheck.check(pkg, ebuild)
-			#######################
-
-			for k, v in myaux.items():
-				if not isinstance(v, basestring):
-					continue
-				m = non_ascii_re.search(v)
-				if m is not None:
-					qatracker.add_error(
-						"variable.invalidchar",
-						"%s: %s variable contains non-ASCII "
-						"character at position %s" %
-						(ebuild.relative_path, k, m.start() + 1))
-
-			if not fetchcheck.src_uri_error:
-				#######################
-				thirdparty.check(myaux, ebuild.relative_path)
-				#######################
-			if myaux.get("PROVIDE"):
-				qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
-
-			for pos, missing_var in enumerate(missingvars):
-				if not myaux.get(missing_var):
-					if catdir == "virtual" and \
-						missing_var in ("HOMEPAGE", "LICENSE"):
-						continue
-					if live_ebuild and missing_var == "KEYWORDS":
-						continue
-					myqakey = missingvars[pos] + ".missing"
-					qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
-			if catdir == "virtual":
-				for var in ("HOMEPAGE", "LICENSE"):
-					if myaux.get(var):
-						myqakey = var + ".virtual"
-						qatracker.add_error(myqakey, ebuild.relative_path)
-
-			#######################
-			descriptioncheck.check(pkg, ebuild)
-			#######################
-
-			keywords = myaux["KEYWORDS"].split()
-
-			ebuild_archs = set(
-				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
-
-			#######################
-			keywordcheck.check(
-				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed,
-				live_ebuild, kwlist, profiles)
-			#######################
-
-			if live_ebuild and repo_settings.repo_config.name == "gentoo":
-				#######################
-				liveeclasscheck.check(
-					pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict)
-				#######################
-
-			if options.ignore_arches:
-				arches = [[
-					repoman_settings["ARCH"], repoman_settings["ARCH"],
-					repoman_settings["ACCEPT_KEYWORDS"].split()]]
-			else:
-				arches = set()
-				for keyword in keywords:
-					if keyword[0] == "-":
-						continue
-					elif keyword[0] == "~":
-						arch = keyword[1:]
-						if arch == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (
-										expanded_arch, "~" + expanded_arch)))
-						else:
-							arches.add((keyword, arch, (arch, keyword)))
-					else:
-						if keyword == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (expanded_arch,)))
-						else:
-							arches.add((keyword, keyword, (keyword,)))
-				if not arches:
-					# Use an empty profile for checking dependencies of
-					# packages that have empty KEYWORDS.
-					arches.add(('**', '**', ('**',)))
-
-			unknown_pkgs = set()
-			baddepsyntax = False
-			badlicsyntax = False
-			badprovsyntax = False
-			# catpkg = catdir + "/" + y_ebuild
-
-			inherited_java_eclass = "java-pkg-2" in inherited or \
-				"java-pkg-opt-2" in inherited
-			inherited_wxwidgets_eclass = "wxwidgets" in inherited
-			# operator_tokens = set(["||", "(", ")"])
-			type_list, badsyntax = [], []
-			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
-				mydepstr = myaux[mytype]
-
-				buildtime = mytype in Package._buildtime_keys
-				runtime = mytype in Package._runtime_keys
-				token_class = None
-				if mytype.endswith("DEPEND"):
-					token_class = portage.dep.Atom
+	# Perform the main checks
+	scanner = Scanner(repo_settings, myreporoot, config_root, options,
+					vcs_settings, mydir, env)
+	qatracker, can_force = scanner.scan_pkgs(can_force)
 
-				try:
-					atoms = portage.dep.use_reduce(
-						mydepstr, matchall=1, flat=True,
-						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
-				except portage.exception.InvalidDependString as e:
-					atoms = None
-					badsyntax.append(str(e))
-
-				if atoms and mytype.endswith("DEPEND"):
-					if runtime and \
-						"test?" in mydepstr.split():
-						qatracker.add_error(
-							mytype + '.suspect',
-							"%s: 'test?' USE conditional in %s" %
-							(ebuild.relative_path, mytype))
-
-					for atom in atoms:
-						if atom == "||":
-							continue
-
-						is_blocker = atom.blocker
-
-						# Skip dependency.unknown for blockers, so that we
-						# don't encourage people to remove necessary blockers,
-						# as discussed in bug 382407. We use atom.without_use
-						# due to bug 525376.
-						if not is_blocker and \
-							not portdb.xmatch("match-all", atom.without_use) and \
-							not atom.cp.startswith("virtual/"):
-							unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
-						if catdir != "virtual":
-							if not is_blocker and \
-								atom.cp in suspect_virtual:
-								qatracker.add_error(
-									'virtual.suspect', ebuild.relative_path +
-									": %s: consider using '%s' instead of '%s'" %
-									(mytype, suspect_virtual[atom.cp], atom))
-							if not is_blocker and \
-								atom.cp.startswith("perl-core/"):
-								qatracker.add_error('dependency.perlcore',
-									ebuild.relative_path +
-									": %s: please use '%s' instead of '%s'" %
-									(mytype,
-									atom.replace("perl-core/","virtual/perl-"),
-									atom))
-
-						if buildtime and \
-							not is_blocker and \
-							not inherited_java_eclass and \
-							atom.cp == "virtual/jdk":
-							qatracker.add_error(
-								'java.eclassesnotused', ebuild.relative_path)
-						elif buildtime and \
-							not is_blocker and \
-							not inherited_wxwidgets_eclass and \
-							atom.cp == "x11-libs/wxGTK":
-							qatracker.add_error(
-								'wxwidgets.eclassnotused',
-								"%s: %ss on x11-libs/wxGTK without inheriting"
-								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
-						elif runtime:
-							if not is_blocker and \
-								atom.cp in suspect_rdepend:
-								qatracker.add_error(
-									mytype + '.suspect',
-									ebuild.relative_path + ": '%s'" % atom)
-
-						if atom.operator == "~" and \
-							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
-							qacat = 'dependency.badtilde'
-							qatracker.add_error(
-								qacat, "%s: %s uses the ~ operator"
-								" with a non-zero revision: '%s'" %
-								(ebuild.relative_path, mytype, atom))
-
-						check_missingslot(atom, mytype, eapi, portdb, qatracker,
-							ebuild.relative_path, myaux)
-
-				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
-			for m, b in zip(type_list, badsyntax):
-				if m.endswith("DEPEND"):
-					qacat = "dependency.syntax"
-				else:
-					qacat = m + ".syntax"
-				qatracker.add_error(
-					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
-
-			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
-			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
-			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
-			badlicsyntax = badlicsyntax > 0
-			badprovsyntax = badprovsyntax > 0
-
-			#################
-			use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
-
-			ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
-			#################
-			rubyeclasscheck.check(pkg, ebuild)
-			#################
-
-			# license checks
-			if not badlicsyntax:
-				#################
-				licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
-				#################
-
-			#################
-			restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
-			#################
-
-			# Syntax Checks
-
-			if not vcs_settings.vcs_preserves_mtime:
-				if ebuild.ebuild_path not in changed.new_ebuilds and \
-					ebuild.ebuild_path not in changed.ebuilds:
-					pkg.mtime = None
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, pkg):
-						qatracker.add_error(
-							check_name, ebuild.relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
-
-			if options.force:
-				# The dep_check() calls are the most expensive QA test. If --force
-				# is enabled, there's no point in wasting time on these since the
-				# user is intent on forcing the commit anyway.
-				continue
-
-			relevant_profiles = []
-			for keyword, arch, groups in arches:
-				if arch not in profiles:
-					# A missing profile will create an error further down
-					# during the KEYWORDS verification.
-					continue
-
-				if include_arches is not None:
-					if arch not in include_arches:
-						continue
-
-				relevant_profiles.extend(
-					(keyword, groups, prof) for prof in profiles[arch])
-
-			relevant_profiles.sort(key=sort_key)
-
-			for keyword, groups, prof in relevant_profiles:
-
-				is_stable_profile = prof.status == "stable"
-				is_dev_profile = prof.status == "dev" and \
-					options.include_dev
-				is_exp_profile = prof.status == "exp" and \
-					options.include_exp_profiles == 'y'
-				if not (is_stable_profile or is_dev_profile or is_exp_profile):
-					continue
+	commitmessage = None
 
-				dep_settings = arch_caches.get(prof.sub_path)
-				if dep_settings is None:
-					dep_settings = portage.config(
-						config_profile_path=prof.abs_path,
-						config_incrementals=repoman_incrementals,
-						config_root=config_root,
-						local_config=False,
-						_unmatched_removal=options.unmatched_removal,
-						env=env, repositories=repoman_settings.repositories)
-					dep_settings.categories = repoman_settings.categories
-					if options.without_mask:
-						dep_settings._mask_manager_obj = \
-							copy.deepcopy(dep_settings._mask_manager)
-						dep_settings._mask_manager._pmaskdict.clear()
-					arch_caches[prof.sub_path] = dep_settings
-
-				xmatch_cache_key = (prof.sub_path, tuple(groups))
-				xcache = arch_xmatch_caches.get(xmatch_cache_key)
-				if xcache is None:
-					portdb.melt()
-					portdb.freeze()
-					xcache = portdb.xcache
-					xcache.update(shared_xmatch_caches)
-					arch_xmatch_caches[xmatch_cache_key] = xcache
-
-				repo_settings.trees[repo_settings.root]["porttree"].settings = dep_settings
-				portdb.settings = dep_settings
-				portdb.xcache = xcache
-
-				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
-				# just in case, prevent config.reset() from nuking these.
-				dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
-				# This attribute is used in dbapi._match_use() to apply
-				# use.stable.{mask,force} settings based on the stable
-				# status of the parent package. This is required in order
-				# for USE deps of unstable packages to be resolved correctly,
-				# since otherwise use.stable.{mask,force} settings of
-				# dependencies may conflict (see bug #456342).
-				dep_settings._parent_stable = dep_settings._isStable(pkg)
-
-				# Handle package.use*.{force,mask) calculation, for use
-				# in dep_check.
-				dep_settings.useforce = dep_settings._use_manager.getUseForce(
-					pkg, stable=dep_settings._parent_stable)
-				dep_settings.usemask = dep_settings._use_manager.getUseMask(
-					pkg, stable=dep_settings._parent_stable)
-
-				if not baddepsyntax:
-					ismasked = not ebuild_archs or \
-						pkg.cpv not in portdb.xmatch("match-visible",
-						Atom("%s::%s" % (pkg.cp, repo_settings.repo_config.name)))
-					if ismasked:
-						if not have_pmasked:
-							have_pmasked = bool(dep_settings._getMaskAtom(
-								pkg.cpv, pkg._metadata))
-						if options.ignore_masked:
-							continue
-						# we are testing deps for a masked package; give it some lee-way
-						suffix = "masked"
-						matchmode = "minimum-all"
-					else:
-						suffix = ""
-						matchmode = "minimum-visible"
-
-					if not have_dev_keywords:
-						have_dev_keywords = \
-							bool(dev_keywords.intersection(keywords))
-
-					if prof.status == "dev":
-						suffix = suffix + "indev"
-
-					for mytype in Package._dep_keys:
-
-						mykey = "dependency.bad" + suffix
-						myvalue = myaux[mytype]
-						if not myvalue:
-							continue
-
-						success, atoms = portage.dep_check(
-							myvalue, portdb, dep_settings,
-							use="all", mode=matchmode, trees=repo_settings.trees)
-
-						if success:
-							if atoms:
-
-								# Don't bother with dependency.unknown for
-								# cases in which *DEPEND.bad is triggered.
-								for atom in atoms:
-									# dep_check returns all blockers and they
-									# aren't counted for *DEPEND.bad, so we
-									# ignore them here.
-									if not atom.blocker:
-										unknown_pkgs.discard(
-											(mytype, atom.unevaluated_atom))
-
-								if not prof.sub_path:
-									# old-style virtuals currently aren't
-									# resolvable with empty profile, since
-									# 'virtuals' mappings are unavailable
-									# (it would be expensive to search
-									# for PROVIDE in all ebuilds)
-									atoms = [
-										atom for atom in atoms if not (
-											atom.cp.startswith('virtual/')
-											and not portdb.cp_list(atom.cp))]
-
-								# we have some unsolvable deps
-								# remove ! deps, which always show up as unsatisfiable
-								atoms = [
-									str(atom.unevaluated_atom)
-									for atom in atoms if not atom.blocker]
-
-								# if we emptied out our list, continue:
-								if not atoms:
-									continue
-								qatracker.add_error(mykey,
-									"%s: %s: %s(%s)\n%s"
-									% (ebuild.relative_path, mytype, keyword, prof,
-										pformat(atoms, indent=6)))
-						else:
-							qatracker.add_error(mykey,
-								"%s: %s: %s(%s)\n%s"
-								% (ebuild.relative_path, mytype, keyword, prof,
-									pformat(atoms, indent=6)))
-
-			if not baddepsyntax and unknown_pkgs:
-				type_map = {}
-				for mytype, atom in unknown_pkgs:
-					type_map.setdefault(mytype, set()).add(atom)
-				for mytype, atoms in type_map.items():
-					qatracker.add_error(
-						"dependency.unknown", "%s: %s: %s"
-						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
-
-		# check if there are unused local USE-descriptions in metadata.xml
-		# (unless there are any invalids, to avoid noise)
-		if allvalid:
-			for myflag in muselist.difference(used_useflags):
-				qatracker.add_error(
-					"metadata.warning",
-					"%s/metadata.xml: unused local USE-description: '%s'"
-					% (xpkg, myflag))
-
-
-	if options.if_modified == "y" and len(effective_scanlist) < 1:
+	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
 	# dofail will be true if we have failed in at least one non-warning category
 	dofail = 0
 	# dowarn will be true if we tripped any warnings
@@ -842,6 +138,10 @@ def repoman_main(argv):
 	# dofull will be true if we should print a "repoman full" informational message
 	dofull = options.mode != 'full'
 
+	# early out for manifest generation
+	if options.mode == "manifest":
+		sys.exit(dofail)
+
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
@@ -884,9 +184,9 @@ def repoman_main(argv):
 	suggest_ignore_masked = False
 	suggest_include_dev = False
 
-	if have_pmasked and not (options.without_mask or options.ignore_masked):
+	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
 		suggest_ignore_masked = True
-	if have_dev_keywords and not options.include_dev:
+	if scanner.have['dev_keywords'] and not options.include_dev:
 		suggest_include_dev = True
 
 	if suggest_ignore_masked or suggest_include_dev:
@@ -1164,8 +464,8 @@ def repoman_main(argv):
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if repolevel > 1:
-				msg_prefix = "/".join(reposplit[1:]) + ": "
+			if scanner.repolevel > 1:
+				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -1196,10 +496,10 @@ def repoman_main(argv):
 			report_options.append("--force")
 		if options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if include_arches is not None:
+		if scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(include_arches)))
+				" ".join(sorted(scanner.include_arches)))
 
 		if vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
@@ -1238,18 +538,18 @@ def repoman_main(argv):
 			committer_name = utilities.get_committer_name(env=repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				catdir, pkgdir = x.split("/")
 				checkdir = repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if repolevel < 3:
+				if scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if repolevel < 2:
+				if scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in changed.changelogs
+				changelog_modified = changelog_path in scanner.changed.changelogs
 				if changelog_modified and options.echangelog != 'force':
 					continue
 
@@ -1459,7 +759,7 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if repolevel == 1:
+		if scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
@@ -1467,7 +767,7 @@ def repoman_main(argv):
 		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 				digestgen(mysettings=repoman_settings, myportdb=portdb)
 
@@ -1480,7 +780,7 @@ def repoman_main(argv):
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					repolevel, reposplit, categories)):
+					scanner.repolevel, scanner.reposplit, scanner.categories)):
 					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
new file mode 100644
index 0000000..44ff33b
--- /dev/null
+++ b/pym/repoman/scanner.py
@@ -0,0 +1,715 @@
+
+import copy
+import io
+import logging
+import re
+import sys
+from itertools import chain
+from pprint import pformat
+
+from _emerge.Package import Package
+
+import portage
+from portage import normalize_path
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.dep import Atom
+from portage.output import green
+from repoman.checks.directories.files import FileChecks
+from repoman.checks.ebuilds.checks import run_checks
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
+from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
+from repoman.checks.ebuilds.fetches import FetchChecks
+from repoman.checks.ebuilds.keywords import KeywordChecks
+from repoman.checks.ebuilds.isebuild import IsEbuild
+from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
+from repoman.checks.ebuilds.manifests import Manifests
+from repoman.check_missingslot import check_missingslot
+from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
+from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
+from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.description import DescriptionChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
+from repoman.checks.ebuilds.variables.license import LicenseChecks
+from repoman.checks.ebuilds.variables.restrict import RestrictChecks
+from repoman.ebuild import Ebuild
+from repoman.modules.commit import repochecks
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
+from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
+from repoman.qa_tracker import QATracker
+from repoman.repos import repo_metadata
+from repoman.scan import Changes, scan
+from repoman.vcs.vcsstatus import VCSStatus
+from repoman.vcs.vcs import vcs_files_to_cps
+
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+def sort_key(item):
+	return item[2].sub_path
+
+
+
+class Scanner(object):
+	'''Primary scan class.  Operates all the small Q/A tests and checks'''
+
+	def __init__(self, repo_settings, myreporoot, config_root, options,
+				vcs_settings, mydir, env):
+		'''Class __init__'''
+		self.repo_settings = repo_settings
+		self.config_root = config_root
+		self.options = options
+		self.vcs_settings = vcs_settings
+		self.env = env
+
+		# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
+		# behave incrementally.
+		self.repoman_incrementals = tuple(
+			x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
+
+		self.categories = []
+		for path in self.repo_settings.repo_config.eclass_db.porttrees:
+			self.categories.extend(portage.util.grabfile(
+				os.path.join(path, 'profiles', 'categories')))
+		self.repo_settings.repoman_settings.categories = frozenset(
+			portage.util.stack_lists([self.categories], incremental=1))
+		self.categories = self.repo_settings.repoman_settings.categories
+
+		self.portdb = repo_settings.portdb
+		self.portdb.settings = self.repo_settings.repoman_settings
+		# We really only need to cache the metadata that's necessary for visibility
+		# filtering. Anything else can be discarded to reduce memory consumption.
+		self.portdb._aux_cache_keys.clear()
+		self.portdb._aux_cache_keys.update(
+			["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
+
+		self.reposplit = myreporoot.split(os.path.sep)
+		self.repolevel = len(self.reposplit)
+
+		if self.options.mode == 'commit':
+			repochecks.commit_check(self.repolevel, self.reposplit)
+			repochecks.conflict_check(self.vcs_settings, self.options)
+
+		# Make startdir relative to the canonical repodir, so that we can pass
+		# it to digestgen and it won't have to be canonicalized again.
+		if self.repolevel == 1:
+			startdir = self.repo_settings.repodir
+		else:
+			startdir = normalize_path(mydir)
+			startdir = os.path.join(
+				self.repo_settings.repodir, *startdir.split(os.sep)[-2 - self.repolevel + 3:])
+
+		# get lists of valid keywords, licenses, and use
+		new_data = repo_metadata(self.portdb, self.repo_settings.repoman_settings)
+		kwlist, liclist, uselist, profile_list, \
+			global_pmaskdict, liclist_deprecated = new_data
+		self.repo_metadata = {
+			'kwlist': kwlist,
+			'liclist': liclist,
+			'uselist': uselist,
+			'profile_list': profile_list,
+			'pmaskdict': global_pmaskdict,
+			'lic_deprecated': liclist_deprecated,
+		}
+
+		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
+		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
+
+		self.profiles = setup_profile(profile_list)
+
+		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+
+		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
+
+		self.dev_keywords = dev_profile_keywords(self.profiles)
+
+		self.qatracker = QATracker()
+
+		if self.options.echangelog is None and self.repo_settings.repo_config.update_changelog:
+			self.options.echangelog = 'y'
+
+		if self.vcs_settings.vcs is None:
+			self.options.echangelog = 'n'
+
+		self.check = {}
+		# The --echangelog option causes automatic ChangeLog generation,
+		# which invalidates changelog.ebuildadded and changelog.missing
+		# checks.
+		# Note: Some don't use ChangeLogs in distributed SCMs.
+		# It will be generated on server side from scm log,
+		# before package moves to the rsync server.
+		# This is needed because they try to avoid merge collisions.
+		# Gentoo's Council decided to always use the ChangeLog file.
+		# TODO: shouldn't this just be switched on the repo, iso the VCS?
+		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
+		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
+		self.check['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+
+		if self.options.mode == "manifest":
+			pass
+		elif self.options.pretend:
+			print(green("\nRepoMan does a once-over of the neighborhood..."))
+		else:
+			print(green("\nRepoMan scours the neighborhood..."))
+
+		self.changed = Changes(self.options)
+		self.changed.scan(self.vcs_settings)
+
+		self.have = {
+			'pmasked': False,
+			'dev_keywords': False,
+		}
+
+		# NOTE: match-all caches are not shared due to potential
+		# differences between profiles in _get_implicit_iuse.
+		self.caches = {
+			'arch': {},
+			'arch_xmatch': {},
+			'shared_xmatch': {"cp-list": {}},
+		}
+
+		self.include_arches = None
+		if self.options.include_arches:
+			self.include_arches = set()
+			self.include_arches.update(*[x.split() for x in self.options.include_arches])
+
+		# Disable the "ebuild.notadded" check when not in commit mode and
+		# running `svn status` in every package dir will be too expensive.
+		self.check['ebuild_notadded'] = not \
+			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
+
+		self.effective_scanlist = scanlist
+		if self.options.if_modified == "y":
+			self.effective_scanlist = sorted(vcs_files_to_cps(
+				chain(self.changed.changed, self.changed.new, self.changed.removed),
+				self.repolevel, self.reposplit, self.categories))
+
+		self.live_eclasses = portage.const.LIVE_ECLASSES
+
+		# initialize our checks classes here before the big xpkg loop
+		self.manifester = Manifests(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.is_ebuild = IsEbuild(self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.qatracker)
+		self.filescheck = FileChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.status_check = VCSStatus(self.vcs_settings, self.qatracker)
+		self.fetchcheck = FetchChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.pkgmeta = PkgMetadata(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
+		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
+		self.keywordcheck = KeywordChecks(self.qatracker, self.options)
+		self.liveeclasscheck = LiveEclassChecks(self.qatracker)
+		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
+		self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
+		self.descriptioncheck = DescriptionChecks(self.qatracker)
+		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
+		self.restrictcheck = RestrictChecks(self.qatracker)
+
+
+	def scan_pkgs(self, can_force):
+		for xpkg in self.effective_scanlist:
+			# ebuilds and digests added to cvs respectively.
+			logging.info("checking package %s" % xpkg)
+			# save memory by discarding xmatch caches from previous package(s)
+			self.caches['arch_xmatch'].clear()
+			self.eadded = []
+			catdir, pkgdir = xpkg.split("/")
+			checkdir = self.repo_settings.repodir + "/" + xpkg
+			checkdir_relative = ""
+			if self.repolevel < 3:
+				checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+			if self.repolevel < 2:
+				checkdir_relative = os.path.join(catdir, checkdir_relative)
+			checkdir_relative = os.path.join(".", checkdir_relative)
+
+			if self.manifester.run(checkdir, self.portdb):
+				continue
+			if not self.manifester.generated_manifest:
+				self.manifester.digest_check(xpkg, checkdir)
+			if self.options.mode == 'manifest-check':
+				continue
+
+			checkdirlist = os.listdir(checkdir)
+
+			self.pkgs, self.allvalid = self.is_ebuild.check(checkdirlist, checkdir, xpkg)
+			if self.is_ebuild.continue_:
+				# If we can't access all the metadata then it's totally unsafe to
+				# commit since there's no way to generate a correct Manifest.
+				# Do not try to do any more QA checks on this package since missing
+				# metadata leads to false positives for several checks, and false
+				# positives confuse users.
+				can_force = False
+				continue
+
+			self.keywordcheck.prepare()
+
+			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+			ebuildlist = sorted(self.pkgs.values())
+			ebuildlist = [pkg.pf for pkg in ebuildlist]
+
+			self.filescheck.check(
+				checkdir, checkdirlist, checkdir_relative, self.changed.changed, self.changed.new)
+
+			self.status_check.check(self.check['ebuild_notadded'], checkdir, checkdir_relative, xpkg)
+			self.eadded.extend(self.status_check.eadded)
+
+			self.fetchcheck.check(
+				xpkg, checkdir, checkdir_relative, self.changed.changed, self.changed.new)
+
+			if self.check['changelog'] and "ChangeLog" not in checkdirlist:
+				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
+
+			self.pkgmeta.check(xpkg, checkdir, checkdirlist, self.repolevel)
+			self.muselist = frozenset(self.pkgmeta.musedict)
+
+			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+			self.changelog_modified = changelog_path in self.changed.changelogs
+
+			self._scan_ebuilds(ebuildlist, xpkg, catdir, pkgdir)
+		return self.qatracker, can_force
+
+
+	def _scan_ebuilds(self, ebuildlist, xpkg, catdir, pkgdir):
+		# detect unused local USE-descriptions
+		used_useflags = set()
+
+		for y_ebuild in ebuildlist:
+
+			ebuild = Ebuild(
+				self.repo_settings, self.repolevel, pkgdir, catdir, self.vcs_settings,
+				xpkg, y_ebuild)
+
+			if self.check['changelog'] and not self.changelog_modified \
+				and ebuild.ebuild_path in self.changed.new_ebuilds:
+				self.qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
+
+			if ebuild.untracked(self.check['ebuild_notadded'], y_ebuild, self.eadded):
+				# ebuild not added to vcs
+				self.qatracker.add_error(
+					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
+
+			if bad_split_check(xpkg, y_ebuild, pkgdir, self.qatracker):
+				continue
+
+			pkg = self.pkgs[y_ebuild]
+			if pkg_invalid(pkg, self.qatracker, ebuild):
+				self.allvalid = False
+				continue
+
+			myaux = pkg._metadata
+			eapi = myaux["EAPI"]
+			inherited = pkg.inherited
+			live_ebuild = self.live_eclasses.intersection(inherited)
+
+			self.eapicheck.check(pkg, ebuild)
+
+			for k, v in myaux.items():
+				if not isinstance(v, basestring):
+					continue
+				m = NON_ASCII_RE.search(v)
+				if m is not None:
+					self.qatracker.add_error(
+						"variable.invalidchar",
+						"%s: %s variable contains non-ASCII "
+						"character at position %s" %
+						(ebuild.relative_path, k, m.start() + 1))
+
+			if not self.fetchcheck.src_uri_error:
+				self.thirdparty.check(myaux, ebuild.relative_path)
+
+			if myaux.get("PROVIDE"):
+				self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
+			for pos, missing_var in enumerate(missingvars):
+				if not myaux.get(missing_var):
+					if catdir == "virtual" and \
+						missing_var in ("HOMEPAGE", "LICENSE"):
+						continue
+					if live_ebuild and missing_var == "KEYWORDS":
+						continue
+					myqakey = missingvars[pos] + ".missing"
+					self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
+
+			if catdir == "virtual":
+				for var in ("HOMEPAGE", "LICENSE"):
+					if myaux.get(var):
+						myqakey = var + ".virtual"
+						self.qatracker.add_error(myqakey, ebuild.relative_path)
+
+			self.descriptioncheck.check(pkg, ebuild)
+
+			keywords = myaux["KEYWORDS"].split()
+
+			ebuild_archs = set(
+				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
+
+			self.keywordcheck.check(
+				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, self.changed,
+				live_ebuild, self.repo_metadata['kwlist'], self.profiles)
+
+			if live_ebuild and self.repo_settings.repo_config.name == "gentoo":
+				self.liveeclasscheck.check(
+					pkg, xpkg, ebuild, y_ebuild, keywords, self.repo_metadata['pmaskdict'])
+
+			if self.options.ignore_arches:
+				arches = [[
+					self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
+					self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
+			else:
+				arches = set()
+				for keyword in keywords:
+					if keyword[0] == "-":
+						continue
+					elif keyword[0] == "~":
+						arch = keyword[1:]
+						if arch == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (
+										expanded_arch, "~" + expanded_arch)))
+						else:
+							arches.add((keyword, arch, (arch, keyword)))
+					else:
+						if keyword == "*":
+							for expanded_arch in self.profiles:
+								if expanded_arch == "**":
+									continue
+								arches.add(
+									(keyword, expanded_arch, (expanded_arch,)))
+						else:
+							arches.add((keyword, keyword, (keyword,)))
+				if not arches:
+					# Use an empty profile for checking dependencies of
+					# packages that have empty KEYWORDS.
+					arches.add(('**', '**', ('**',)))
+
+			unknown_pkgs = set()
+			baddepsyntax = False
+			badlicsyntax = False
+			badprovsyntax = False
+			# catpkg = catdir + "/" + y_ebuild
+
+			inherited_java_eclass = "java-pkg-2" in inherited or \
+				"java-pkg-opt-2" in inherited
+			inherited_wxwidgets_eclass = "wxwidgets" in inherited
+			# operator_tokens = set(["||", "(", ")"])
+			type_list, badsyntax = [], []
+			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+				mydepstr = myaux[mytype]
+
+				buildtime = mytype in Package._buildtime_keys
+				runtime = mytype in Package._runtime_keys
+				token_class = None
+				if mytype.endswith("DEPEND"):
+					token_class = portage.dep.Atom
+
+				try:
+					atoms = portage.dep.use_reduce(
+						mydepstr, matchall=1, flat=True,
+						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+				except portage.exception.InvalidDependString as e:
+					atoms = None
+					badsyntax.append(str(e))
+
+				if atoms and mytype.endswith("DEPEND"):
+					if runtime and \
+						"test?" in mydepstr.split():
+						self.qatracker.add_error(
+							mytype + '.suspect',
+							"%s: 'test?' USE conditional in %s" %
+							(ebuild.relative_path, mytype))
+
+					for atom in atoms:
+						if atom == "||":
+							continue
+
+						is_blocker = atom.blocker
+
+						# Skip dependency.unknown for blockers, so that we
+						# don't encourage people to remove necessary blockers,
+						# as discussed in bug 382407. We use atom.without_use
+						# due to bug 525376.
+						if not is_blocker and \
+							not self.portdb.xmatch("match-all", atom.without_use) and \
+							not atom.cp.startswith("virtual/"):
+							unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+						if catdir != "virtual":
+							if not is_blocker and \
+								atom.cp in suspect_virtual:
+								self.qatracker.add_error(
+									'virtual.suspect', ebuild.relative_path +
+									": %s: consider using '%s' instead of '%s'" %
+									(mytype, suspect_virtual[atom.cp], atom))
+							if not is_blocker and \
+								atom.cp.startswith("perl-core/"):
+								self.qatracker.add_error('dependency.perlcore',
+									ebuild.relative_path +
+									": %s: please use '%s' instead of '%s'" %
+									(mytype,
+									atom.replace("perl-core/","virtual/perl-"),
+									atom))
+
+						if buildtime and \
+							not is_blocker and \
+							not inherited_java_eclass and \
+							atom.cp == "virtual/jdk":
+							self.qatracker.add_error(
+								'java.eclassesnotused', ebuild.relative_path)
+						elif buildtime and \
+							not is_blocker and \
+							not inherited_wxwidgets_eclass and \
+							atom.cp == "x11-libs/wxGTK":
+							self.qatracker.add_error(
+								'wxwidgets.eclassnotused',
+								"%s: %ss on x11-libs/wxGTK without inheriting"
+								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
+						elif runtime:
+							if not is_blocker and \
+								atom.cp in suspect_rdepend:
+								self.qatracker.add_error(
+									mytype + '.suspect',
+									ebuild.relative_path + ": '%s'" % atom)
+
+						if atom.operator == "~" and \
+							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+							qacat = 'dependency.badtilde'
+							self.qatracker.add_error(
+								qacat, "%s: %s uses the ~ operator"
+								" with a non-zero revision: '%s'" %
+								(ebuild.relative_path, mytype, atom))
+
+						check_missingslot(atom, mytype, eapi, self.portdb, self.qatracker,
+							ebuild.relative_path, myaux)
+
+				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+			for m, b in zip(type_list, badsyntax):
+				if m.endswith("DEPEND"):
+					qacat = "dependency.syntax"
+				else:
+					qacat = m + ".syntax"
+				self.qatracker.add_error(
+					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+
+			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+			badlicsyntax = badlicsyntax > 0
+			badprovsyntax = badprovsyntax > 0
+
+			self.use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, self.muselist)
+
+			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
+			used_useflags = used_useflags.union(ebuild_used_useflags)
+
+			self.rubyeclasscheck.check(pkg, ebuild)
+
+			# license checks
+			if not badlicsyntax:
+				self.licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			self.restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
+
+			# Syntax Checks
+			if not self.vcs_settings.vcs_preserves_mtime:
+				if ebuild.ebuild_path not in self.changed.new_ebuilds and \
+					ebuild.ebuild_path not in self.changed.ebuilds:
+					pkg.mtime = None
+			try:
+				# All ebuilds should have utf_8 encoding.
+				f = io.open(
+					_unicode_encode(
+						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
+					mode='r', encoding=_encodings['repo.content'])
+				try:
+					for check_name, e in run_checks(f, pkg):
+						self.qatracker.add_error(
+							check_name, ebuild.relative_path + ': %s' % e)
+				finally:
+					f.close()
+			except UnicodeDecodeError:
+				# A file.UTF8 failure will have already been recorded above.
+				pass
+
+			if self.options.force:
+				# The dep_check() calls are the most expensive QA test. If --force
+				# is enabled, there's no point in wasting time on these since the
+				# user is intent on forcing the commit anyway.
+				continue
+
+			relevant_profiles = []
+			for keyword, arch, groups in arches:
+				if arch not in self.profiles:
+					# A missing profile will create an error further down
+					# during the KEYWORDS verification.
+					continue
+
+				if self.include_arches is not None:
+					if arch not in self.include_arches:
+						continue
+
+				relevant_profiles.extend(
+					(keyword, groups, prof) for prof in self.profiles[arch])
+
+			relevant_profiles.sort(key=sort_key)
+
+			for keyword, groups, prof in relevant_profiles:
+
+				is_stable_profile = prof.status == "stable"
+				is_dev_profile = prof.status == "dev" and \
+					self.options.include_dev
+				is_exp_profile = prof.status == "exp" and \
+					self.options.include_exp_profiles == 'y'
+				if not (is_stable_profile or is_dev_profile or is_exp_profile):
+					continue
+
+				dep_settings = self.caches['arch'].get(prof.sub_path)
+				if dep_settings is None:
+					dep_settings = portage.config(
+						config_profile_path=prof.abs_path,
+						config_incrementals=self.repoman_incrementals,
+						config_root=self.config_root,
+						local_config=False,
+						_unmatched_removal=self.options.unmatched_removal,
+						env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+					dep_settings.categories = self.repo_settings.repoman_settings.categories
+					if self.options.without_mask:
+						dep_settings._mask_manager_obj = \
+							copy.deepcopy(dep_settings._mask_manager)
+						dep_settings._mask_manager._pmaskdict.clear()
+					self.caches['arch'][prof.sub_path] = dep_settings
+
+				xmatch_cache_key = (prof.sub_path, tuple(groups))
+				xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+				if xcache is None:
+					self.portdb.melt()
+					self.portdb.freeze()
+					xcache = self.portdb.xcache
+					xcache.update(self.caches['shared_xmatch'])
+					self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+				self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+				self.portdb.settings = dep_settings
+				self.portdb.xcache = xcache
+
+				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+				# just in case, prevent config.reset() from nuking these.
+				dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+				# This attribute is used in dbapi._match_use() to apply
+				# use.stable.{mask,force} settings based on the stable
+				# status of the parent package. This is required in order
+				# for USE deps of unstable packages to be resolved correctly,
+				# since otherwise use.stable.{mask,force} settings of
+				# dependencies may conflict (see bug #456342).
+				dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+				# Handle package.use*.{force,mask) calculation, for use
+				# in dep_check.
+				dep_settings.useforce = dep_settings._use_manager.getUseForce(
+					pkg, stable=dep_settings._parent_stable)
+				dep_settings.usemask = dep_settings._use_manager.getUseMask(
+					pkg, stable=dep_settings._parent_stable)
+
+				if not baddepsyntax:
+					ismasked = not ebuild_archs or \
+						pkg.cpv not in self.portdb.xmatch("match-visible",
+						Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+					if ismasked:
+						if not self.have['pmasked']:
+							self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+								pkg.cpv, pkg._metadata))
+						if self.options.ignore_masked:
+							continue
+						# we are testing deps for a masked package; give it some lee-way
+						suffix = "masked"
+						matchmode = "minimum-all"
+					else:
+						suffix = ""
+						matchmode = "minimum-visible"
+
+					if not self.have['dev_keywords']:
+						self.have['dev_keywords'] = \
+							bool(self.dev_keywords.intersection(keywords))
+
+					if prof.status == "dev":
+						suffix = suffix + "indev"
+
+					for mytype in Package._dep_keys:
+
+						mykey = "dependency.bad" + suffix
+						myvalue = myaux[mytype]
+						if not myvalue:
+							continue
+
+						success, atoms = portage.dep_check(
+							myvalue, self.portdb, dep_settings,
+							use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+						if success:
+							if atoms:
+
+								# Don't bother with dependency.unknown for
+								# cases in which *DEPEND.bad is triggered.
+								for atom in atoms:
+									# dep_check returns all blockers and they
+									# aren't counted for *DEPEND.bad, so we
+									# ignore them here.
+									if not atom.blocker:
+										unknown_pkgs.discard(
+											(mytype, atom.unevaluated_atom))
+
+								if not prof.sub_path:
+									# old-style virtuals currently aren't
+									# resolvable with empty profile, since
+									# 'virtuals' mappings are unavailable
+									# (it would be expensive to search
+									# for PROVIDE in all ebuilds)
+									atoms = [
+										atom for atom in atoms if not (
+											atom.cp.startswith('virtual/')
+											and not self.portdb.cp_list(atom.cp))]
+
+								# we have some unsolvable deps
+								# remove ! deps, which always show up as unsatisfiable
+								atoms = [
+									str(atom.unevaluated_atom)
+									for atom in atoms if not atom.blocker]
+
+								# if we emptied out our list, continue:
+								if not atoms:
+									continue
+								self.qatracker.add_error(mykey,
+									"%s: %s: %s(%s)\n%s"
+									% (ebuild.relative_path, mytype, keyword, prof,
+										pformat(atoms, indent=6)))
+						else:
+							self.qatracker.add_error(mykey,
+								"%s: %s: %s(%s)\n%s"
+								% (ebuild.relative_path, mytype, keyword, prof,
+									pformat(atoms, indent=6)))
+
+			if not baddepsyntax and unknown_pkgs:
+				type_map = {}
+				for mytype, atom in unknown_pkgs:
+					type_map.setdefault(mytype, set()).add(atom)
+				for mytype, atoms in type_map.items():
+					self.qatracker.add_error(
+						"dependency.unknown", "%s: %s: %s"
+						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+
+		# check if there are unused local USE-descriptions in metadata.xml
+		# (unless there are any invalids, to avoid noise)
+		if self.allvalid:
+			for myflag in self.muselist.difference(used_useflags):
+				self.qatracker.add_error(
+					"metadata.warning",
+					"%s/metadata.xml: unused local USE-description: '%s'"
+					% (xpkg, myflag))


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-19  1:22 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-19  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e7607003f01c16b34def04d2069a72f140dfe999
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 00:48:05 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 01:19:08 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e7607003

repoman: Move the remaining actions to an Actions class

 pym/repoman/{main.py => actions.py} | 658 +++++++++++++------------------
 pym/repoman/main.py                 | 756 ++----------------------------------
 2 files changed, 298 insertions(+), 1116 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/actions.py
old mode 100755
new mode 100644
similarity index 66%
copy from pym/repoman/main.py
copy to pym/repoman/actions.py
index 2b2f91d..615d5f4
--- a/pym/repoman/main.py
+++ b/pym/repoman/actions.py
@@ -1,337 +1,77 @@
-#!/usr/bin/python -bO
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function, unicode_literals
 
 import errno
 import io
 import logging
+import platform
 import re
 import signal
 import subprocess
 import sys
 import tempfile
-import platform
 from itertools import chain
 
-from os import path as osp
-if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
-	pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__)))) #, "pym")
-	sys.path.insert(0, pym_path)
-# import our centrally initialized portage instance
-from repoman._portage import portage
-portage._internal_caller = True
-portage._disable_legacy_globals()
-
+from _emerge.UserQuery import UserQuery
 
+import portage
+from portage import cvstree
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
-import portage.checksum
-import portage.const
-import portage.repository.config
-from portage import cvstree
-from portage import util
-from portage.process import find_binary, spawn
 from portage.output import (
-	bold, create_color_func, green, nocolor, red)
-from portage.output import ConsoleStyleFile, StyleWriter
-from portage.util import formatter
-from portage.util import writemsg_level
+	bold, create_color_func, green, red)
 from portage.package.ebuild.digestgen import digestgen
+from portage.process import find_binary, spawn
+from portage.util import writemsg_level
 
-from repoman.argparser import parse_args
-from repoman.checks.ebuilds.checks import checks_init
+from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.qa_data import (
-	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats)
-from repoman.repos import RepoSettings
-from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
-
-if sys.hexversion >= 0x3000000:
-	basestring = str
-
-util.initialize_logger()
+from repoman.vcs.vcs import git_supports_gpg_sign, vcs_files_to_cps
 
 bad = create_color_func("BAD")
 
-# A sane umask is needed for files that portage creates.
-os.umask(0o22)
-
-
-def repoman_main(argv):
-	config_root = os.environ.get("PORTAGE_CONFIGROOT")
-	repoman_settings = portage.config(config_root=config_root, local_config=False)
-
-	if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
-		repoman_settings.get('TERM') == 'dumb' or \
-		not sys.stdout.isatty():
-		nocolor()
-
-	options, arguments = parse_args(
-		sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
-
-	if options.version:
-		print("Portage", portage.VERSION)
-		sys.exit(0)
-
-	if options.experimental_inherit == 'y':
-		# This is experimental, so it's non-fatal.
-		qawarnings.add("inherit.missing")
-		checks_init(experimental_inherit=True)
-
-	# Set this to False when an extraordinary issue (generally
-	# something other than a QA issue) makes it impossible to
-	# commit (like if Manifest generation fails).
-	can_force = True
-
-	portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-	if portdir is None:
-		sys.exit(1)
-
-	myreporoot = os.path.basename(portdir_overlay)
-	myreporoot += mydir[len(portdir_overlay):]
-
-	vcs_settings = VCSSettings(options, repoman_settings)
-
-	repo_settings = RepoSettings(
-		config_root, portdir, portdir_overlay,
-		repoman_settings, vcs_settings, options, qawarnings)
-	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
-
-	if 'digest' in repoman_settings.features and options.digest != 'n':
-		options.digest = 'y'
-
-	logging.debug("vcs: %s" % (vcs_settings.vcs,))
-	logging.debug("repo config: %s" % (repo_settings.repo_config,))
-	logging.debug("options: %s" % (options,))
-
-	# It's confusing if these warnings are displayed without the user
-	# being told which profile they come from, so disable them.
-	env = os.environ.copy()
-	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
-
-	# Perform the main checks
-	scanner = Scanner(repo_settings, myreporoot, config_root, options,
-					vcs_settings, mydir, env)
-	qatracker, can_force = scanner.scan_pkgs(can_force)
-
-	commitmessage = None
-
-	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
-		logging.warning("--if-modified is enabled, but no modified packages were found!")
-
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
-
-	# early out for manifest generation
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
-	for x in qacats:
-		if x not in qatracker.fails:
-			continue
-		dowarn = 1
-		if x not in qawarnings:
-			dofail = 1
-
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
-
-	# Save QA output so that it can be conveniently displayed
-	# in $EDITOR while the user creates a commit message.
-	# Otherwise, the user would not be able to see this output
-	# once the editor has taken over the screen.
-	qa_output = io.StringIO()
-	style_file = ConsoleStyleFile(sys.stdout)
-	if options.mode == 'commit' and \
-		(not commitmessage or not commitmessage.strip()):
-		style_file.write_listener = qa_output
-	console_writer = StyleWriter(file=style_file, maxcol=9999)
-	console_writer.style_listener = style_file.new_styles
-
-	f = formatter.AbstractFormatter(console_writer)
-
-	format_outputs = {
-		'column': format_qa_output_column,
-		'default': format_qa_output
-	}
-
-	format_output = format_outputs.get(
-		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
-
-	style_file.flush()
-	del console_writer, f, style_file
-	qa_output = qa_output.getvalue()
-	qa_output = qa_output.splitlines(True)
-
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
 
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
+class Actions(object):
+	'''Handles post check result output and performs
+	the various vcs activities for committing the results'''
+
+	def __init__(self, repo_settings, options, scanner, vcs_settings):
+		self.repo_settings = repo_settings
+		self.options = options
+		self.scanner = scanner
+		self.vcs_settings = vcs_settings
+		self.suggest = {
+			'ignore_masked': False,
+			'include_dev': False,
+		}
+		if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
+			self.suggest['ignore_masked'] = True
+		if scanner.have['dev_keywords'] and not options.include_dev:
+			self.suggest['include_dev'] = True
+
+
+	def inform(self, can_force, result):
+		'''Inform the user of all the problems found'''
+		if self.suggest['ignore_masked'] or self.suggest['include_dev']:
+			self._suggest()
+		if self.options.mode != 'commit':
+			self._non_commit(result)
+		else:
+			self._fail(result, can_force)
+			if self.options.pretend:
+				utilities.repoman_sez(
+					"\"So, you want to play it safe. Good call.\"\n")
 
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
 
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
+	def perform(self, qa_output):
+		myunadded, mydeleted = self._vcs_unadded()
 
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+		myautoadd = self._vcs_autoadd(myunadded)
 
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		self._vcs_deleted(mydeleted)
 
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
+		if self.vcs_settings.vcs == "cvs":
 			mycvstree = cvstree.getentries("./", recursive=1)
 			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
 			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
@@ -340,7 +80,7 @@ def repoman_main(argv):
 			no_expansion = set(portage.cvstree.findoption(
 				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
 
-		if vcs_settings.vcs == "svn":
+		if self.vcs_settings.vcs == "svn":
 			with repoman_popen("svn status") as f:
 				svnstatus = f.readlines()
 			mychanged = [
@@ -363,7 +103,7 @@ def repoman_main(argv):
 				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
 				for prop in props if " - " in prop)
 
-		elif vcs_settings.vcs == "git":
+		elif self.vcs_settings.vcs == "git":
 			with repoman_popen(
 				"git diff-index --name-only "
 				"--relative --diff-filter=M HEAD") as f:
@@ -382,7 +122,7 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem[:-1] for elem in myremoved]
 
-		if vcs_settings.vcs == "bzr":
+		if self.vcs_settings.vcs == "bzr":
 			with repoman_popen("bzr status -S .") as f:
 				bzrstatus = f.readlines()
 			mychanged = [
@@ -403,7 +143,7 @@ def repoman_main(argv):
 				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
 			# Bazaar expands nothing.
 
-		if vcs_settings.vcs == "hg":
+		if self.vcs_settings.vcs == "hg":
 			with repoman_popen("hg status --no-status --modified .") as f:
 				mychanged = f.readlines()
 			mychanged = ["./" + elem.rstrip() for elem in mychanged]
@@ -416,9 +156,9 @@ def repoman_main(argv):
 				myremoved = f.readlines()
 			myremoved = ["./" + elem.rstrip() for elem in myremoved]
 
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
+			a_file_is_deleted_hg = self.vcs_settings.vcs == "hg" and mydeleted
 
 			if not (a_file_is_changed or a_file_is_deleted_hg):
 				utilities.repoman_sez(
@@ -442,12 +182,12 @@ def repoman_main(argv):
 		mymanifests = list(mymanifests)
 		myheaders = []
 
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
+		commitmessage = self.options.commitmsg
+		if self.options.commitmsgfile:
 			try:
 				f = io.open(
 					_unicode_encode(
-						options.commitmsgfile,
+						self.options.commitmsgfile,
 						encoding=_encodings['fs'], errors='strict'),
 					mode='r', encoding=_encodings['content'], errors='replace')
 				commitmessage = f.read()
@@ -457,15 +197,15 @@ def repoman_main(argv):
 				if e.errno == errno.ENOENT:
 					portage.writemsg(
 						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
+						" --commitmsgfile='%s'\n" % self.options.commitmsgfile)
 				else:
 					raise
 			# We've read the content so the file is no longer needed.
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
+			if self.scanner.repolevel > 1:
+				msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -484,29 +224,29 @@ def repoman_main(argv):
 		commitmessage = commitmessage.rstrip()
 		changelog_msg = commitmessage
 		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
+		gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "")
+		dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "")
 		if portage_version is None:
 			sys.stderr.write("Failed to insert portage version in message!\n")
 			sys.stderr.flush()
 			portage_version = "Unknown"
 
 		report_options = []
-		if options.force:
+		if self.options.force:
 			report_options.append("--force")
-		if options.ignore_arches:
+		if self.options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
+		if self.scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
+				" ".join(sorted(self.scanner.include_arches)))
 
-		if vcs_settings.vcs == "git":
+		if self.vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
 			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
 			if report_options:
 				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
 			if dco_sob:
 				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
@@ -520,10 +260,10 @@ def repoman_main(argv):
 			if dco_sob:
 				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
 			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
+				(portage_version, self.vcs_settings.vcs, unameout)
 			if report_options:
 				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
+			if self.repo_settings.sign_manifests:
 				commit_footer += ", signed Manifest commit with key %s" % \
 					(gpg_key, )
 			else:
@@ -533,24 +273,24 @@ def repoman_main(argv):
 		commitmessage += commit_footer
 
 		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
+		if self.options.echangelog in ('y', 'force'):
 			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
 				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
+				checkdir = self.repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if scanner.repolevel < 3:
+				if self.scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
+				if self.scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
+				changelog_modified = changelog_path in self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
 					continue
 
 				# get changes for this package
@@ -566,15 +306,15 @@ def repoman_main(argv):
 				nontrivial_cl_files = set()
 				nontrivial_cl_files.update(clnew, clremoved, clchanged)
 				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
 					continue
 
 				new_changelog = utilities.UpdateChangeLog(
 					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
 					catdir, pkgdir,
 					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
+					pretend=self.options.pretend)
 				if new_changelog is None:
 					writemsg_level(
 						"!!! Updating the ChangeLog failed\n",
@@ -588,18 +328,18 @@ def repoman_main(argv):
 				else:
 					myupdates.append(changelog_path)
 
-				if options.ask and not options.pretend:
+				if self.options.ask and not self.options.pretend:
 					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 				else:
 					broken_changelog_manifests.append(x)
 
 		if myautoadd:
 			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
+			add_cmd = [self.vcs_settings.vcs, "add"]
 			add_cmd += myautoadd
-			if options.pretend:
+			if self.options.pretend:
 				portage.writemsg_stdout(
 					"(%s)\n" % " ".join(add_cmd),
 					noiselevel=-1)
@@ -618,22 +358,22 @@ def repoman_main(argv):
 				retcode = subprocess.call(add_cmd)
 				if retcode != os.EX_OK:
 					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
 					sys.exit(retcode)
 
 			myupdates += myautoadd
 
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
-		if vcs_settings.vcs not in ('cvs', 'svn'):
+		if self.vcs_settings.vcs not in ('cvs', 'svn'):
 			# With git, bzr and hg, there's never any keyword expansion, so
 			# there's no need to regenerate manifests and all files will be
 			# committed in one big commit at the end.
 			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
+		elif not self.repo_settings.repo_config.thin_manifest:
+			if self.vcs_settings.vcs == 'cvs':
 				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
+			elif self.vcs_settings.vcs == "svn":
 				svn_keywords = dict((k.lower(), k) for k in [
 					"Rev",
 					"Revision",
@@ -651,12 +391,12 @@ def repoman_main(argv):
 			for myfile in myupdates:
 
 				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
+				if self.vcs_settings.vcs == "cvs":
 					if myfile in no_expansion:
 						continue
 
 				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
+				elif self.vcs_settings.vcs == "svn":
 					if myfile not in expansion:
 						continue
 
@@ -684,8 +424,8 @@ def repoman_main(argv):
 		logging.info("myupdates: %s", myupdates)
 		logging.info("myheaders: %s", myheaders)
 
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
+		uq = UserQuery(self.options)
+		if self.options.ask and uq.query('Commit changes?', True) != 'Yes':
 			print("* aborting commit.")
 			sys.exit(128 + signal.SIGINT)
 
@@ -713,22 +453,22 @@ def repoman_main(argv):
 			# so strip the prefix.
 			myfiles = [f.lstrip("./") for f in myfiles]
 
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+			commit_cmd = [self.vcs_settings.vcs]
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
 			commit_cmd.extend(["-F", commitmessagefile])
 			commit_cmd.extend(myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -759,39 +499,39 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if scanner.repolevel == 1:
+		if self.scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
 
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
+		if self.vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
 		elif broken_changelog_manifests:
 			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
+				self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+				digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
 
-		if repo_settings.sign_manifests:
+		if self.repo_settings.sign_manifests:
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
+					self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+					self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
+					manifest_path = os.path.join(self.repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):
 						continue
-					gpgsign(manifest_path, repoman_settings, options)
+					gpgsign(manifest_path, self.repoman_settings, self.options)
 			except portage.exception.PortageException as e:
 				portage.writemsg("!!! %s\n" % str(e))
 				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
+				self.repo_settings.sign_manifests = False
 
-		if vcs_settings.vcs == 'git':
+		if self.vcs_settings.vcs == 'git':
 			# It's not safe to use the git commit -a option since there might
 			# be some modified files elsewhere in the working tree that the
 			# user doesn't want to commit. Therefore, call git update-index
@@ -802,14 +542,14 @@ def repoman_main(argv):
 			myfiles.sort()
 			update_index_cmd = ["git", "update-index"]
 			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
+			if self.options.pretend:
 				print("(%s)" % (" ".join(update_index_cmd),))
 			else:
 				retval = spawn(update_index_cmd, env=os.environ)
 				if retval != os.EX_OK:
 					writemsg_level(
 						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
+						"error code: %s\n" % (self.vcs_settings.vcs, retval),
 						level=logging.ERROR, noiselevel=-1)
 					sys.exit(retval)
 
@@ -829,15 +569,15 @@ def repoman_main(argv):
 			mymsg.close()
 
 			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
+			if self.options.pretend and self.vcs_settings.vcs is None:
 				# substitute a bogus value for pretend output
 				commit_cmd.append("cvs")
 			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
+				commit_cmd.append(self.vcs_settings.vcs)
+			commit_cmd.extend(self.vcs_settings.vcs_global_opts)
 			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
+			commit_cmd.extend(self.vcs_settings.vcs_local_opts)
+			if self.vcs_settings.vcs == "hg":
 				commit_cmd.extend(["--logfile", commitmessagefile])
 				commit_cmd.extend(myfiles)
 			else:
@@ -845,12 +585,12 @@ def repoman_main(argv):
 				commit_cmd.extend(f.lstrip("./") for f in myfiles)
 
 			try:
-				if options.pretend:
+				if self.options.pretend:
 					print("(%s)" % (" ".join(commit_cmd),))
 				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
+					retval = spawn(commit_cmd, env=self.repo_settings.commit_env)
 					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
+						if self.repo_settings.repo_config.sign_commit and self.vcs_settings.vcs == 'git' and \
 							not git_supports_gpg_sign():
 							# Inform user that newer git is needed (bug #403323).
 							logging.error(
@@ -858,7 +598,7 @@ def repoman_main(argv):
 
 						writemsg_level(
 							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
+							"error code: %s\n" % (self.vcs_settings.vcs, retval),
 							level=logging.ERROR, noiselevel=-1)
 						sys.exit(retval)
 			finally:
@@ -868,7 +608,7 @@ def repoman_main(argv):
 					pass
 
 		print()
-		if vcs_settings.vcs:
+		if self.vcs_settings.vcs:
 			print("Commit complete.")
 		else:
 			print(
@@ -877,4 +617,154 @@ def repoman_main(argv):
 				" that he forgot to commit anything")
 		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"\n")
-	sys.exit(0)
+
+
+	def _suggest(self):
+		print()
+		if self.suggest['ignore_masked']:
+			print(bold(
+				"Note: use --without-mask to check "
+				"KEYWORDS on dependencies of masked packages"))
+
+		if self.suggest['include_dev']:
+			print(bold(
+				"Note: use --include-dev (-d) to check "
+				"dependencies for 'dev' profiles"))
+		print()
+
+
+	def _non_commit(self, result):
+		if result['full']:
+			print(bold("Note: type \"repoman full\" for a complete listing."))
+		if result['warn'] and not result['fail']:
+			utilities.repoman_sez(
+				"\"You're only giving me a partial QA payment?\n"
+				"              I'll take it this time, but I'm not happy.\"")
+		elif not result['fail']:
+			utilities.repoman_sez(
+				"\"If everyone were like you, I'd be out of business!\"")
+		elif result['fail']:
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _fail(self, result, can_force):
+		if result['fail'] and can_force and self.options.force and not self.options.pretend:
+			utilities.repoman_sez(
+				" \"You want to commit even with these QA issues?\n"
+				"              I'll take it this time, but I'm not happy.\"\n")
+		elif result['fail']:
+			if self.options.force and not can_force:
+				print(bad(
+					"The --force option has been disabled"
+					" due to extraordinary issues."))
+			print(bad("Please fix these important QA issues first."))
+			utilities.repoman_sez(
+				"\"Make your QA payment on time"
+				" and you'll never see the likes of me.\"\n")
+			sys.exit(1)
+
+
+	def _vcs_unadded(self):
+		myunadded = []
+		mydeleted = []
+		if self.vcs_settings.vcs == "cvs":
+			try:
+				myvcstree = portage.cvstree.getentries("./", recursive=1)
+				myunadded = portage.cvstree.findunadded(
+					myvcstree, recursive=1, basedir="./")
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving CVS tree; exiting.")
+		if self.vcs_settings.vcs == "svn":
+			try:
+				with repoman_popen("svn status --no-ignore") as f:
+					svnstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1]
+					for elem in svnstatus
+					if elem.startswith("?") or elem.startswith("I")]
+			except SystemExit:
+				raise  # TODO propagate this
+			except:
+				err("Error retrieving SVN info; exiting.")
+		if self.vcs_settings.vcs == "git":
+			# get list of files not under version control or missing
+			myf = repoman_popen("git ls-files --others")
+			myunadded = ["./" + elem[:-1] for elem in myf]
+			myf.close()
+		if self.vcs_settings.vcs == "bzr":
+			try:
+				with repoman_popen("bzr status -S .") as f:
+					bzrstatus = f.readlines()
+				myunadded = [
+					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
+					for elem in bzrstatus
+					if elem.startswith("?") or elem[0:2] == " D"]
+			except SystemExit:
+				raise # TODO propagate this
+			except:
+				err("Error retrieving bzr info; exiting.")
+		if self.vcs_settings.vcs == "hg":
+			with repoman_popen("hg status --no-status --unknown .") as f:
+				myunadded = f.readlines()
+			myunadded = ["./" + elem.rstrip() for elem in myunadded]
+
+			# Mercurial doesn't handle manually deleted files as removed from
+			# the repository, so the user need to remove them before commit,
+			# using "hg remove [FILES]"
+			with repoman_popen("hg status --no-status --deleted .") as f:
+				mydeleted = f.readlines()
+			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
+		return myunadded, mydeleted
+
+
+	def _vcs_autoadd(self, myunadded):
+		myautoadd = []
+		if myunadded:
+			for x in range(len(myunadded) - 1, -1, -1):
+				xs = myunadded[x].split("/")
+				if self.repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
+					# The Manifest excludes this file,
+					# so it's safe to ignore.
+					del myunadded[x]
+				elif xs[-1] == "files":
+					print("!!! files dir is not added! Please correct this.")
+					sys.exit(-1)
+				elif xs[-1] == "Manifest":
+					# It's a manifest... auto add
+					myautoadd += [myunadded[x]]
+					del myunadded[x]
+
+		if myunadded:
+			print(red(
+				"!!! The following files are in your local tree"
+				" but are not added to the master"))
+			print(red(
+				"!!! tree. Please remove them from the local tree"
+				" or add them to the master tree."))
+			for x in myunadded:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)
+		return myautoadd
+
+
+	def _vcs_deleted(self, mydeleted):
+		if self.vcs_settings.vcs == "hg" and mydeleted:
+			print(red(
+				"!!! The following files are removed manually"
+				" from your local tree but are not"))
+			print(red(
+				"!!! removed from the repository."
+				" Please remove them, using \"hg remove [FILES]\"."))
+			for x in mydeleted:
+				print("   ", x)
+			print()
+			print()
+			sys.exit(1)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2b2f91d..b6f88b2 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,16 +4,9 @@
 
 from __future__ import print_function, unicode_literals
 
-import errno
 import io
 import logging
-import re
-import signal
-import subprocess
 import sys
-import tempfile
-import platform
-from itertools import chain
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -26,36 +19,24 @@ portage._disable_legacy_globals()
 
 
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
-from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree
 from portage import util
-from portage.process import find_binary, spawn
-from portage.output import (
-	bold, create_color_func, green, nocolor, red)
+from portage.output import create_color_func, nocolor
 from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import formatter
-from portage.util import writemsg_level
-from portage.package.ebuild.digestgen import digestgen
 
+from repoman.actions import Actions
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import checks_init
-from repoman.errors import err
-from repoman.gpg import gpgsign, need_signature
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats)
 from repoman.repos import RepoSettings
 from repoman.scanner import Scanner
-from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (
-	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-
+from repoman.vcs.vcs import VCSSettings
 
 if sys.hexversion >= 0x3000000:
 	basestring = str
@@ -107,7 +88,6 @@ def repoman_main(argv):
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 	repoman_settings = repo_settings.repoman_settings
-	portdb = repo_settings.portdb
 
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
@@ -131,27 +111,29 @@ def repoman_main(argv):
 	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	# dofail will be true if we have failed in at least one non-warning category
-	dofail = 0
-	# dowarn will be true if we tripped any warnings
-	dowarn = 0
-	# dofull will be true if we should print a "repoman full" informational message
-	dofull = options.mode != 'full'
+	result = {
+		# fail will be true if we have failed in at least one non-warning category
+		'fail': 0,
+		# warn will be true if we tripped any warnings
+		'warn': 0,
+		# full will be true if we should print a "repoman full" informational message
+		'full': options.mode != 'full',
+	}
 
 	# early out for manifest generation
 	if options.mode == "manifest":
-		sys.exit(dofail)
+		sys.exit(result['fail'])
 
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
-		dowarn = 1
+		result['warn'] = 1
 		if x not in qawarnings:
-			dofail = 1
+			result['fail'] = 1
 
-	if dofail or \
-		(dowarn and not (options.quiet or options.mode == "scan")):
-		dofull = 0
+	if result['fail'] or \
+		(result['warn'] and not (options.quiet or options.mode == "scan")):
+		result['full'] = 0
 
 	# Save QA output so that it can be conveniently displayed
 	# in $EDITOR while the user creates a commit message.
@@ -174,707 +156,17 @@ def repoman_main(argv):
 
 	format_output = format_outputs.get(
 		options.output_style, format_outputs['default'])
-	format_output(f, qatracker.fails, dofull, dofail, options, qawarnings)
+	format_output(f, qatracker.fails, result['full'], result['fail'], options, qawarnings)
 
 	style_file.flush()
 	del console_writer, f, style_file
 	qa_output = qa_output.getvalue()
 	qa_output = qa_output.splitlines(True)
 
-	suggest_ignore_masked = False
-	suggest_include_dev = False
-
-	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
-		suggest_ignore_masked = True
-	if scanner.have['dev_keywords'] and not options.include_dev:
-		suggest_include_dev = True
-
-	if suggest_ignore_masked or suggest_include_dev:
-		print()
-		if suggest_ignore_masked:
-			print(bold(
-				"Note: use --without-mask to check "
-				"KEYWORDS on dependencies of masked packages"))
-
-		if suggest_include_dev:
-			print(bold(
-				"Note: use --include-dev (-d) to check "
-				"dependencies for 'dev' profiles"))
-		print()
-
-	if options.mode != 'commit':
-		if dofull:
-			print(bold("Note: type \"repoman full\" for a complete listing."))
-		if dowarn and not dofail:
-			utilities.repoman_sez(
-				"\"You're only giving me a partial QA payment?\n"
-				"              I'll take it this time, but I'm not happy.\"")
-		elif not dofail:
-			utilities.repoman_sez(
-				"\"If everyone were like you, I'd be out of business!\"")
-		elif dofail:
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-	else:
-		if dofail and can_force and options.force and not options.pretend:
-			utilities.repoman_sez(
-				" \"You want to commit even with these QA issues?\n"
-				"              I'll take it this time, but I'm not happy.\"\n")
-		elif dofail:
-			if options.force and not can_force:
-				print(bad(
-					"The --force option has been disabled"
-					" due to extraordinary issues."))
-			print(bad("Please fix these important QA issues first."))
-			utilities.repoman_sez(
-				"\"Make your QA payment on time"
-				" and you'll never see the likes of me.\"\n")
-			sys.exit(1)
-
-		if options.pretend:
-			utilities.repoman_sez(
-				"\"So, you want to play it safe. Good call.\"\n")
-
-		myunadded = []
-		if vcs_settings.vcs == "cvs":
-			try:
-				myvcstree = portage.cvstree.getentries("./", recursive=1)
-				myunadded = portage.cvstree.findunadded(
-					myvcstree, recursive=1, basedir="./")
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving CVS tree; exiting.")
-		if vcs_settings.vcs == "svn":
-			try:
-				with repoman_popen("svn status --no-ignore") as f:
-					svnstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1]
-					for elem in svnstatus
-					if elem.startswith("?") or elem.startswith("I")]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving SVN info; exiting.")
-		if vcs_settings.vcs == "git":
-			# get list of files not under version control or missing
-			myf = repoman_popen("git ls-files --others")
-			myunadded = ["./" + elem[:-1] for elem in myf]
-			myf.close()
-		if vcs_settings.vcs == "bzr":
-			try:
-				with repoman_popen("bzr status -S .") as f:
-					bzrstatus = f.readlines()
-				myunadded = [
-					"./" + elem.rstrip().split()[1].split('/')[-1:][0]
-					for elem in bzrstatus
-					if elem.startswith("?") or elem[0:2] == " D"]
-			except SystemExit as e:
-				raise  # TODO propagate this
-			except:
-				err("Error retrieving bzr info; exiting.")
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --unknown .") as f:
-				myunadded = f.readlines()
-			myunadded = ["./" + elem.rstrip() for elem in myunadded]
-
-			# Mercurial doesn't handle manually deleted files as removed from
-			# the repository, so the user need to remove them before commit,
-			# using "hg remove [FILES]"
-			with repoman_popen("hg status --no-status --deleted .") as f:
-				mydeleted = f.readlines()
-			mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
-
-		myautoadd = []
-		if myunadded:
-			for x in range(len(myunadded) - 1, -1, -1):
-				xs = myunadded[x].split("/")
-				if repo_settings.repo_config.find_invalid_path_char(myunadded[x]) != -1:
-					# The Manifest excludes this file,
-					# so it's safe to ignore.
-					del myunadded[x]
-				elif xs[-1] == "files":
-					print("!!! files dir is not added! Please correct this.")
-					sys.exit(-1)
-				elif xs[-1] == "Manifest":
-					# It's a manifest... auto add
-					myautoadd += [myunadded[x]]
-					del myunadded[x]
-
-		if myunadded:
-			print(red(
-				"!!! The following files are in your local tree"
-				" but are not added to the master"))
-			print(red(
-				"!!! tree. Please remove them from the local tree"
-				" or add them to the master tree."))
-			for x in myunadded:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "hg" and mydeleted:
-			print(red(
-				"!!! The following files are removed manually"
-				" from your local tree but are not"))
-			print(red(
-				"!!! removed from the repository."
-				" Please remove them, using \"hg remove [FILES]\"."))
-			for x in mydeleted:
-				print("   ", x)
-			print()
-			print()
-			sys.exit(1)
-
-		if vcs_settings.vcs == "cvs":
-			mycvstree = cvstree.getentries("./", recursive=1)
-			mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-			mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-			myremoved = portage.cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-			bin_blob_pattern = re.compile("^-kb$")
-			no_expansion = set(portage.cvstree.findoption(
-				mycvstree, bin_blob_pattern, recursive=1, basedir="./"))
-
-		if vcs_settings.vcs == "svn":
-			with repoman_popen("svn status") as f:
-				svnstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if (elem[:1] in "MR" or elem[1:2] in "M")]
-			mynew = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("A")]
-			myremoved = [
-				"./" + elem.split()[-1:][0]
-				for elem in svnstatus
-				if elem.startswith("D")]
-
-			# Subversion expands keywords specified in svn:keywords properties.
-			with repoman_popen("svn propget -R svn:keywords") as f:
-				props = f.readlines()
-			expansion = dict(
-				("./" + prop.split(" - ")[0], prop.split(" - ")[1].split())
-				for prop in props if " - " in prop)
-
-		elif vcs_settings.vcs == "git":
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=M HEAD") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=A HEAD") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem[:-1] for elem in mynew]
-
-			with repoman_popen(
-				"git diff-index --name-only "
-				"--relative --diff-filter=D HEAD") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-		if vcs_settings.vcs == "bzr":
-			with repoman_popen("bzr status -S .") as f:
-				bzrstatus = f.readlines()
-			mychanged = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and elem[1:2] == "M"]
-			mynew = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] in "NK" or elem[0:1] == "R")]
-			myremoved = [
-				"./" + elem.split()[-1:][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem.startswith("-")]
-			myremoved = [
-				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-				for elem in bzrstatus
-				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
-			# Bazaar expands nothing.
-
-		if vcs_settings.vcs == "hg":
-			with repoman_popen("hg status --no-status --modified .") as f:
-				mychanged = f.readlines()
-			mychanged = ["./" + elem.rstrip() for elem in mychanged]
-
-			with repoman_popen("hg status --no-status --added .") as f:
-				mynew = f.readlines()
-			mynew = ["./" + elem.rstrip() for elem in mynew]
-
-			with repoman_popen("hg status --no-status --removed .") as f:
-				myremoved = f.readlines()
-			myremoved = ["./" + elem.rstrip() for elem in myremoved]
-
-		if vcs_settings.vcs:
-			a_file_is_changed = mychanged or mynew or myremoved
-			a_file_is_deleted_hg = vcs_settings.vcs == "hg" and mydeleted
-
-			if not (a_file_is_changed or a_file_is_deleted_hg):
-				utilities.repoman_sez(
-					"\"Doing nothing is not always good for QA.\"")
-				print()
-				print("(Didn't find any changed files...)")
-				print()
-				sys.exit(1)
-
-		# Manifests need to be regenerated after all other commits, so don't commit
-		# them now even if they have changed.
-		mymanifests = set()
-		myupdates = set()
-		for f in mychanged + mynew:
-			if "Manifest" == os.path.basename(f):
-				mymanifests.add(f)
-			else:
-				myupdates.add(f)
-		myupdates.difference_update(myremoved)
-		myupdates = list(myupdates)
-		mymanifests = list(mymanifests)
-		myheaders = []
-
-		commitmessage = options.commitmsg
-		if options.commitmsgfile:
-			try:
-				f = io.open(
-					_unicode_encode(
-						options.commitmsgfile,
-						encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['content'], errors='replace')
-				commitmessage = f.read()
-				f.close()
-				del f
-			except (IOError, OSError) as e:
-				if e.errno == errno.ENOENT:
-					portage.writemsg(
-						"!!! File Not Found:"
-						" --commitmsgfile='%s'\n" % options.commitmsgfile)
-				else:
-					raise
-			# We've read the content so the file is no longer needed.
-			commitmessagefile = None
-		if not commitmessage or not commitmessage.strip():
-			msg_prefix = ""
-			if scanner.repolevel > 1:
-				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
-
-			try:
-				editor = os.environ.get("EDITOR")
-				if editor and utilities.editor_is_executable(editor):
-					commitmessage = utilities.get_commit_message_with_editor(
-						editor, message=qa_output, prefix=msg_prefix)
-				else:
-					commitmessage = utilities.get_commit_message_with_stdin()
-			except KeyboardInterrupt:
-				logging.fatal("Interrupted; exiting...")
-				sys.exit(1)
-			if (not commitmessage or not commitmessage.strip()
-					or commitmessage.strip() == msg_prefix):
-				print("* no commit message?  aborting commit.")
-				sys.exit(1)
-		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
-		portage_version = getattr(portage, "VERSION", None)
-		gpg_key = repoman_settings.get("PORTAGE_GPG_KEY", "")
-		dco_sob = repoman_settings.get("DCO_SIGNED_OFF_BY", "")
-		if portage_version is None:
-			sys.stderr.write("Failed to insert portage version in message!\n")
-			sys.stderr.flush()
-			portage_version = "Unknown"
-
-		report_options = []
-		if options.force:
-			report_options.append("--force")
-		if options.ignore_arches:
-			report_options.append("--ignore-arches")
-		if scanner.include_arches is not None:
-			report_options.append(
-				"--include-arches=\"%s\"" %
-				" ".join(sorted(scanner.include_arches)))
-
-		if vcs_settings.vcs == "git":
-			# Use new footer only for git (see bug #438364).
-			commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version
-			if report_options:
-				commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, )
-			if dco_sob:
-				commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
-		else:
-			unameout = platform.system() + " "
-			if platform.system() in ["Darwin", "SunOS"]:
-				unameout += platform.processor()
-			else:
-				unameout += platform.machine()
-			commit_footer = "\n\n"
-			if dco_sob:
-				commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
-			commit_footer += "(Portage version: %s/%s/%s" % \
-				(portage_version, vcs_settings.vcs, unameout)
-			if report_options:
-				commit_footer += ", RepoMan options: " + " ".join(report_options)
-			if repo_settings.sign_manifests:
-				commit_footer += ", signed Manifest commit with key %s" % \
-					(gpg_key, )
-			else:
-				commit_footer += ", unsigned Manifest commit"
-			commit_footer += ")"
-
-		commitmessage += commit_footer
-
-		broken_changelog_manifests = []
-		if options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if scanner.repolevel < 2:
-					checkdir_relative = os.path.join(catdir, checkdir_relative)
-				checkdir_relative = os.path.join(".", checkdir_relative)
-
-				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in scanner.changed.changelogs
-				if changelog_modified and options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if options.ask and not options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					repoman_settings["O"] = checkdir
-					digestgen(mysettings=repoman_settings, myportdb=portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
-		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
-
-		if vcs_settings.vcs not in ('cvs', 'svn'):
-			# With git, bzr and hg, there's never any keyword expansion, so
-			# there's no need to regenerate manifests and all files will be
-			# committed in one big commit at the end.
-			print()
-		elif not repo_settings.repo_config.thin_manifest:
-			if vcs_settings.vcs == 'cvs':
-				headerstring = "'\$(Header|Id).*\$'"
-			elif vcs_settings.vcs == "svn":
-				svn_keywords = dict((k.lower(), k) for k in [
-					"Rev",
-					"Revision",
-					"LastChangedRevision",
-					"Date",
-					"LastChangedDate",
-					"Author",
-					"LastChangedBy",
-					"URL",
-					"HeadURL",
-					"Id",
-					"Header",
-				])
-
-			for myfile in myupdates:
-
-				# for CVS, no_expansion contains files that are excluded from expansion
-				if vcs_settings.vcs == "cvs":
-					if myfile in no_expansion:
-						continue
-
-				# for SVN, expansion contains files that are included in expansion
-				elif vcs_settings.vcs == "svn":
-					if myfile not in expansion:
-						continue
-
-					# Subversion keywords are case-insensitive
-					# in svn:keywords properties,
-					# but case-sensitive in contents of files.
-					enabled_keywords = []
-					for k in expansion[myfile]:
-						keyword = svn_keywords.get(k.lower())
-						if keyword is not None:
-							enabled_keywords.append(keyword)
-
-					headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
-
-				myout = repoman_getstatusoutput(
-					"egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
-				if myout[0] == 0:
-					myheaders.append(myfile)
-
-			print("%s have headers that will change." % green(str(len(myheaders))))
-			print(
-				"* Files with headers will"
-				" cause the manifests to be changed and committed separately.")
-
-		logging.info("myupdates: %s", myupdates)
-		logging.info("myheaders: %s", myheaders)
-
-		uq = UserQuery(options)
-		if options.ask and uq.query('Commit changes?', True) != 'Yes':
-			print("* aborting commit.")
-			sys.exit(128 + signal.SIGINT)
-
-		# Handle the case where committed files have keywords which
-		# will change and need a priming commit before the Manifest
-		# can be committed.
-		if (myupdates or myremoved) and myheaders:
-			myfiles = myupdates + myremoved
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			separator = '-' * 78
-
-			print()
-			print(green("Using commit message:"))
-			print(green(separator))
-			print(commitmessage)
-			print(green(separator))
-			print()
-
-			# Having a leading ./ prefix on file paths can trigger a bug in
-			# the cvs server when committing files to multiple directories,
-			# so strip the prefix.
-			myfiles = [f.lstrip("./") for f in myfiles]
-
-			commit_cmd = [vcs_settings.vcs]
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			commit_cmd.extend(["-F", commitmessagefile])
-			commit_cmd.extend(myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		# When files are removed and re-added, the cvs server will put /Attic/
-		# inside the $Header path. This code detects the problem and corrects it
-		# so that the Manifest will generate correctly. See bug #169500.
-		# Use binary mode in order to avoid potential character encoding issues.
-		cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-		attic_str = b'/Attic/'
-		attic_replace = b'/'
-		for x in myheaders:
-			f = open(
-				_unicode_encode(x, encoding=_encodings['fs'], errors='strict'),
-				mode='rb')
-			mylines = f.readlines()
-			f.close()
-			modified = False
-			for i, line in enumerate(mylines):
-				if cvs_header_re.match(line) is not None and \
-					attic_str in line:
-					mylines[i] = line.replace(attic_str, attic_replace)
-					modified = True
-			if modified:
-				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
-
-		if scanner.repolevel == 1:
-			utilities.repoman_sez(
-				"\"You're rather crazy... "
-				"doing the entire repository.\"\n")
-
-		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, myremoved, mymanifests),
-				scanner.repolevel, scanner.reposplit, scanner.categories)):
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		elif broken_changelog_manifests:
-			for x in broken_changelog_manifests:
-				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-				digestgen(mysettings=repoman_settings, myportdb=portdb)
-
-		if repo_settings.sign_manifests:
-			try:
-				for x in sorted(vcs_files_to_cps(
-					chain(myupdates, myremoved, mymanifests),
-					scanner.repolevel, scanner.reposplit, scanner.categories)):
-					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
-					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
-					if not need_signature(manifest_path):
-						continue
-					gpgsign(manifest_path, repoman_settings, options)
-			except portage.exception.PortageException as e:
-				portage.writemsg("!!! %s\n" % str(e))
-				portage.writemsg("!!! Disabled FEATURES='sign'\n")
-				repo_settings.sign_manifests = False
-
-		if vcs_settings.vcs == 'git':
-			# It's not safe to use the git commit -a option since there might
-			# be some modified files elsewhere in the working tree that the
-			# user doesn't want to commit. Therefore, call git update-index
-			# in order to ensure that the index is updated with the latest
-			# versions of all new and modified files in the relevant portion
-			# of the working tree.
-			myfiles = mymanifests + myupdates
-			myfiles.sort()
-			update_index_cmd = ["git", "update-index"]
-			update_index_cmd.extend(f.lstrip("./") for f in myfiles)
-			if options.pretend:
-				print("(%s)" % (" ".join(update_index_cmd),))
-			else:
-				retval = spawn(update_index_cmd, env=os.environ)
-				if retval != os.EX_OK:
-					writemsg_level(
-						"!!! Exiting on %s (shell) "
-						"error code: %s\n" % (vcs_settings.vcs, retval),
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(retval)
-
-		if True:
-			myfiles = mymanifests[:]
-			# If there are no header (SVN/CVS keywords) changes in
-			# the files, this Manifest commit must include the
-			# other (yet uncommitted) files.
-			if not myheaders:
-				myfiles += myupdates
-				myfiles += myremoved
-			myfiles.sort()
-
-			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
-			mymsg = os.fdopen(fd, "wb")
-			mymsg.write(_unicode_encode(commitmessage))
-			mymsg.close()
-
-			commit_cmd = []
-			if options.pretend and vcs_settings.vcs is None:
-				# substitute a bogus value for pretend output
-				commit_cmd.append("cvs")
-			else:
-				commit_cmd.append(vcs_settings.vcs)
-			commit_cmd.extend(vcs_settings.vcs_global_opts)
-			commit_cmd.append("commit")
-			commit_cmd.extend(vcs_settings.vcs_local_opts)
-			if vcs_settings.vcs == "hg":
-				commit_cmd.extend(["--logfile", commitmessagefile])
-				commit_cmd.extend(myfiles)
-			else:
-				commit_cmd.extend(["-F", commitmessagefile])
-				commit_cmd.extend(f.lstrip("./") for f in myfiles)
-
-			try:
-				if options.pretend:
-					print("(%s)" % (" ".join(commit_cmd),))
-				else:
-					retval = spawn(commit_cmd, env=repo_settings.commit_env)
-					if retval != os.EX_OK:
-						if repo_settings.repo_config.sign_commit and vcs_settings.vcs == 'git' and \
-							not git_supports_gpg_sign():
-							# Inform user that newer git is needed (bug #403323).
-							logging.error(
-								"Git >=1.7.9 is required for signed commits!")
-
-						writemsg_level(
-							"!!! Exiting on %s (shell) "
-							"error code: %s\n" % (vcs_settings.vcs, retval),
-							level=logging.ERROR, noiselevel=-1)
-						sys.exit(retval)
-			finally:
-				try:
-					os.unlink(commitmessagefile)
-				except OSError:
-					pass
-
-		print()
-		if vcs_settings.vcs:
-			print("Commit complete.")
-		else:
-			print(
-				"repoman was too scared"
-				" by not seeing any familiar version control file"
-				" that he forgot to commit anything")
-		utilities.repoman_sez(
-			"\"If everyone were like you, I'd be out of business!\"\n")
+	# output the results
+	actions = Actions(repo_settings, options, scanner, vcs_settings)
+	actions.inform(can_force, result)
+	# perform any other actions
+	actions.perform(qa_output)
+
 	sys.exit(0)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17 18:58 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17 18:58 UTC (permalink / raw
  To: gentoo-commits

commit:     1ebdd23d99326330e3b3bda4245b578b5bbf2874
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 18:31:52 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 18:31:52 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ebdd23d

repoman/scanner.py: Clean out code separation demarcation lines

These lines were originally used to mark places where code was removed.
And replaced with a class instance and/or function call.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/scanner.py | 61 ++++++--------------------------------------------
 1 file changed, 7 insertions(+), 54 deletions(-)

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 781461f..240c949 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -91,13 +91,10 @@ class Scanner(object):
 		self.reposplit = myreporoot.split(os.path.sep)
 		self.repolevel = len(self.reposplit)
 
-		###################
 		if self.options.mode == 'commit':
 			repochecks.commit_check(self.repolevel, self.reposplit)
 			repochecks.conflict_check(self.vcs_settings, self.options)
 
-		###################
-
 		# Make startdir relative to the canonical repodir, so that we can pass
 		# it to digestgen and it won't have to be canonicalized again.
 		if self.repolevel == 1:
@@ -106,8 +103,6 @@ class Scanner(object):
 			startdir = normalize_path(mydir)
 			startdir = os.path.join(
 				self.repo_settings.repodir, *startdir.split(os.sep)[-2 - self.repolevel + 3:])
-		###################
-
 
 		# get lists of valid keywords, licenses, and use
 		new_data = repo_metadata(self.portdb, self.repo_settings.repoman_settings)
@@ -125,20 +120,12 @@ class Scanner(object):
 		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
 		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
 
-		####################
-
 		self.profiles = setup_profile(profile_list)
 
-		####################
-
 		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
 
-		####################
-
 		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
 
-		####################
-
 		self.dev_keywords = dev_profile_keywords(self.profiles)
 
 		self.qatracker = QATracker()
@@ -170,13 +157,9 @@ class Scanner(object):
 		else:
 			print(green("\nRepoMan scours the neighborhood..."))
 
-		#####################
-
 		self.changed = Changes(self.options)
 		self.changed.scan(self.vcs_settings)
 
-		######################
-
 		self.have = {
 			'pmasked': False,
 			'dev_keywords': False,
@@ -197,7 +180,6 @@ class Scanner(object):
 
 		# Disable the "ebuild.notadded" check when not in commit mode and
 		# running `svn status` in every package dir will be too expensive.
-
 		self.check['ebuild_notadded'] = not \
 			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
 
@@ -209,7 +191,6 @@ class Scanner(object):
 
 		self.live_eclasses = portage.const.LIVE_ECLASSES
 
-		######################
 		# initialize our checks classes here before the big xpkg loop
 		self.manifester = Manifests(self.options, self.qatracker, self.repo_settings.repoman_settings)
 		self.is_ebuild = IsEbuild(self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.qatracker)
@@ -228,8 +209,6 @@ class Scanner(object):
 		self.descriptioncheck = DescriptionChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
-		######################
-
 
 
 	def scan(self):
@@ -248,19 +227,15 @@ class Scanner(object):
 				checkdir_relative = os.path.join(catdir, checkdir_relative)
 			checkdir_relative = os.path.join(".", checkdir_relative)
 
-		#####################
 			if self.manifester.run(checkdir, self.portdb):
 				continue
 			if not self.manifester.generated_manifest:
 				self.manifester.digest_check(xpkg, checkdir)
-		######################
-
 			if self.options.mode == 'manifest-check':
 				continue
 
 			checkdirlist = os.listdir(checkdir)
 
-		######################
 			pkgs, allvalid = self.is_ebuild.check(checkdirlist, checkdir, xpkg)
 			if self.is_ebuild.continue_:
 				# If we can't access all the metadata then it's totally unsafe to
@@ -270,31 +245,27 @@ class Scanner(object):
 				# positives confuse users.
 				self.can_force = False
 				continue
-		######################
 
 			self.keywordcheck.prepare()
 
 			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
 			ebuildlist = sorted(pkgs.values())
 			ebuildlist = [pkg.pf for pkg in ebuildlist]
-		#######################
+
 			self.filescheck.check(
 				checkdir, checkdirlist, checkdir_relative, self.changed.changed, self.changed.new)
-		#######################
+
 			self.status_check.check(self.check['ebuild_notadded'], checkdir, checkdir_relative, xpkg)
 			eadded.extend(self.status_check.eadded)
 
-		#################
 			self.fetchcheck.check(
 				xpkg, checkdir, checkdir_relative, self.changed.changed, self.changed.new)
-		#################
 
 			if self.check['changelog'] and "ChangeLog" not in checkdirlist:
 				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
-		#################
+
 			self.pkgmeta.check(xpkg, checkdir, checkdirlist, self.repolevel)
 			muselist = frozenset(self.pkgmeta.musedict)
-		#################
 
 			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
 			changelog_modified = changelog_path in self.changed.changelogs
@@ -303,11 +274,10 @@ class Scanner(object):
 			used_useflags = set()
 
 			for y_ebuild in ebuildlist:
-				##################
+
 				ebuild = Ebuild(
 					self.repo_settings, self.repolevel, pkgdir, catdir, self.vcs_settings,
 					xpkg, y_ebuild)
-				##################
 
 				if self.check['changelog'] and not changelog_modified \
 					and ebuild.ebuild_path in self.changed.new_ebuilds:
@@ -318,10 +288,9 @@ class Scanner(object):
 					self.qatracker.add_error(
 						"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
 
-		##################
 				if bad_split_check(xpkg, y_ebuild, pkgdir, self.qatracker):
 					continue
-		###################
+
 				pkg = pkgs[y_ebuild]
 				if pkg_invalid(pkg, self.qatracker, ebuild):
 					allvalid = False
@@ -332,9 +301,7 @@ class Scanner(object):
 				inherited = pkg.inherited
 				live_ebuild = self.live_eclasses.intersection(inherited)
 
-				#######################
 				self.eapicheck.check(pkg, ebuild)
-				#######################
 
 				for k, v in myaux.items():
 					if not isinstance(v, basestring):
@@ -348,9 +315,8 @@ class Scanner(object):
 							(ebuild.relative_path, k, m.start() + 1))
 
 				if not self.fetchcheck.src_uri_error:
-					#######################
 					self.thirdparty.check(myaux, ebuild.relative_path)
-					#######################
+
 				if myaux.get("PROVIDE"):
 					self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
 
@@ -370,26 +336,20 @@ class Scanner(object):
 							myqakey = var + ".virtual"
 							self.qatracker.add_error(myqakey, ebuild.relative_path)
 
-				#######################
 				self.descriptioncheck.check(pkg, ebuild)
-				#######################
 
 				keywords = myaux["KEYWORDS"].split()
 
 				ebuild_archs = set(
 					kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
 
-				#######################
 				self.keywordcheck.check(
 					pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, self.changed,
 					live_ebuild, self.repo_metadata['kwlist'], self.profiles)
-				#######################
 
 				if live_ebuild and self.repo_settings.repo_config.name == "gentoo":
-					#######################
 					self.liveeclasscheck.check(
 						pkg, xpkg, ebuild, y_ebuild, keywords, self.repo_metadata['pmaskdict'])
-					#######################
 
 				if self.options.ignore_arches:
 					arches = [[
@@ -540,27 +500,20 @@ class Scanner(object):
 				badlicsyntax = badlicsyntax > 0
 				badprovsyntax = badprovsyntax > 0
 
-				#################
 				self.use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 				ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
 				used_useflags = used_useflags.union(ebuild_used_useflags)
-				#################
+
 				self.rubyeclasscheck.check(pkg, ebuild)
-				#################
 
 				# license checks
 				if not badlicsyntax:
-					#################
 					self.licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
-					#################
 
-				#################
 				self.restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
-				#################
 
 				# Syntax Checks
-
 				if not self.vcs_settings.vcs_preserves_mtime:
 					if ebuild.ebuild_path not in self.changed.new_ebuilds and \
 						ebuild.ebuild_path not in self.changed.ebuilds:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17 18:58 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17 18:58 UTC (permalink / raw
  To: gentoo-commits

commit:     208df494effc8710c60e1d9d8bc2b81980eb1a99
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 18:54:06 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 18:54:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=208df494

repoman/main.py: Clean out demarcation lines

Remove the lines added during the initial code splitting to mark the places
where code chunks were removed.
Clean out some extra line spacing.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8ad3a1f..740ca63 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -62,10 +62,8 @@ if sys.hexversion >= 0x3000000:
 
 util.initialize_logger()
 
-
 bad = create_color_func("BAD")
 
-
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
@@ -102,22 +100,14 @@ def repoman_main(argv):
 
 	myreporoot = os.path.basename(portdir_overlay)
 	myreporoot += mydir[len(portdir_overlay):]
-	##################
 
 	vcs_settings = VCSSettings(options, repoman_settings)
 
-
-	##################
-
 	repo_settings = RepoSettings(
 		config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
-
 	repoman_settings = repo_settings.repoman_settings
-
 	portdb = repo_settings.portdb
-	##################
-
 
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
@@ -131,14 +121,12 @@ def repoman_main(argv):
 	env = os.environ.copy()
 	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
 
-######################
-# cut out the main checks loop here
-
+	# Perform the main checks
 	scanner = Scanner(repo_settings, myreporoot, config_root, options,
 					vcs_settings, mydir, can_force, env)
 	qatracker = scanner.scan()
+	# reset can_force from scanner in case there was a change
 	can_force = scanner.can_force
-######################
 
 	commitmessage = None
 
@@ -152,6 +140,7 @@ def repoman_main(argv):
 	# dofull will be true if we should print a "repoman full" informational message
 	dofull = options.mode != 'full'
 
+	# early out for manifest generation
 	if options.mode == "manifest":
 		sys.exit(dofail)
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17 15:32 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     fce1b9020291161a168f270d0e3343ece8b123ea
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 15:29:11 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 15:29:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fce1b902

repoman: Move the primary checks loop to it's own class and file

Only minimal changes were done for this initial move.
The scan() needs major hacking up into manageable chunks.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 754 ++----------------------------------------------
 pym/repoman/scanner.py | 759 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 789 insertions(+), 724 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 27cb425..8ad3a1f 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -4,7 +4,6 @@
 
 from __future__ import print_function, unicode_literals
 
-import copy
 import errno
 import io
 import logging
@@ -15,7 +14,6 @@ import sys
 import tempfile
 import platform
 from itertools import chain
-from pprint import pformat
 
 from os import path as osp
 if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
@@ -30,14 +28,12 @@ portage._disable_legacy_globals()
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
-from _emerge.Package import Package
 from _emerge.UserQuery import UserQuery
 import portage.checksum
 import portage.const
 import portage.repository.config
-from portage import cvstree, normalize_path
+from portage import cvstree
 from portage import util
-from portage.dep import Atom
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -47,40 +43,18 @@ from portage.util import writemsg_level
 from portage.package.ebuild.digestgen import digestgen
 
 from repoman.argparser import parse_args
-from repoman.checks.directories.files import FileChecks
-from repoman.checks.ebuilds.checks import run_checks, checks_init
-from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.checks.ebuilds.fetches import FetchChecks
-from repoman.checks.ebuilds.keywords import KeywordChecks
-from repoman.checks.ebuilds.isebuild import IsEbuild
-from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
-from repoman.checks.ebuilds.manifests import Manifests
-from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
-from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
-from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
-from repoman.checks.ebuilds.variables.eapi import EAPIChecks
-from repoman.checks.ebuilds.variables.license import LicenseChecks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
-from repoman.ebuild import Ebuild
+from repoman.checks.ebuilds.checks import checks_init
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
-from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
-	qawarnings, qacats, missingvars,
-	suspect_virtual, suspect_rdepend)
-from repoman.qa_tracker import QATracker
-from repoman.repos import RepoSettings, repo_metadata
-from repoman.scan import Changes, scan
+	qawarnings, qacats)
+from repoman.repos import RepoSettings
+from repoman.scanner import Scanner
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (
 	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
-from repoman.vcs.vcsstatus import VCSStatus
 
 
 if sys.hexversion >= 0x3000000:
@@ -91,21 +65,12 @@ util.initialize_logger()
 
 bad = create_color_func("BAD")
 
-live_eclasses = portage.const.LIVE_ECLASSES
-non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
 
-def sort_key(item):
-	return item[2].sub_path
-
 
 def repoman_main(argv):
-	# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
-	# behave incrementally.
-	repoman_incrementals = tuple(
-		x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
 	config_root = os.environ.get("PORTAGE_CONFIGROOT")
 	repoman_settings = portage.config(config_root=config_root, local_config=False)
 
@@ -154,25 +119,6 @@ def repoman_main(argv):
 	##################
 
 
-	if options.echangelog is None and repo_settings.repo_config.update_changelog:
-		options.echangelog = 'y'
-
-	if vcs_settings.vcs is None:
-		options.echangelog = 'n'
-
-	# The --echangelog option causes automatic ChangeLog generation,
-	# which invalidates changelog.ebuildadded and changelog.missing
-	# checks.
-	# Note: Some don't use ChangeLogs in distributed SCMs.
-	# It will be generated on server side from scm log,
-	# before package moves to the rsync server.
-	# This is needed because they try to avoid merge collisions.
-	# Gentoo's Council decided to always use the ChangeLog file.
-	# TODO: shouldn't this just be switched on the repo, iso the VCS?
-	is_echangelog_enabled = options.echangelog in ('y', 'force')
-	vcs_settings.vcs_is_cvs_or_svn = vcs_settings.vcs in ('cvs', 'svn')
-	check_changelog = not is_echangelog_enabled and vcs_settings.vcs_is_cvs_or_svn
-
 	if 'digest' in repoman_settings.features and options.digest != 'n':
 		options.digest = 'y'
 
@@ -185,663 +131,20 @@ def repoman_main(argv):
 	env = os.environ.copy()
 	env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
 
-	categories = []
-	for path in repo_settings.repo_config.eclass_db.porttrees:
-		categories.extend(portage.util.grabfile(
-			os.path.join(path, 'profiles', 'categories')))
-	repoman_settings.categories = frozenset(
-		portage.util.stack_lists([categories], incremental=1))
-	categories = repoman_settings.categories
-
-	portdb.settings = repoman_settings
-	# We really only need to cache the metadata that's necessary for visibility
-	# filtering. Anything else can be discarded to reduce memory consumption.
-	portdb._aux_cache_keys.clear()
-	portdb._aux_cache_keys.update(
-		["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
-
-	reposplit = myreporoot.split(os.path.sep)
-	repolevel = len(reposplit)
-
-	###################
-	commitmessage = None
-	if options.mode == 'commit':
-		repochecks.commit_check(repolevel, reposplit)
-		repochecks.conflict_check(vcs_settings, options)
-
-	###################
-
-	# Make startdir relative to the canonical repodir, so that we can pass
-	# it to digestgen and it won't have to be canonicalized again.
-	if repolevel == 1:
-		startdir = repo_settings.repodir
-	else:
-		startdir = normalize_path(mydir)
-		startdir = os.path.join(
-			repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-	###################
-
-
-	# get lists of valid keywords, licenses, and use
-	new_data = repo_metadata(repo_settings.portdb, repoman_settings)
-	kwlist, liclist, uselist, profile_list, \
-		global_pmaskdict, liclist_deprecated = new_data
-
-	repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
-	repoman_settings.backup_changes('PORTAGE_ARCHLIST')
-
-	####################
-
-	profiles = setup_profile(profile_list)
-
-	####################
-
-	check_profiles(profiles, repoman_settings.archlist())
-
-	####################
-
-	scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
-
-	####################
-
-	dev_keywords = dev_profile_keywords(profiles)
-
-	qatracker = QATracker()
-
-
-	if options.mode == "manifest":
-		pass
-	elif options.pretend:
-		print(green("\nRepoMan does a once-over of the neighborhood..."))
-	else:
-		print(green("\nRepoMan scours the neighborhood..."))
-
-	#####################
-
-	changed = Changes(options)
-	changed.scan(vcs_settings)
-
-	######################
-
-	have_pmasked = False
-	have_dev_keywords = False
-	dofail = 0
-
-	# NOTE: match-all caches are not shared due to potential
-	# differences between profiles in _get_implicit_iuse.
-	arch_caches = {}
-	arch_xmatch_caches = {}
-	shared_xmatch_caches = {"cp-list": {}}
-
-	include_arches = None
-	if options.include_arches:
-		include_arches = set()
-		include_arches.update(*[x.split() for x in options.include_arches])
-
-	# Disable the "ebuild.notadded" check when not in commit mode and
-	# running `svn status` in every package dir will be too expensive.
-
-	check_ebuild_notadded = not \
-		(vcs_settings.vcs == "svn" and repolevel < 3 and options.mode != "commit")
-
-	effective_scanlist = scanlist
-	if options.if_modified == "y":
-		effective_scanlist = sorted(vcs_files_to_cps(
-			chain(changed.changed, changed.new, changed.removed),
-			repolevel, reposplit, categories))
-
-	######################
-	# initialize our checks classes here before the big xpkg loop
-	manifester = Manifests(options, qatracker, repoman_settings)
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
-	filescheck = FileChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	status_check = VCSStatus(vcs_settings, qatracker)
-	fetchcheck = FetchChecks(
-		qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
-	pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
-	thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
-	use_flag_checks = USEFlagChecks(qatracker, uselist)
-	keywordcheck = KeywordChecks(qatracker, options)
-	liveeclasscheck = LiveEclassChecks(qatracker)
-	rubyeclasscheck = RubyEclassChecks(qatracker)
-	eapicheck = EAPIChecks(qatracker, repo_settings)
-	descriptioncheck = DescriptionChecks(qatracker)
-	licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated)
-	restrictcheck = RestrictChecks(qatracker)
-	######################
-
-	for xpkg in effective_scanlist:
-		# ebuilds and digests added to cvs respectively.
-		logging.info("checking package %s" % xpkg)
-		# save memory by discarding xmatch caches from previous package(s)
-		arch_xmatch_caches.clear()
-		eadded = []
-		catdir, pkgdir = xpkg.split("/")
-		checkdir = repo_settings.repodir + "/" + xpkg
-		checkdir_relative = ""
-		if repolevel < 3:
-			checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-		if repolevel < 2:
-			checkdir_relative = os.path.join(catdir, checkdir_relative)
-		checkdir_relative = os.path.join(".", checkdir_relative)
-
-	#####################
-		if manifester.run(checkdir, portdb):
-			continue
-		if not manifester.generated_manifest:
-			manifester.digest_check(xpkg, checkdir)
-	######################
-
-		if options.mode == 'manifest-check':
-			continue
-
-		checkdirlist = os.listdir(checkdir)
-
-	######################
-		pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
-		if is_ebuild.continue_:
-			# If we can't access all the metadata then it's totally unsafe to
-			# commit since there's no way to generate a correct Manifest.
-			# Do not try to do any more QA checks on this package since missing
-			# metadata leads to false positives for several checks, and false
-			# positives confuse users.
-			can_force = False
-			continue
-	######################
-
-		keywordcheck.prepare()
-
-		# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
-		ebuildlist = sorted(pkgs.values())
-		ebuildlist = [pkg.pf for pkg in ebuildlist]
-	#######################
-		filescheck.check(
-			checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new)
-	#######################
-		status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
-		eadded.extend(status_check.eadded)
-
-	#################
-		fetchcheck.check(
-			xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
-	#################
-
-		if check_changelog and "ChangeLog" not in checkdirlist:
-			qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
-	#################
-		pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
-		muselist = frozenset(pkgmeta.musedict)
-	#################
-
-		changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-		changelog_modified = changelog_path in changed.changelogs
-
-		# detect unused local USE-descriptions
-		used_useflags = set()
-
-		for y_ebuild in ebuildlist:
-			##################
-			ebuild = Ebuild(
-				repo_settings, repolevel, pkgdir, catdir, vcs_settings,
-				xpkg, y_ebuild)
-			##################
-
-			if check_changelog and not changelog_modified \
-				and ebuild.ebuild_path in changed.new_ebuilds:
-				qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
-
-			if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded):
-				# ebuild not added to vcs
-				qatracker.add_error(
-					"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
+######################
+# cut out the main checks loop here
 
-	##################
-			if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker):
-				continue
-	###################
-			pkg = pkgs[y_ebuild]
-			if pkg_invalid(pkg, qatracker, ebuild):
-				allvalid = False
-				continue
-
-			myaux = pkg._metadata
-			eapi = myaux["EAPI"]
-			inherited = pkg.inherited
-			live_ebuild = live_eclasses.intersection(inherited)
-
-			#######################
-			eapicheck.check(pkg, ebuild)
-			#######################
-
-			for k, v in myaux.items():
-				if not isinstance(v, basestring):
-					continue
-				m = non_ascii_re.search(v)
-				if m is not None:
-					qatracker.add_error(
-						"variable.invalidchar",
-						"%s: %s variable contains non-ASCII "
-						"character at position %s" %
-						(ebuild.relative_path, k, m.start() + 1))
-
-			if not fetchcheck.src_uri_error:
-				#######################
-				thirdparty.check(myaux, ebuild.relative_path)
-				#######################
-			if myaux.get("PROVIDE"):
-				qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
-
-			for pos, missing_var in enumerate(missingvars):
-				if not myaux.get(missing_var):
-					if catdir == "virtual" and \
-						missing_var in ("HOMEPAGE", "LICENSE"):
-						continue
-					if live_ebuild and missing_var == "KEYWORDS":
-						continue
-					myqakey = missingvars[pos] + ".missing"
-					qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
-			if catdir == "virtual":
-				for var in ("HOMEPAGE", "LICENSE"):
-					if myaux.get(var):
-						myqakey = var + ".virtual"
-						qatracker.add_error(myqakey, ebuild.relative_path)
-
-			#######################
-			descriptioncheck.check(pkg, ebuild)
-			#######################
-
-			keywords = myaux["KEYWORDS"].split()
-
-			ebuild_archs = set(
-				kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
-
-			#######################
-			keywordcheck.check(
-				pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed,
-				live_ebuild, kwlist, profiles)
-			#######################
-
-			if live_ebuild and repo_settings.repo_config.name == "gentoo":
-				#######################
-				liveeclasscheck.check(
-					pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict)
-				#######################
-
-			if options.ignore_arches:
-				arches = [[
-					repoman_settings["ARCH"], repoman_settings["ARCH"],
-					repoman_settings["ACCEPT_KEYWORDS"].split()]]
-			else:
-				arches = set()
-				for keyword in keywords:
-					if keyword[0] == "-":
-						continue
-					elif keyword[0] == "~":
-						arch = keyword[1:]
-						if arch == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (
-										expanded_arch, "~" + expanded_arch)))
-						else:
-							arches.add((keyword, arch, (arch, keyword)))
-					else:
-						if keyword == "*":
-							for expanded_arch in profiles:
-								if expanded_arch == "**":
-									continue
-								arches.add(
-									(keyword, expanded_arch, (expanded_arch,)))
-						else:
-							arches.add((keyword, keyword, (keyword,)))
-				if not arches:
-					# Use an empty profile for checking dependencies of
-					# packages that have empty KEYWORDS.
-					arches.add(('**', '**', ('**',)))
-
-			unknown_pkgs = set()
-			baddepsyntax = False
-			badlicsyntax = False
-			badprovsyntax = False
-			# catpkg = catdir + "/" + y_ebuild
-
-			inherited_java_eclass = "java-pkg-2" in inherited or \
-				"java-pkg-opt-2" in inherited
-			inherited_wxwidgets_eclass = "wxwidgets" in inherited
-			# operator_tokens = set(["||", "(", ")"])
-			type_list, badsyntax = [], []
-			for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
-				mydepstr = myaux[mytype]
-
-				buildtime = mytype in Package._buildtime_keys
-				runtime = mytype in Package._runtime_keys
-				token_class = None
-				if mytype.endswith("DEPEND"):
-					token_class = portage.dep.Atom
+	scanner = Scanner(repo_settings, myreporoot, config_root, options,
+					vcs_settings, mydir, can_force, env)
+	qatracker = scanner.scan()
+	can_force = scanner.can_force
+######################
 
-				try:
-					atoms = portage.dep.use_reduce(
-						mydepstr, matchall=1, flat=True,
-						is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
-				except portage.exception.InvalidDependString as e:
-					atoms = None
-					badsyntax.append(str(e))
-
-				if atoms and mytype.endswith("DEPEND"):
-					if runtime and \
-						"test?" in mydepstr.split():
-						qatracker.add_error(
-							mytype + '.suspect',
-							"%s: 'test?' USE conditional in %s" %
-							(ebuild.relative_path, mytype))
-
-					for atom in atoms:
-						if atom == "||":
-							continue
-
-						is_blocker = atom.blocker
-
-						# Skip dependency.unknown for blockers, so that we
-						# don't encourage people to remove necessary blockers,
-						# as discussed in bug 382407. We use atom.without_use
-						# due to bug 525376.
-						if not is_blocker and \
-							not portdb.xmatch("match-all", atom.without_use) and \
-							not atom.cp.startswith("virtual/"):
-							unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
-						if catdir != "virtual":
-							if not is_blocker and \
-								atom.cp in suspect_virtual:
-								qatracker.add_error(
-									'virtual.suspect', ebuild.relative_path +
-									": %s: consider using '%s' instead of '%s'" %
-									(mytype, suspect_virtual[atom.cp], atom))
-							if not is_blocker and \
-								atom.cp.startswith("perl-core/"):
-								qatracker.add_error('dependency.perlcore',
-									ebuild.relative_path +
-									": %s: please use '%s' instead of '%s'" %
-									(mytype,
-									atom.replace("perl-core/","virtual/perl-"),
-									atom))
-
-						if buildtime and \
-							not is_blocker and \
-							not inherited_java_eclass and \
-							atom.cp == "virtual/jdk":
-							qatracker.add_error(
-								'java.eclassesnotused', ebuild.relative_path)
-						elif buildtime and \
-							not is_blocker and \
-							not inherited_wxwidgets_eclass and \
-							atom.cp == "x11-libs/wxGTK":
-							qatracker.add_error(
-								'wxwidgets.eclassnotused',
-								"%s: %ss on x11-libs/wxGTK without inheriting"
-								" wxwidgets.eclass" % (ebuild.relative_path, mytype))
-						elif runtime:
-							if not is_blocker and \
-								atom.cp in suspect_rdepend:
-								qatracker.add_error(
-									mytype + '.suspect',
-									ebuild.relative_path + ": '%s'" % atom)
-
-						if atom.operator == "~" and \
-							portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
-							qacat = 'dependency.badtilde'
-							qatracker.add_error(
-								qacat, "%s: %s uses the ~ operator"
-								" with a non-zero revision: '%s'" %
-								(ebuild.relative_path, mytype, atom))
-
-						check_missingslot(atom, mytype, eapi, portdb, qatracker,
-							ebuild.relative_path, myaux)
-
-				type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
-			for m, b in zip(type_list, badsyntax):
-				if m.endswith("DEPEND"):
-					qacat = "dependency.syntax"
-				else:
-					qacat = m + ".syntax"
-				qatracker.add_error(
-					qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
-
-			badlicsyntax = len([z for z in type_list if z == "LICENSE"])
-			badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
-			baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
-			badlicsyntax = badlicsyntax > 0
-			badprovsyntax = badprovsyntax > 0
-
-			#################
-			use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
-
-			ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
-			#################
-			rubyeclasscheck.check(pkg, ebuild)
-			#################
-
-			# license checks
-			if not badlicsyntax:
-				#################
-				licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
-				#################
-
-			#################
-			restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
-			#################
-
-			# Syntax Checks
-
-			if not vcs_settings.vcs_preserves_mtime:
-				if ebuild.ebuild_path not in changed.new_ebuilds and \
-					ebuild.ebuild_path not in changed.ebuilds:
-					pkg.mtime = None
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, pkg):
-						qatracker.add_error(
-							check_name, ebuild.relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
-
-			if options.force:
-				# The dep_check() calls are the most expensive QA test. If --force
-				# is enabled, there's no point in wasting time on these since the
-				# user is intent on forcing the commit anyway.
-				continue
-
-			relevant_profiles = []
-			for keyword, arch, groups in arches:
-				if arch not in profiles:
-					# A missing profile will create an error further down
-					# during the KEYWORDS verification.
-					continue
-
-				if include_arches is not None:
-					if arch not in include_arches:
-						continue
-
-				relevant_profiles.extend(
-					(keyword, groups, prof) for prof in profiles[arch])
-
-			relevant_profiles.sort(key=sort_key)
-
-			for keyword, groups, prof in relevant_profiles:
-
-				is_stable_profile = prof.status == "stable"
-				is_dev_profile = prof.status == "dev" and \
-					options.include_dev
-				is_exp_profile = prof.status == "exp" and \
-					options.include_exp_profiles == 'y'
-				if not (is_stable_profile or is_dev_profile or is_exp_profile):
-					continue
+	commitmessage = None
 
-				dep_settings = arch_caches.get(prof.sub_path)
-				if dep_settings is None:
-					dep_settings = portage.config(
-						config_profile_path=prof.abs_path,
-						config_incrementals=repoman_incrementals,
-						config_root=config_root,
-						local_config=False,
-						_unmatched_removal=options.unmatched_removal,
-						env=env, repositories=repoman_settings.repositories)
-					dep_settings.categories = repoman_settings.categories
-					if options.without_mask:
-						dep_settings._mask_manager_obj = \
-							copy.deepcopy(dep_settings._mask_manager)
-						dep_settings._mask_manager._pmaskdict.clear()
-					arch_caches[prof.sub_path] = dep_settings
-
-				xmatch_cache_key = (prof.sub_path, tuple(groups))
-				xcache = arch_xmatch_caches.get(xmatch_cache_key)
-				if xcache is None:
-					portdb.melt()
-					portdb.freeze()
-					xcache = portdb.xcache
-					xcache.update(shared_xmatch_caches)
-					arch_xmatch_caches[xmatch_cache_key] = xcache
-
-				repo_settings.trees[repo_settings.root]["porttree"].settings = dep_settings
-				portdb.settings = dep_settings
-				portdb.xcache = xcache
-
-				dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
-				# just in case, prevent config.reset() from nuking these.
-				dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
-				# This attribute is used in dbapi._match_use() to apply
-				# use.stable.{mask,force} settings based on the stable
-				# status of the parent package. This is required in order
-				# for USE deps of unstable packages to be resolved correctly,
-				# since otherwise use.stable.{mask,force} settings of
-				# dependencies may conflict (see bug #456342).
-				dep_settings._parent_stable = dep_settings._isStable(pkg)
-
-				# Handle package.use*.{force,mask) calculation, for use
-				# in dep_check.
-				dep_settings.useforce = dep_settings._use_manager.getUseForce(
-					pkg, stable=dep_settings._parent_stable)
-				dep_settings.usemask = dep_settings._use_manager.getUseMask(
-					pkg, stable=dep_settings._parent_stable)
-
-				if not baddepsyntax:
-					ismasked = not ebuild_archs or \
-						pkg.cpv not in portdb.xmatch("match-visible",
-						Atom("%s::%s" % (pkg.cp, repo_settings.repo_config.name)))
-					if ismasked:
-						if not have_pmasked:
-							have_pmasked = bool(dep_settings._getMaskAtom(
-								pkg.cpv, pkg._metadata))
-						if options.ignore_masked:
-							continue
-						# we are testing deps for a masked package; give it some lee-way
-						suffix = "masked"
-						matchmode = "minimum-all"
-					else:
-						suffix = ""
-						matchmode = "minimum-visible"
-
-					if not have_dev_keywords:
-						have_dev_keywords = \
-							bool(dev_keywords.intersection(keywords))
-
-					if prof.status == "dev":
-						suffix = suffix + "indev"
-
-					for mytype in Package._dep_keys:
-
-						mykey = "dependency.bad" + suffix
-						myvalue = myaux[mytype]
-						if not myvalue:
-							continue
-
-						success, atoms = portage.dep_check(
-							myvalue, portdb, dep_settings,
-							use="all", mode=matchmode, trees=repo_settings.trees)
-
-						if success:
-							if atoms:
-
-								# Don't bother with dependency.unknown for
-								# cases in which *DEPEND.bad is triggered.
-								for atom in atoms:
-									# dep_check returns all blockers and they
-									# aren't counted for *DEPEND.bad, so we
-									# ignore them here.
-									if not atom.blocker:
-										unknown_pkgs.discard(
-											(mytype, atom.unevaluated_atom))
-
-								if not prof.sub_path:
-									# old-style virtuals currently aren't
-									# resolvable with empty profile, since
-									# 'virtuals' mappings are unavailable
-									# (it would be expensive to search
-									# for PROVIDE in all ebuilds)
-									atoms = [
-										atom for atom in atoms if not (
-											atom.cp.startswith('virtual/')
-											and not portdb.cp_list(atom.cp))]
-
-								# we have some unsolvable deps
-								# remove ! deps, which always show up as unsatisfiable
-								atoms = [
-									str(atom.unevaluated_atom)
-									for atom in atoms if not atom.blocker]
-
-								# if we emptied out our list, continue:
-								if not atoms:
-									continue
-								qatracker.add_error(mykey,
-									"%s: %s: %s(%s)\n%s"
-									% (ebuild.relative_path, mytype, keyword, prof,
-										pformat(atoms, indent=6)))
-						else:
-							qatracker.add_error(mykey,
-								"%s: %s: %s(%s)\n%s"
-								% (ebuild.relative_path, mytype, keyword, prof,
-									pformat(atoms, indent=6)))
-
-			if not baddepsyntax and unknown_pkgs:
-				type_map = {}
-				for mytype, atom in unknown_pkgs:
-					type_map.setdefault(mytype, set()).add(atom)
-				for mytype, atoms in type_map.items():
-					qatracker.add_error(
-						"dependency.unknown", "%s: %s: %s"
-						% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
-
-		# check if there are unused local USE-descriptions in metadata.xml
-		# (unless there are any invalids, to avoid noise)
-		if allvalid:
-			for myflag in muselist.difference(used_useflags):
-				qatracker.add_error(
-					"metadata.warning",
-					"%s/metadata.xml: unused local USE-description: '%s'"
-					% (xpkg, myflag))
-
-
-	if options.if_modified == "y" and len(effective_scanlist) < 1:
+	if options.if_modified == "y" and len(scanner.effective_scanlist) < 1:
 		logging.warning("--if-modified is enabled, but no modified packages were found!")
 
-	if options.mode == "manifest":
-		sys.exit(dofail)
-
 	# dofail will be true if we have failed in at least one non-warning category
 	dofail = 0
 	# dowarn will be true if we tripped any warnings
@@ -849,6 +152,9 @@ def repoman_main(argv):
 	# dofull will be true if we should print a "repoman full" informational message
 	dofull = options.mode != 'full'
 
+	if options.mode == "manifest":
+		sys.exit(dofail)
+
 	for x in qacats:
 		if x not in qatracker.fails:
 			continue
@@ -891,9 +197,9 @@ def repoman_main(argv):
 	suggest_ignore_masked = False
 	suggest_include_dev = False
 
-	if have_pmasked and not (options.without_mask or options.ignore_masked):
+	if scanner.have['pmasked'] and not (options.without_mask or options.ignore_masked):
 		suggest_ignore_masked = True
-	if have_dev_keywords and not options.include_dev:
+	if scanner.have['dev_keywords'] and not options.include_dev:
 		suggest_include_dev = True
 
 	if suggest_ignore_masked or suggest_include_dev:
@@ -1171,8 +477,8 @@ def repoman_main(argv):
 			commitmessagefile = None
 		if not commitmessage or not commitmessage.strip():
 			msg_prefix = ""
-			if repolevel > 1:
-				msg_prefix = "/".join(reposplit[1:]) + ": "
+			if scanner.repolevel > 1:
+				msg_prefix = "/".join(scanner.reposplit[1:]) + ": "
 
 			try:
 				editor = os.environ.get("EDITOR")
@@ -1203,10 +509,10 @@ def repoman_main(argv):
 			report_options.append("--force")
 		if options.ignore_arches:
 			report_options.append("--ignore-arches")
-		if include_arches is not None:
+		if scanner.include_arches is not None:
 			report_options.append(
 				"--include-arches=\"%s\"" %
-				" ".join(sorted(include_arches)))
+				" ".join(sorted(scanner.include_arches)))
 
 		if vcs_settings.vcs == "git":
 			# Use new footer only for git (see bug #438364).
@@ -1245,18 +551,18 @@ def repoman_main(argv):
 			committer_name = utilities.get_committer_name(env=repoman_settings)
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, mymanifests, myremoved),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				catdir, pkgdir = x.split("/")
 				checkdir = repo_settings.repodir + "/" + x
 				checkdir_relative = ""
-				if repolevel < 3:
+				if scanner.repolevel < 3:
 					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if repolevel < 2:
+				if scanner.repolevel < 2:
 					checkdir_relative = os.path.join(catdir, checkdir_relative)
 				checkdir_relative = os.path.join(".", checkdir_relative)
 
 				changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-				changelog_modified = changelog_path in changed.changelogs
+				changelog_modified = changelog_path in scanner.changed.changelogs
 				if changelog_modified and options.echangelog != 'force':
 					continue
 
@@ -1466,7 +772,7 @@ def repoman_main(argv):
 			if modified:
 				portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
-		if repolevel == 1:
+		if scanner.repolevel == 1:
 			utilities.repoman_sez(
 				"\"You're rather crazy... "
 				"doing the entire repository.\"\n")
@@ -1474,7 +780,7 @@ def repoman_main(argv):
 		if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved):
 			for x in sorted(vcs_files_to_cps(
 				chain(myupdates, myremoved, mymanifests),
-				repolevel, reposplit, categories)):
+				scanner.repolevel, scanner.reposplit, scanner.categories)):
 				repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 				digestgen(mysettings=repoman_settings, myportdb=portdb)
 
@@ -1487,7 +793,7 @@ def repoman_main(argv):
 			try:
 				for x in sorted(vcs_files_to_cps(
 					chain(myupdates, myremoved, mymanifests),
-					repolevel, reposplit, categories)):
+					scanner.repolevel, scanner.reposplit, scanner.categories)):
 					repoman_settings["O"] = os.path.join(repo_settings.repodir, x)
 					manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 					if not need_signature(manifest_path):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
new file mode 100644
index 0000000..781461f
--- /dev/null
+++ b/pym/repoman/scanner.py
@@ -0,0 +1,759 @@
+
+import copy
+import io
+import logging
+import re
+import sys
+from itertools import chain
+from pprint import pformat
+
+from _emerge.Package import Package
+
+import portage
+from portage import normalize_path
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
+from portage.dep import Atom
+from portage.output import green
+from repoman.checks.directories.files import FileChecks
+from repoman.checks.ebuilds.checks import run_checks
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
+from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
+from repoman.checks.ebuilds.fetches import FetchChecks
+from repoman.checks.ebuilds.keywords import KeywordChecks
+from repoman.checks.ebuilds.isebuild import IsEbuild
+from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
+from repoman.checks.ebuilds.manifests import Manifests
+from repoman.check_missingslot import check_missingslot
+from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
+from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
+from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.description import DescriptionChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
+from repoman.checks.ebuilds.variables.license import LicenseChecks
+from repoman.checks.ebuilds.variables.restrict import RestrictChecks
+from repoman.ebuild import Ebuild
+from repoman.modules.commit import repochecks
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
+from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
+from repoman.qa_tracker import QATracker
+from repoman.repos import repo_metadata
+from repoman.scan import Changes, scan
+from repoman.vcs.vcsstatus import VCSStatus
+from repoman.vcs.vcs import vcs_files_to_cps
+
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+def sort_key(item):
+	return item[2].sub_path
+
+
+
+class Scanner(object):
+	'''Primary scan class.  Operates all the small Q/A tests and checks'''
+
+	def __init__(self, repo_settings, myreporoot, config_root, options,
+				vcs_settings, mydir, can_force, env):
+		'''Class __init__'''
+		self.repo_settings = repo_settings
+		self.config_root = config_root
+		self.options = options
+		self.vcs_settings = vcs_settings
+		self.can_force = can_force
+		self.env = env
+
+		# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
+		# behave incrementally.
+		self.repoman_incrementals = tuple(
+			x for x in portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
+
+		self.categories = []
+		for path in self.repo_settings.repo_config.eclass_db.porttrees:
+			self.categories.extend(portage.util.grabfile(
+				os.path.join(path, 'profiles', 'categories')))
+		self.repo_settings.repoman_settings.categories = frozenset(
+			portage.util.stack_lists([self.categories], incremental=1))
+		self.categories = self.repo_settings.repoman_settings.categories
+
+		self.portdb = repo_settings.portdb
+		self.portdb.settings = self.repo_settings.repoman_settings
+		# We really only need to cache the metadata that's necessary for visibility
+		# filtering. Anything else can be discarded to reduce memory consumption.
+		self.portdb._aux_cache_keys.clear()
+		self.portdb._aux_cache_keys.update(
+			["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
+
+		self.reposplit = myreporoot.split(os.path.sep)
+		self.repolevel = len(self.reposplit)
+
+		###################
+		if self.options.mode == 'commit':
+			repochecks.commit_check(self.repolevel, self.reposplit)
+			repochecks.conflict_check(self.vcs_settings, self.options)
+
+		###################
+
+		# Make startdir relative to the canonical repodir, so that we can pass
+		# it to digestgen and it won't have to be canonicalized again.
+		if self.repolevel == 1:
+			startdir = self.repo_settings.repodir
+		else:
+			startdir = normalize_path(mydir)
+			startdir = os.path.join(
+				self.repo_settings.repodir, *startdir.split(os.sep)[-2 - self.repolevel + 3:])
+		###################
+
+
+		# get lists of valid keywords, licenses, and use
+		new_data = repo_metadata(self.portdb, self.repo_settings.repoman_settings)
+		kwlist, liclist, uselist, profile_list, \
+			global_pmaskdict, liclist_deprecated = new_data
+		self.repo_metadata = {
+			'kwlist': kwlist,
+			'liclist': liclist,
+			'uselist': uselist,
+			'profile_list': profile_list,
+			'pmaskedict': global_pmaskdict,
+			'lic_deprecated': liclist_deprecated,
+		}
+
+		self.repo_settings.repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
+		self.repo_settings.repoman_settings.backup_changes('PORTAGE_ARCHLIST')
+
+		####################
+
+		self.profiles = setup_profile(profile_list)
+
+		####################
+
+		check_profiles(self.profiles, self.repo_settings.repoman_settings.archlist())
+
+		####################
+
+		scanlist = scan(self.repolevel, self.reposplit, startdir, self.categories, self.repo_settings)
+
+		####################
+
+		self.dev_keywords = dev_profile_keywords(self.profiles)
+
+		self.qatracker = QATracker()
+
+		if self.options.echangelog is None and self.repo_settings.repo_config.update_changelog:
+			self.options.echangelog = 'y'
+
+		if self.vcs_settings.vcs is None:
+			self.options.echangelog = 'n'
+
+		self.check = {}
+		# The --echangelog option causes automatic ChangeLog generation,
+		# which invalidates changelog.ebuildadded and changelog.missing
+		# checks.
+		# Note: Some don't use ChangeLogs in distributed SCMs.
+		# It will be generated on server side from scm log,
+		# before package moves to the rsync server.
+		# This is needed because they try to avoid merge collisions.
+		# Gentoo's Council decided to always use the ChangeLog file.
+		# TODO: shouldn't this just be switched on the repo, iso the VCS?
+		is_echangelog_enabled = self.options.echangelog in ('y', 'force')
+		self.vcs_settings.vcs_is_cvs_or_svn = self.vcs_settings.vcs in ('cvs', 'svn')
+		self.check['changelog'] = not is_echangelog_enabled and self.vcs_settings.vcs_is_cvs_or_svn
+
+		if self.options.mode == "manifest":
+			pass
+		elif self.options.pretend:
+			print(green("\nRepoMan does a once-over of the neighborhood..."))
+		else:
+			print(green("\nRepoMan scours the neighborhood..."))
+
+		#####################
+
+		self.changed = Changes(self.options)
+		self.changed.scan(self.vcs_settings)
+
+		######################
+
+		self.have = {
+			'pmasked': False,
+			'dev_keywords': False,
+		}
+
+		# NOTE: match-all caches are not shared due to potential
+		# differences between profiles in _get_implicit_iuse.
+		self.caches = {
+			'arch': {},
+			'arch_xmatch': {},
+			'shared_xmatch': {"cp-list": {}},
+		}
+
+		self.include_arches = None
+		if self.options.include_arches:
+			self.include_arches = set()
+			self.include_arches.update(*[x.split() for x in self.options.include_arches])
+
+		# Disable the "ebuild.notadded" check when not in commit mode and
+		# running `svn status` in every package dir will be too expensive.
+
+		self.check['ebuild_notadded'] = not \
+			(self.vcs_settings.vcs == "svn" and self.repolevel < 3 and self.options.mode != "commit")
+
+		self.effective_scanlist = scanlist
+		if self.options.if_modified == "y":
+			self.effective_scanlist = sorted(vcs_files_to_cps(
+				chain(self.changed.changed, self.changed.new, self.changed.removed),
+				self.repolevel, self.reposplit, self.categories))
+
+		self.live_eclasses = portage.const.LIVE_ECLASSES
+
+		######################
+		# initialize our checks classes here before the big xpkg loop
+		self.manifester = Manifests(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.is_ebuild = IsEbuild(self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.qatracker)
+		self.filescheck = FileChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.status_check = VCSStatus(self.vcs_settings, self.qatracker)
+		self.fetchcheck = FetchChecks(
+			self.qatracker, self.repo_settings.repoman_settings, self.repo_settings, self.portdb, self.vcs_settings)
+		self.pkgmeta = PkgMetadata(self.options, self.qatracker, self.repo_settings.repoman_settings)
+		self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
+		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
+		self.keywordcheck = KeywordChecks(self.qatracker, self.options)
+		self.liveeclasscheck = LiveEclassChecks(self.qatracker)
+		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
+		self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
+		self.descriptioncheck = DescriptionChecks(self.qatracker)
+		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
+		self.restrictcheck = RestrictChecks(self.qatracker)
+		######################
+
+
+
+	def scan(self):
+		for xpkg in self.effective_scanlist:
+			# ebuilds and digests added to cvs respectively.
+			logging.info("checking package %s" % xpkg)
+			# save memory by discarding xmatch caches from previous package(s)
+			self.caches['arch_xmatch'].clear()
+			eadded = []
+			catdir, pkgdir = xpkg.split("/")
+			checkdir = self.repo_settings.repodir + "/" + xpkg
+			checkdir_relative = ""
+			if self.repolevel < 3:
+				checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+			if self.repolevel < 2:
+				checkdir_relative = os.path.join(catdir, checkdir_relative)
+			checkdir_relative = os.path.join(".", checkdir_relative)
+
+		#####################
+			if self.manifester.run(checkdir, self.portdb):
+				continue
+			if not self.manifester.generated_manifest:
+				self.manifester.digest_check(xpkg, checkdir)
+		######################
+
+			if self.options.mode == 'manifest-check':
+				continue
+
+			checkdirlist = os.listdir(checkdir)
+
+		######################
+			pkgs, allvalid = self.is_ebuild.check(checkdirlist, checkdir, xpkg)
+			if self.is_ebuild.continue_:
+				# If we can't access all the metadata then it's totally unsafe to
+				# commit since there's no way to generate a correct Manifest.
+				# Do not try to do any more QA checks on this package since missing
+				# metadata leads to false positives for several checks, and false
+				# positives confuse users.
+				self.can_force = False
+				continue
+		######################
+
+			self.keywordcheck.prepare()
+
+			# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+			ebuildlist = sorted(pkgs.values())
+			ebuildlist = [pkg.pf for pkg in ebuildlist]
+		#######################
+			self.filescheck.check(
+				checkdir, checkdirlist, checkdir_relative, self.changed.changed, self.changed.new)
+		#######################
+			self.status_check.check(self.check['ebuild_notadded'], checkdir, checkdir_relative, xpkg)
+			eadded.extend(self.status_check.eadded)
+
+		#################
+			self.fetchcheck.check(
+				xpkg, checkdir, checkdir_relative, self.changed.changed, self.changed.new)
+		#################
+
+			if self.check['changelog'] and "ChangeLog" not in checkdirlist:
+				self.qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
+		#################
+			self.pkgmeta.check(xpkg, checkdir, checkdirlist, self.repolevel)
+			muselist = frozenset(self.pkgmeta.musedict)
+		#################
+
+			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+			changelog_modified = changelog_path in self.changed.changelogs
+
+			# detect unused local USE-descriptions
+			used_useflags = set()
+
+			for y_ebuild in ebuildlist:
+				##################
+				ebuild = Ebuild(
+					self.repo_settings, self.repolevel, pkgdir, catdir, self.vcs_settings,
+					xpkg, y_ebuild)
+				##################
+
+				if self.check['changelog'] and not changelog_modified \
+					and ebuild.ebuild_path in self.changed.new_ebuilds:
+					self.qatracker.add_error('changelog.ebuildadded', ebuild.relative_path)
+
+				if ebuild.untracked(self.check['ebuild_notadded'], y_ebuild, eadded):
+					# ebuild not added to vcs
+					self.qatracker.add_error(
+						"ebuild.notadded", xpkg + "/" + y_ebuild + ".ebuild")
+
+		##################
+				if bad_split_check(xpkg, y_ebuild, pkgdir, self.qatracker):
+					continue
+		###################
+				pkg = pkgs[y_ebuild]
+				if pkg_invalid(pkg, self.qatracker, ebuild):
+					allvalid = False
+					continue
+
+				myaux = pkg._metadata
+				eapi = myaux["EAPI"]
+				inherited = pkg.inherited
+				live_ebuild = self.live_eclasses.intersection(inherited)
+
+				#######################
+				self.eapicheck.check(pkg, ebuild)
+				#######################
+
+				for k, v in myaux.items():
+					if not isinstance(v, basestring):
+						continue
+					m = NON_ASCII_RE.search(v)
+					if m is not None:
+						self.qatracker.add_error(
+							"variable.invalidchar",
+							"%s: %s variable contains non-ASCII "
+							"character at position %s" %
+							(ebuild.relative_path, k, m.start() + 1))
+
+				if not self.fetchcheck.src_uri_error:
+					#######################
+					self.thirdparty.check(myaux, ebuild.relative_path)
+					#######################
+				if myaux.get("PROVIDE"):
+					self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
+				for pos, missing_var in enumerate(missingvars):
+					if not myaux.get(missing_var):
+						if catdir == "virtual" and \
+							missing_var in ("HOMEPAGE", "LICENSE"):
+							continue
+						if live_ebuild and missing_var == "KEYWORDS":
+							continue
+						myqakey = missingvars[pos] + ".missing"
+						self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
+
+				if catdir == "virtual":
+					for var in ("HOMEPAGE", "LICENSE"):
+						if myaux.get(var):
+							myqakey = var + ".virtual"
+							self.qatracker.add_error(myqakey, ebuild.relative_path)
+
+				#######################
+				self.descriptioncheck.check(pkg, ebuild)
+				#######################
+
+				keywords = myaux["KEYWORDS"].split()
+
+				ebuild_archs = set(
+					kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
+
+				#######################
+				self.keywordcheck.check(
+					pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, self.changed,
+					live_ebuild, self.repo_metadata['kwlist'], self.profiles)
+				#######################
+
+				if live_ebuild and self.repo_settings.repo_config.name == "gentoo":
+					#######################
+					self.liveeclasscheck.check(
+						pkg, xpkg, ebuild, y_ebuild, keywords, self.repo_metadata['pmaskdict'])
+					#######################
+
+				if self.options.ignore_arches:
+					arches = [[
+						self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
+						self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
+				else:
+					arches = set()
+					for keyword in keywords:
+						if keyword[0] == "-":
+							continue
+						elif keyword[0] == "~":
+							arch = keyword[1:]
+							if arch == "*":
+								for expanded_arch in self.profiles:
+									if expanded_arch == "**":
+										continue
+									arches.add(
+										(keyword, expanded_arch, (
+											expanded_arch, "~" + expanded_arch)))
+							else:
+								arches.add((keyword, arch, (arch, keyword)))
+						else:
+							if keyword == "*":
+								for expanded_arch in self.profiles:
+									if expanded_arch == "**":
+										continue
+									arches.add(
+										(keyword, expanded_arch, (expanded_arch,)))
+							else:
+								arches.add((keyword, keyword, (keyword,)))
+					if not arches:
+						# Use an empty profile for checking dependencies of
+						# packages that have empty KEYWORDS.
+						arches.add(('**', '**', ('**',)))
+
+				unknown_pkgs = set()
+				baddepsyntax = False
+				badlicsyntax = False
+				badprovsyntax = False
+				# catpkg = catdir + "/" + y_ebuild
+
+				inherited_java_eclass = "java-pkg-2" in inherited or \
+					"java-pkg-opt-2" in inherited
+				inherited_wxwidgets_eclass = "wxwidgets" in inherited
+				# operator_tokens = set(["||", "(", ")"])
+				type_list, badsyntax = [], []
+				for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+					mydepstr = myaux[mytype]
+
+					buildtime = mytype in Package._buildtime_keys
+					runtime = mytype in Package._runtime_keys
+					token_class = None
+					if mytype.endswith("DEPEND"):
+						token_class = portage.dep.Atom
+
+					try:
+						atoms = portage.dep.use_reduce(
+							mydepstr, matchall=1, flat=True,
+							is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+					except portage.exception.InvalidDependString as e:
+						atoms = None
+						badsyntax.append(str(e))
+
+					if atoms and mytype.endswith("DEPEND"):
+						if runtime and \
+							"test?" in mydepstr.split():
+							self.qatracker.add_error(
+								mytype + '.suspect',
+								"%s: 'test?' USE conditional in %s" %
+								(ebuild.relative_path, mytype))
+
+						for atom in atoms:
+							if atom == "||":
+								continue
+
+							is_blocker = atom.blocker
+
+							# Skip dependency.unknown for blockers, so that we
+							# don't encourage people to remove necessary blockers,
+							# as discussed in bug 382407. We use atom.without_use
+							# due to bug 525376.
+							if not is_blocker and \
+								not self.portdb.xmatch("match-all", atom.without_use) and \
+								not atom.cp.startswith("virtual/"):
+								unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+							if catdir != "virtual":
+								if not is_blocker and \
+									atom.cp in suspect_virtual:
+									self.qatracker.add_error(
+										'virtual.suspect', ebuild.relative_path +
+										": %s: consider using '%s' instead of '%s'" %
+										(mytype, suspect_virtual[atom.cp], atom))
+								if not is_blocker and \
+									atom.cp.startswith("perl-core/"):
+									self.qatracker.add_error('dependency.perlcore',
+										ebuild.relative_path +
+										": %s: please use '%s' instead of '%s'" %
+										(mytype,
+										atom.replace("perl-core/","virtual/perl-"),
+										atom))
+
+							if buildtime and \
+								not is_blocker and \
+								not inherited_java_eclass and \
+								atom.cp == "virtual/jdk":
+								self.qatracker.add_error(
+									'java.eclassesnotused', ebuild.relative_path)
+							elif buildtime and \
+								not is_blocker and \
+								not inherited_wxwidgets_eclass and \
+								atom.cp == "x11-libs/wxGTK":
+								self.qatracker.add_error(
+									'wxwidgets.eclassnotused',
+									"%s: %ss on x11-libs/wxGTK without inheriting"
+									" wxwidgets.eclass" % (ebuild.relative_path, mytype))
+							elif runtime:
+								if not is_blocker and \
+									atom.cp in suspect_rdepend:
+									self.qatracker.add_error(
+										mytype + '.suspect',
+										ebuild.relative_path + ": '%s'" % atom)
+
+							if atom.operator == "~" and \
+								portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+								qacat = 'dependency.badtilde'
+								self.qatracker.add_error(
+									qacat, "%s: %s uses the ~ operator"
+									" with a non-zero revision: '%s'" %
+									(ebuild.relative_path, mytype, atom))
+
+							check_missingslot(atom, mytype, eapi, self.portdb, self.qatracker,
+								ebuild.relative_path, myaux)
+
+					type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+				for m, b in zip(type_list, badsyntax):
+					if m.endswith("DEPEND"):
+						qacat = "dependency.syntax"
+					else:
+						qacat = m + ".syntax"
+					self.qatracker.add_error(
+						qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+
+				badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+				badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+				baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+				badlicsyntax = badlicsyntax > 0
+				badprovsyntax = badprovsyntax > 0
+
+				#################
+				self.use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
+
+				ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
+				used_useflags = used_useflags.union(ebuild_used_useflags)
+				#################
+				self.rubyeclasscheck.check(pkg, ebuild)
+				#################
+
+				# license checks
+				if not badlicsyntax:
+					#################
+					self.licensecheck.check(pkg, xpkg, ebuild, y_ebuild)
+					#################
+
+				#################
+				self.restrictcheck.check(pkg, xpkg, ebuild, y_ebuild)
+				#################
+
+				# Syntax Checks
+
+				if not self.vcs_settings.vcs_preserves_mtime:
+					if ebuild.ebuild_path not in self.changed.new_ebuilds and \
+						ebuild.ebuild_path not in self.changed.ebuilds:
+						pkg.mtime = None
+				try:
+					# All ebuilds should have utf_8 encoding.
+					f = io.open(
+						_unicode_encode(
+							ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
+						mode='r', encoding=_encodings['repo.content'])
+					try:
+						for check_name, e in run_checks(f, pkg):
+							self.qatracker.add_error(
+								check_name, ebuild.relative_path + ': %s' % e)
+					finally:
+						f.close()
+				except UnicodeDecodeError:
+					# A file.UTF8 failure will have already been recorded above.
+					pass
+
+				if self.options.force:
+					# The dep_check() calls are the most expensive QA test. If --force
+					# is enabled, there's no point in wasting time on these since the
+					# user is intent on forcing the commit anyway.
+					continue
+
+				relevant_profiles = []
+				for keyword, arch, groups in arches:
+					if arch not in self.profiles:
+						# A missing profile will create an error further down
+						# during the KEYWORDS verification.
+						continue
+
+					if self.include_arches is not None:
+						if arch not in self.include_arches:
+							continue
+
+					relevant_profiles.extend(
+						(keyword, groups, prof) for prof in self.profiles[arch])
+
+				relevant_profiles.sort(key=sort_key)
+
+				for keyword, groups, prof in relevant_profiles:
+
+					is_stable_profile = prof.status == "stable"
+					is_dev_profile = prof.status == "dev" and \
+						self.options.include_dev
+					is_exp_profile = prof.status == "exp" and \
+						self.options.include_exp_profiles == 'y'
+					if not (is_stable_profile or is_dev_profile or is_exp_profile):
+						continue
+
+					dep_settings = self.caches['arch'].get(prof.sub_path)
+					if dep_settings is None:
+						dep_settings = portage.config(
+							config_profile_path=prof.abs_path,
+							config_incrementals=self.repoman_incrementals,
+							config_root=self.config_root,
+							local_config=False,
+							_unmatched_removal=self.options.unmatched_removal,
+							env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+						dep_settings.categories = self.repo_settings.repoman_settings.categories
+						if self.options.without_mask:
+							dep_settings._mask_manager_obj = \
+								copy.deepcopy(dep_settings._mask_manager)
+							dep_settings._mask_manager._pmaskdict.clear()
+						self.caches['arch'][prof.sub_path] = dep_settings
+
+					xmatch_cache_key = (prof.sub_path, tuple(groups))
+					xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+					if xcache is None:
+						self.portdb.melt()
+						self.portdb.freeze()
+						xcache = self.portdb.xcache
+						xcache.update(self.caches['shared_xmatch'])
+						self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+					self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+					self.portdb.settings = dep_settings
+					self.portdb.xcache = xcache
+
+					dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+					# just in case, prevent config.reset() from nuking these.
+					dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+					# This attribute is used in dbapi._match_use() to apply
+					# use.stable.{mask,force} settings based on the stable
+					# status of the parent package. This is required in order
+					# for USE deps of unstable packages to be resolved correctly,
+					# since otherwise use.stable.{mask,force} settings of
+					# dependencies may conflict (see bug #456342).
+					dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+					# Handle package.use*.{force,mask) calculation, for use
+					# in dep_check.
+					dep_settings.useforce = dep_settings._use_manager.getUseForce(
+						pkg, stable=dep_settings._parent_stable)
+					dep_settings.usemask = dep_settings._use_manager.getUseMask(
+						pkg, stable=dep_settings._parent_stable)
+
+					if not baddepsyntax:
+						ismasked = not ebuild_archs or \
+							pkg.cpv not in self.portdb.xmatch("match-visible",
+							Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+						if ismasked:
+							if not self.haves['pmasked']:
+								self.haves['pmasked'] = bool(dep_settings._getMaskAtom(
+									pkg.cpv, pkg._metadata))
+							if self.options.ignore_masked:
+								continue
+							# we are testing deps for a masked package; give it some lee-way
+							suffix = "masked"
+							matchmode = "minimum-all"
+						else:
+							suffix = ""
+							matchmode = "minimum-visible"
+
+						if not self.have['dev_keywords']:
+							self.have['dev_keywords'] = \
+								bool(self.dev_keywords.intersection(keywords))
+
+						if prof.status == "dev":
+							suffix = suffix + "indev"
+
+						for mytype in Package._dep_keys:
+
+							mykey = "dependency.bad" + suffix
+							myvalue = myaux[mytype]
+							if not myvalue:
+								continue
+
+							success, atoms = portage.dep_check(
+								myvalue, self.portdb, dep_settings,
+								use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+							if success:
+								if atoms:
+
+									# Don't bother with dependency.unknown for
+									# cases in which *DEPEND.bad is triggered.
+									for atom in atoms:
+										# dep_check returns all blockers and they
+										# aren't counted for *DEPEND.bad, so we
+										# ignore them here.
+										if not atom.blocker:
+											unknown_pkgs.discard(
+												(mytype, atom.unevaluated_atom))
+
+									if not prof.sub_path:
+										# old-style virtuals currently aren't
+										# resolvable with empty profile, since
+										# 'virtuals' mappings are unavailable
+										# (it would be expensive to search
+										# for PROVIDE in all ebuilds)
+										atoms = [
+											atom for atom in atoms if not (
+												atom.cp.startswith('virtual/')
+												and not self.portdb.cp_list(atom.cp))]
+
+									# we have some unsolvable deps
+									# remove ! deps, which always show up as unsatisfiable
+									atoms = [
+										str(atom.unevaluated_atom)
+										for atom in atoms if not atom.blocker]
+
+									# if we emptied out our list, continue:
+									if not atoms:
+										continue
+									self.qatracker.add_error(mykey,
+										"%s: %s: %s(%s)\n%s"
+										% (ebuild.relative_path, mytype, keyword, prof,
+											pformat(atoms, indent=6)))
+							else:
+								self.qatracker.add_error(mykey,
+									"%s: %s: %s(%s)\n%s"
+									% (ebuild.relative_path, mytype, keyword, prof,
+										pformat(atoms, indent=6)))
+
+				if not baddepsyntax and unknown_pkgs:
+					type_map = {}
+					for mytype, atom in unknown_pkgs:
+						type_map.setdefault(mytype, set()).add(atom)
+					for mytype, atoms in type_map.items():
+						self.qatracker.add_error(
+							"dependency.unknown", "%s: %s: %s"
+							% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+
+			# check if there are unused local USE-descriptions in metadata.xml
+			# (unless there are any invalids, to avoid noise)
+			if allvalid:
+				for myflag in muselist.difference(used_useflags):
+					self.qatracker.add_error(
+						"metadata.warning",
+						"%s/metadata.xml: unused local USE-description: '%s'"
+						% (xpkg, myflag))
+		return self.qatracker


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     4c64a93fa527bf609632ea107356965cbcf521d6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 04:06:24 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c64a93f

repoman: Change name of dev_keywords() due to variable name conflict

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py    | 4 ++--
 pym/repoman/profile.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e276aba..006afc9 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -68,7 +68,7 @@ from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
-from repoman.profile import check_profiles, dev_keywords, setup_profile
+from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.qa_data import (
 	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, missingvars,
@@ -243,7 +243,7 @@ scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
 ####################
 
-dev_keywords = dev_keywords(profiles)
+dev_keywords = dev_profile_keywords(profiles)
 
 qatracker = QATracker()
 

diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py
index 11b93c7..0aedbe8 100644
--- a/pym/repoman/profile.py
+++ b/pym/repoman/profile.py
@@ -28,7 +28,7 @@ class ProfileDesc(object):
 valid_profile_types = frozenset(['dev', 'exp', 'stable'])
 
 
-def dev_keywords(profiles):
+def dev_profile_keywords(profiles):
 	"""
 	Create a set of KEYWORDS values that exist in 'dev'
 	profiles. These are used


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     486b12e11a09953b9dda0e98643f6d6ebd6409f8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:39:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=486b12e1

repoman/repos.py: Fix a regression where the repo is not in repos.conf

The regression was introduced when a variable was used to reduce the size of
some long lines.  The variable was not being reset after the repo was added, so
the remaining code was looking at a stale config.
It turned out the variable was a dupe of an already properly updated class wide
one.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 5044411..ec12aaa 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -30,12 +30,12 @@ class RepoSettings(object):
 		self.repoman_settings = repoman_settings
 		self.vcs_settings = vcs_settings
 
-		repoman_repos = self.repoman_settings.repositories
+		self.repositories = self.repoman_settings.repositories
 
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
-			repoman_repos.get_repo_for_location(self.repodir)
+			self.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
 			self._add_repo(config_root, portdir_overlay)
 
@@ -47,15 +47,15 @@ class RepoSettings(object):
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_repos.get_repo_for_location(self.repodir)
+		self.repo_config = self.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_repos):
+		for repo in list(self.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_repos[repo.name]
+				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     8d2718f8f3a5e8d2c48419d2e9d6b7bb32857f94
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8d2718f8

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8497833..4dbc09e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     1b2e25d7d5d283962b257f9d9c645650de037cc0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1b2e25d7

repoman/main.py: Move some functions out of the main code definition

Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py | 78 +++++------------------------------------------------
 1 file changed, 7 insertions(+), 71 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 4dbc09e..e276aba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -38,7 +38,6 @@ import portage.repository.config
 from portage import cvstree, normalize_path
 from portage import util
 from portage.dep import Atom
-from portage.exception import MissingParameter
 from portage.process import find_binary, spawn
 from portage.output import (
 	bold, create_color_func, green, nocolor, red)
@@ -67,6 +66,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (
@@ -97,6 +97,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
+
+def sort_key(item):
+	return item[2].sub_path
+
+
 # Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
 # behave incrementally.
 repoman_incrementals = tuple(
@@ -673,9 +678,6 @@ for xpkg in effective_scanlist:
 			relevant_profiles.extend(
 				(keyword, groups, prof) for prof in profiles[arch])
 
-		def sort_key(item):
-			return item[2].sub_path
-
 		relevant_profiles.sort(key=sort_key)
 
 		for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1443,6 @@ else:
 			except OSError:
 				pass
 
-	# Setup the GPG commands
-	def gpgsign(filename):
-		gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
-		if gpgcmd in [None, '']:
-			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
-				" Is make.globals missing?")
-		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
-			"PORTAGE_GPG_KEY" not in repoman_settings:
-			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "${PORTAGE_GPG_DIR}" in gpgcmd:
-			if "PORTAGE_GPG_DIR" not in repoman_settings:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser("~/.gnupg")
-				logging.info(
-					"Automatically setting PORTAGE_GPG_DIR to '%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-			else:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
-			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
-				raise portage.exception.InvalidLocation(
-					"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-		gpgvars = {"FILE": filename}
-		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			v = repoman_settings.get(k)
-			if v is not None:
-				gpgvars[k] = v
-		gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
-		if options.pretend:
-			print("(" + gpgcmd + ")")
-		else:
-			# Encode unicode manually for bug #310789.
-			gpgcmd = portage.util.shlex_split(gpgcmd)
-
-			if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-				not os.path.isabs(gpgcmd[0]):
-				# Python 3.1 _execvp throws TypeError for non-absolute executable
-				# path passed as bytes (see http://bugs.python.org/issue8513).
-				fullname = find_binary(gpgcmd[0])
-				if fullname is None:
-					raise portage.exception.CommandNotFound(gpgcmd[0])
-				gpgcmd[0] = fullname
-
-			gpgcmd = [
-				_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
-				for arg in gpgcmd]
-			rValue = subprocess.call(gpgcmd)
-			if rValue == os.EX_OK:
-				os.rename(filename + ".asc", filename)
-			else:
-				raise portage.exception.PortageException(
-					"!!! gpg exited with '" + str(rValue) + "' status")
-
-	def need_signature(filename):
-		try:
-			with open(
-				_unicode_encode(
-					filename, encoding=_encodings['fs'], errors='strict'),
-				'rb') as f:
-				return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
-		except IOError as e:
-			if e.errno in (errno.ENOENT, errno.ESTALE):
-				return False
-			raise
-
 	# When files are removed and re-added, the cvs server will put /Attic/
 	# inside the $Header path. This code detects the problem and corrects it
 	# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1493,7 @@ else:
 				manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 				if not need_signature(manifest_path):
 					continue
-				gpgsign(manifest_path)
+				gpgsign(manifest_path, repoman_settings, options)
 		except portage.exception.PortageException as e:
 			portage.writemsg("!!! %s\n" % str(e))
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     3c8a533bdd91c0dc11ac5d29b5de7818202d38ad
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:43:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3c8a533b

repoamn/repos.py: Indent fix

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index ec12aaa..1a3a0d5 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -125,29 +125,29 @@ class RepoSettings(object):
 				sys.exit(1)
 
 	def _add_repo(self, config_root, portdir_overlay):
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
-				portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				self.repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			self.repoman_settings = portage.config(
-				config_root=config_root, local_config=False,
-				repositories=self.repositories)
+		self.repo_conf = portage.repository.config
+		self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
+			portdir_overlay)[0]
+		self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+		if self.layout_conf_data['repo-name']:
+			self.repo_name = self.layout_conf_data['repo-name']
+		tmp_conf_file = io.StringIO(textwrap.dedent("""
+			[%s]
+			location = %s
+			""") % (self.repo_name, portdir_overlay))
+		# Ensure that the repository corresponding to $PWD overrides a
+		# repository of the same name referenced by the existing PORTDIR
+		# or PORTDIR_OVERLAY settings.
+		self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+			self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+			portage._shell_quote(portdir_overlay))
+		self.repositories = self.repo_conf.load_repository_config(
+			self.repoman_settings, extra_files=[tmp_conf_file])
+		# We have to call the config constructor again so that attributes
+		# dependent on config.repositories are initialized correctly.
+		self.repoman_settings = portage.config(
+			config_root=config_root, local_config=False,
+			repositories=self.repositories)
 
 	##########
 	# future vcs plugin functions


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     480eb5ad7f514d3d7c12125fc93f889b98e5c283
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=480eb5ad

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 132f2f7..dcb9d32 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1199,7 +1193,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1604,8 +1599,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1722,7 +1716,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     db22f169e0e7f5f8818e2b89a1b92378d48920b9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=db22f169

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index dcb9d32..4dd9e1d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     22f297d2a5a701edf46893c7b77a52aa31c6f9a2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=22f297d2

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 4dd9e1d..8f6ef20 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     8e5e02075604a6be7fadde8b2d36b1260585801f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:26 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8e5e0207

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 6b89832..5950c53 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     83d0fb6bed7f4a66c2afd817bbc91ed10d524ba3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=83d0fb6b

repoman/main.py: Move some functions out of the main code definition

Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py | 77 +++++------------------------------------------------
 1 file changed, 7 insertions(+), 70 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 7887a79..843154c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -67,6 +67,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (
@@ -97,6 +98,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
+
+def sort_key(item):
+	return item[2].sub_path
+
+
 # Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
 # behave incrementally.
 repoman_incrementals = tuple(
@@ -673,9 +679,6 @@ for xpkg in effective_scanlist:
 			relevant_profiles.extend(
 				(keyword, groups, prof) for prof in profiles[arch])
 
-		def sort_key(item):
-			return item[2].sub_path
-
 		relevant_profiles.sort(key=sort_key)
 
 		for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1444,6 @@ else:
 			except OSError:
 				pass
 
-	# Setup the GPG commands
-	def gpgsign(filename):
-		gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
-		if gpgcmd in [None, '']:
-			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
-				" Is make.globals missing?")
-		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
-			"PORTAGE_GPG_KEY" not in repoman_settings:
-			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "${PORTAGE_GPG_DIR}" in gpgcmd:
-			if "PORTAGE_GPG_DIR" not in repoman_settings:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser("~/.gnupg")
-				logging.info(
-					"Automatically setting PORTAGE_GPG_DIR to '%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-			else:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
-			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
-				raise portage.exception.InvalidLocation(
-					"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-		gpgvars = {"FILE": filename}
-		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			v = repoman_settings.get(k)
-			if v is not None:
-				gpgvars[k] = v
-		gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
-		if options.pretend:
-			print("(" + gpgcmd + ")")
-		else:
-			# Encode unicode manually for bug #310789.
-			gpgcmd = portage.util.shlex_split(gpgcmd)
-
-			if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-				not os.path.isabs(gpgcmd[0]):
-				# Python 3.1 _execvp throws TypeError for non-absolute executable
-				# path passed as bytes (see http://bugs.python.org/issue8513).
-				fullname = find_binary(gpgcmd[0])
-				if fullname is None:
-					raise portage.exception.CommandNotFound(gpgcmd[0])
-				gpgcmd[0] = fullname
-
-			gpgcmd = [
-				_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
-				for arg in gpgcmd]
-			rValue = subprocess.call(gpgcmd)
-			if rValue == os.EX_OK:
-				os.rename(filename + ".asc", filename)
-			else:
-				raise portage.exception.PortageException(
-					"!!! gpg exited with '" + str(rValue) + "' status")
-
-	def need_signature(filename):
-		try:
-			with open(
-				_unicode_encode(
-					filename, encoding=_encodings['fs'], errors='strict'),
-				'rb') as f:
-				return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
-		except IOError as e:
-			if e.errno in (errno.ENOENT, errno.ESTALE):
-				return False
-			raise
-
 	# When files are removed and re-added, the cvs server will put /Attic/
 	# inside the $Header path. This code detects the problem and corrects it
 	# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1494,7 @@ else:
 				manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 				if not need_signature(manifest_path):
 					continue
-				gpgsign(manifest_path)
+				gpgsign(manifest_path, repoman_settings, options)
 		except portage.exception.PortageException as e:
 			portage.writemsg("!!! %s\n" % str(e))
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     89b156b8bbaf13d315c2ef277a955646b8649552
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=89b156b8

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 582370e..7887a79 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     6b4580a6db6caa4fcc190ca25515ba6dd19b1853
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:43:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6b4580a6

repoamn/repos.py: Indent fix

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index ec12aaa..1a3a0d5 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -125,29 +125,29 @@ class RepoSettings(object):
 				sys.exit(1)
 
 	def _add_repo(self, config_root, portdir_overlay):
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
-				portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				self.repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			self.repoman_settings = portage.config(
-				config_root=config_root, local_config=False,
-				repositories=self.repositories)
+		self.repo_conf = portage.repository.config
+		self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
+			portdir_overlay)[0]
+		self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+		if self.layout_conf_data['repo-name']:
+			self.repo_name = self.layout_conf_data['repo-name']
+		tmp_conf_file = io.StringIO(textwrap.dedent("""
+			[%s]
+			location = %s
+			""") % (self.repo_name, portdir_overlay))
+		# Ensure that the repository corresponding to $PWD overrides a
+		# repository of the same name referenced by the existing PORTDIR
+		# or PORTDIR_OVERLAY settings.
+		self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+			self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+			portage._shell_quote(portdir_overlay))
+		self.repositories = self.repo_conf.load_repository_config(
+			self.repoman_settings, extra_files=[tmp_conf_file])
+		# We have to call the config constructor again so that attributes
+		# dependent on config.repositories are initialized correctly.
+		self.repoman_settings = portage.config(
+			config_root=config_root, local_config=False,
+			repositories=self.repositories)
 
 	##########
 	# future vcs plugin functions


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     3d31922c5a90af42706596c272108955a8770955
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:39:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d31922c

repoman/repos.py: Fix a regression where the repo is not in repos.conf

The regression was introduced when a variable was used to reduce the size of
some long lines.  The variable was not being reset after the repo was added, so
the remaining code was looking at a stale config.
It turned out the variable was a dupe of an already properly updated class wide
one.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 5044411..ec12aaa 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -30,12 +30,12 @@ class RepoSettings(object):
 		self.repoman_settings = repoman_settings
 		self.vcs_settings = vcs_settings
 
-		repoman_repos = self.repoman_settings.repositories
+		self.repositories = self.repoman_settings.repositories
 
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
-			repoman_repos.get_repo_for_location(self.repodir)
+			self.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
 			self._add_repo(config_root, portdir_overlay)
 
@@ -47,15 +47,15 @@ class RepoSettings(object):
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_repos.get_repo_for_location(self.repodir)
+		self.repo_config = self.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_repos):
+		for repo in list(self.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_repos[repo.name]
+				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     ac4167c2d5918e43c4cb86e4ca9e80e738a74b99
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac4167c2

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 0b78001..26fa50a 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     f7a5cbf146ebda902d924ec9f6741f28c5f0d10a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f7a5cbf1

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 30487b5..58f6b8c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     c0a6fd2e16796053b9d9ba67cfeda7e4d2fdfcc8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c0a6fd2e

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 58f6b8c..e942dca 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     4689a8c49104937e1db03965fbc9cfb260b34c52
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4689a8c4

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 0387214..5aa6ad8 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     91b959bc9e763924fb60c0dec1085e8a055d6444
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=91b959bc

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index a5214d8..30487b5 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1199,7 +1193,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1604,8 +1599,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1722,7 +1716,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  2:45 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  2:45 UTC (permalink / raw
  To: gentoo-commits

commit:     aa5af88d23d5495e2541383a0a8ed9397d94d25a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 00:13:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa5af88d

repoman/main.py: Move some functions out of the main code definition

Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/main.py | 77 +++++------------------------------------------------
 1 file changed, 7 insertions(+), 70 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 7887a79..843154c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -67,6 +67,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (
@@ -97,6 +98,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
 
 # A sane umask is needed for files that portage creates.
 os.umask(0o22)
+
+def sort_key(item):
+	return item[2].sub_path
+
+
 # Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
 # behave incrementally.
 repoman_incrementals = tuple(
@@ -673,9 +679,6 @@ for xpkg in effective_scanlist:
 			relevant_profiles.extend(
 				(keyword, groups, prof) for prof in profiles[arch])
 
-		def sort_key(item):
-			return item[2].sub_path
-
 		relevant_profiles.sort(key=sort_key)
 
 		for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1444,6 @@ else:
 			except OSError:
 				pass
 
-	# Setup the GPG commands
-	def gpgsign(filename):
-		gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
-		if gpgcmd in [None, '']:
-			raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
-				" Is make.globals missing?")
-		if "${PORTAGE_GPG_KEY}" in gpgcmd and \
-			"PORTAGE_GPG_KEY" not in repoman_settings:
-			raise MissingParameter("PORTAGE_GPG_KEY is unset!")
-		if "${PORTAGE_GPG_DIR}" in gpgcmd:
-			if "PORTAGE_GPG_DIR" not in repoman_settings:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser("~/.gnupg")
-				logging.info(
-					"Automatically setting PORTAGE_GPG_DIR to '%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-			else:
-				repoman_settings["PORTAGE_GPG_DIR"] = \
-					os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
-			if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
-				raise portage.exception.InvalidLocation(
-					"Unable to access directory: PORTAGE_GPG_DIR='%s'" %
-					repoman_settings["PORTAGE_GPG_DIR"])
-		gpgvars = {"FILE": filename}
-		for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
-			v = repoman_settings.get(k)
-			if v is not None:
-				gpgvars[k] = v
-		gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
-		if options.pretend:
-			print("(" + gpgcmd + ")")
-		else:
-			# Encode unicode manually for bug #310789.
-			gpgcmd = portage.util.shlex_split(gpgcmd)
-
-			if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-				not os.path.isabs(gpgcmd[0]):
-				# Python 3.1 _execvp throws TypeError for non-absolute executable
-				# path passed as bytes (see http://bugs.python.org/issue8513).
-				fullname = find_binary(gpgcmd[0])
-				if fullname is None:
-					raise portage.exception.CommandNotFound(gpgcmd[0])
-				gpgcmd[0] = fullname
-
-			gpgcmd = [
-				_unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
-				for arg in gpgcmd]
-			rValue = subprocess.call(gpgcmd)
-			if rValue == os.EX_OK:
-				os.rename(filename + ".asc", filename)
-			else:
-				raise portage.exception.PortageException(
-					"!!! gpg exited with '" + str(rValue) + "' status")
-
-	def need_signature(filename):
-		try:
-			with open(
-				_unicode_encode(
-					filename, encoding=_encodings['fs'], errors='strict'),
-				'rb') as f:
-				return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
-		except IOError as e:
-			if e.errno in (errno.ENOENT, errno.ESTALE):
-				return False
-			raise
-
 	# When files are removed and re-added, the cvs server will put /Attic/
 	# inside the $Header path. This code detects the problem and corrects it
 	# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1494,7 @@ else:
 				manifest_path = os.path.join(repoman_settings["O"], "Manifest")
 				if not need_signature(manifest_path):
 					continue
-				gpgsign(manifest_path)
+				gpgsign(manifest_path, repoman_settings, options)
 		except portage.exception.PortageException as e:
 			portage.writemsg("!!! %s\n" % str(e))
 			portage.writemsg("!!! Disabled FEATURES='sign'\n")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  2:45 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  2:45 UTC (permalink / raw
  To: gentoo-commits

commit:     a68fd641f974fa4c900e83361a25d1963da6d3bb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:43:27 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 02:43:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a68fd641

repoamn/repos.py: Indent fix

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index ec12aaa..1a3a0d5 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -125,29 +125,29 @@ class RepoSettings(object):
 				sys.exit(1)
 
 	def _add_repo(self, config_root, portdir_overlay):
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
-				portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				self.repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			self.repoman_settings = portage.config(
-				config_root=config_root, local_config=False,
-				repositories=self.repositories)
+		self.repo_conf = portage.repository.config
+		self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(
+			portdir_overlay)[0]
+		self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+		if self.layout_conf_data['repo-name']:
+			self.repo_name = self.layout_conf_data['repo-name']
+		tmp_conf_file = io.StringIO(textwrap.dedent("""
+			[%s]
+			location = %s
+			""") % (self.repo_name, portdir_overlay))
+		# Ensure that the repository corresponding to $PWD overrides a
+		# repository of the same name referenced by the existing PORTDIR
+		# or PORTDIR_OVERLAY settings.
+		self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+			self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+			portage._shell_quote(portdir_overlay))
+		self.repositories = self.repo_conf.load_repository_config(
+			self.repoman_settings, extra_files=[tmp_conf_file])
+		# We have to call the config constructor again so that attributes
+		# dependent on config.repositories are initialized correctly.
+		self.repoman_settings = portage.config(
+			config_root=config_root, local_config=False,
+			repositories=self.repositories)
 
 	##########
 	# future vcs plugin functions


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-17  2:45 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-17  2:45 UTC (permalink / raw
  To: gentoo-commits

commit:     ff0c584e56430fa6e77833f27deb443a1b39647c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 02:39:34 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 02:39:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff0c584e

repoman/repos.py: Fix a regression where the repo is not in repos.conf

The regression was introduced when a variable was used to reduce the size of
some long lines.  The variable was not being reset after the repo was added, so
the remaining code was looking at a stale config.
It turned out the variable was a dupe of an already properly updated class wide
one.

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/repoman/repos.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 5044411..ec12aaa 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -30,12 +30,12 @@ class RepoSettings(object):
 		self.repoman_settings = repoman_settings
 		self.vcs_settings = vcs_settings
 
-		repoman_repos = self.repoman_settings.repositories
+		self.repositories = self.repoman_settings.repositories
 
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
-			repoman_repos.get_repo_for_location(self.repodir)
+			self.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
 			self._add_repo(config_root, portdir_overlay)
 
@@ -47,15 +47,15 @@ class RepoSettings(object):
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_repos.get_repo_for_location(self.repodir)
+		self.repo_config = self.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_repos):
+		for repo in list(self.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_repos[repo.name]
+				del self.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     0e00f62bec159b2666106db6fcbb3bf62135908e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:36 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e00f62b

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 0b78001..26fa50a 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     8b8c9507ccdcb2ffc4080213146eafc1153a6896
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:39 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b8c9507

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 582370e..7887a79 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     e78b98fa08c4d2c1ee940c0d39ea99d703d1b475
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e78b98fa

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index a5214d8..30487b5 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1199,7 +1193,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1604,8 +1599,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1722,7 +1716,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     7ec83c60eb7e3e667b526f795b79d5917eb7ba88
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ec83c60

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 30487b5..58f6b8c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     40d8842c79a236be9f265ad1daeb330a0fd57648
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:34 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=40d8842c

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 0387214..5aa6ad8 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     276ecb79e7e04b61f9463efc5178c57fc899420b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:36 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=276ecb79

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 58f6b8c..e942dca 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     f84b75a0c476da44831b928a7a0cba1a8772ff6f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:27:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f84b75a0

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e98520b..86ac802 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     2a1de077903e87f7ef9514a270da444f2e4a4885
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2a1de077

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index db6c468..a77b2f2 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     63186f325c2410067c924863446cf5753385e79a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=63186f32

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 825aa5b..9f7c64b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     4aa2ae1f28234e13e4e8cdf918a1765886111564
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4aa2ae1f

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c183aea..825aa5b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     44e454562bc07d991f09ac82c7309d91a115bb25
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=44e45456

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 95af4d4..c183aea 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1195,7 +1189,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1600,8 +1595,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1718,7 +1712,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     7941f999805d7ea1b31a7f400abc98b8a5bacf99
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:56 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7941f999

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 7d369ef..57b5b40 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     e02063d64d6c5a5d581b6056cdd9838e4657ca7c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e02063d6

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e98520b..86ac802 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     a84cb16dfda9051a9b09c194af35f78103385cd1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:52 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a84cb16d

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c183aea..825aa5b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     e49901a04a1528053d2379e25e1c9558d8fc6b55
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e49901a0

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 7d369ef..57b5b40 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     0c7753966762e88746c2fb382baff814bc2f8bd5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c775396

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 825aa5b..9f7c64b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     ef1361570982a70b80b84c71526da7fc802e2465
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:52 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef136157

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 95af4d4..c183aea 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1195,7 +1189,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1600,8 +1595,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1718,7 +1712,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     02791f08615835fc1f491a3a9b59baade0f43773
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 23:52:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=02791f08

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index db6c468..a77b2f2 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     420538f046357870fa603c17426d76fa38efa1dd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=420538f0

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e98520b..86ac802 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     d76c3db8e6bb159f1a10882cd56013c0c3d12436
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:20 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d76c3db8

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index db6c468..a77b2f2 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     869381739bd4cb60b4b7043891b0a5655db59faa
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=86938173

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c183aea..825aa5b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     975913de2d03753fc2bf7484e68dfbe1014159d4
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=975913de

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 95af4d4..c183aea 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1195,7 +1189,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1600,8 +1595,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1718,7 +1712,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 93e8840..2a1f4d9 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -589,3 +589,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     e20e78f3199e921b8d23032a6b1b0bdf2310be46
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e20e78f3

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 7d369ef..57b5b40 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 216+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     053d71aa2add7aa3334212c69b2d9f1e47b60789
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:19 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=053d71aa

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 825aa5b..9f7c64b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     4669a7cd42649f4a11160078ffdeb742f5839062
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4669a7cd

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

 pym/repoman/main.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index f34d8a7..96dd1b4 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -560,7 +560,9 @@ for xpkg in effective_scanlist:
 							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     ef216a65edf24de0b5a673f43e930aca18338952
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef216a65

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 767f630..5f3cf00 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -138,6 +138,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     abad1e97cd2c320ca379bd6e848ee41c420c6bd6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=abad1e97

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 3db02a1..d398bb3 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -273,6 +273,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -289,7 +302,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -302,7 +314,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -320,26 +331,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -397,7 +402,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -632,7 +636,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     e20f124439adf8c488ee2fcae5553af380e5fcd1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e20f1244

repoman/main.py: Remove some temporary dubug print()

 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 5f3cf00..7cad55c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -119,15 +119,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -292,7 +288,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     50b6e6e31ad706114105877d4c39b28fea69c7aa
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=50b6e6e3

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 72318e3..469103e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     e52abecb23d6a50ffdfb7ade9849a2d74883a667
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:26 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e52abecb

repoman/main.py: Refactor "RepoMan Sez"

 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index d1f2b40..767f630 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -981,25 +981,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1008,15 +1004,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1195,7 +1189,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1595,8 +1590,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1713,7 +1707,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b7b3945..b19d4e1 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -586,3 +586,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  2:08 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  2:08 UTC (permalink / raw
  To: gentoo-commits

commit:     9c6ffee12fcd52149f19b2f75c36b2396c27ee8c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 17 02:07:13 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 02:07:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9c6ffee1

repoman/main.py: Update dependency.perlcore error to us qatracker

Update the original code added after the re-write had started.
This brings it up to date with teh new stats tracking class instance. 

---
 pym/repoman/main.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index b3e93bf..1815af9 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -553,11 +553,12 @@ for xpkg in effective_scanlist:
 								(mytype, suspect_virtual[atom.cp], atom))
 						if not is_blocker and \
 							atom.cp.startswith("perl-core/"):
-							stats['dependency.perlcore'] += 1
-							fails['dependency.perlcore'].append(
+							qatracker.add_error('dependency.perlcore',
 								ebuild.relative_path +
 								": %s: please use '%s' instead of '%s'" %
-								(mytype, atom.replace("perl-core/","virtual/perl-"), atom))
+								(mytype,
+								atom.replace("perl-core/","virtual/perl-"),
+								atom))
 
 					if buildtime and \
 						not is_blocker and \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     abe9ad3cd4419a1e87356591f0a778005f27d4ac
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=abe9ad3c

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

---
 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8197400..8a1a043 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -270,6 +270,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -286,7 +299,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -299,7 +311,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -317,26 +328,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -394,7 +399,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -625,7 +629,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     f5f970ccb810ebc666e06bee97e2c95a8f9eb8e7
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f5f970cc

repoman/main.py: Refactor "RepoMan Sez"

---
 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 5f21e7a..3b5296b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -973,25 +973,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1000,15 +996,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1187,7 +1181,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1588,8 +1583,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1706,7 +1700,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b7b3945..b19d4e1 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -586,3 +586,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     dca4ec05419dd24e5c65d0c8f0824948722566d8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dca4ec05

repoman/main.py: Remove some temporary dubug print()

---
 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 47ada0c..c19bf94 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -116,15 +116,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -289,7 +285,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     a864f61de2f10595a54bef4f78d7d2ad69781cff
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:12 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a864f61d

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 583c538..9ce3c18 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -477,7 +477,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     bba8bc9075d3953db26120176431790b9c1d79fa
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bba8bc90

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

---
 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8197400..8a1a043 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -270,6 +270,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -286,7 +299,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -299,7 +311,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -317,26 +328,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -394,7 +399,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -625,7 +629,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     e035de500b80f4304df4b0dd669203035c7ae019
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e035de50

repoman/main.py: Refactor "RepoMan Sez"

---
 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 5f21e7a..3b5296b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -973,25 +973,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1000,15 +996,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1187,7 +1181,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1588,8 +1583,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1706,7 +1700,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b7b3945..b19d4e1 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -586,3 +586,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     e2b07bc2bfd5c467956303e8c7c90b7b13aba279
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e2b07bc2

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

---
 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 3b5296b..47ada0c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -135,6 +135,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     ea38effda2ac362824d4d0912f1f6ead8ad5a8ab
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ea38effd

repoman/main.py: Remove some temporary dubug print()

---
 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 47ada0c..c19bf94 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -116,15 +116,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -289,7 +285,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     c994b32104ffe2f26338261a89b2a2f9388ecfef
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:32 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c994b321

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 583c538..9ce3c18 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -477,7 +477,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     5e02711fc9c84ec3442da07471455ab6a9c5ee67
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:57:17 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5e02711f

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 583c538..9ce3c18 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -477,7 +477,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     0a49780502fee33ace494e22eb018a972e91bd26
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0a497805

repoman/main.py: Remove some temporary dubug print()

---
 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 47ada0c..c19bf94 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -116,15 +116,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -289,7 +285,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     f7e0e0a96364d651ac43a2774e0d94ecc5838387
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f7e0e0a9

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

---
 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 3b5296b..47ada0c 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -135,6 +135,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     0f65db851225c78530034fb1a8f9622dd3d35b9a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f65db85

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

---
 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8197400..8a1a043 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -270,6 +270,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -286,7 +299,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -299,7 +311,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -317,26 +328,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -394,7 +399,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -625,7 +629,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     051d7a600b8e41a7eff7ce08fca9e44012a1f01b
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=051d7a60

repoman/main.py: Refactor "RepoMan Sez"

---
 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 5f21e7a..3b5296b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -973,25 +973,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -1000,15 +996,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1187,7 +1181,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1588,8 +1583,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1706,7 +1700,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b7b3945..b19d4e1 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -586,3 +586,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-03 19:33 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-03 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     1005c1b750558ed3e13cb82f0985b1f1294ba24c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 19:32:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun  3 19:32:18 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1005c1b7

repoman/main.py: Move the check class instantiations out of the xpkg loop

This should help reduce overall run time when doing large repoman full runs.
It instead re-uses the class instances for each pkg checked.

---
 pym/repoman/main.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 37319a3..b347369 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -263,6 +263,19 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
+#######  initialize our checks classes here before the big xpkg loop
+manifester = Manifests(options, qatracker, repoman_settings)
+is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+status_check = VCSStatus(vcs_settings, qatracker)
+fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
+	vcs_settings)
+pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
+thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
+use_flag_checks = USEFlagChecks(qatracker, uselist)
+
+
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
 	logging.info("checking package %s" % xpkg)
@@ -279,7 +292,6 @@ for xpkg in effective_scanlist:
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
 #####################
-	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
@@ -292,7 +304,6 @@ for xpkg in effective_scanlist:
 	checkdirlist = os.listdir(checkdir)
 
 ######################
-	is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
 	pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
 	if is_ebuild.continue_:
 		# If we can't access all the metadata then it's totally unsafe to
@@ -310,26 +321,20 @@ for xpkg in effective_scanlist:
 	ebuildlist = sorted(pkgs.values())
 	ebuildlist = [pkg.pf for pkg in ebuildlist]
 #######################
-	filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, qatracker)
 	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################
-	fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-		vcs_settings)
 	fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new)
 #################
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		qatracker.add_error("changelog.missing", xpkg + "/ChangeLog")
 #################
-	pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings)
-	pkgmeta.check(xpkg, checkdir, checkdirlist)
+	pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel)
 	muselist = frozenset(pkgmeta.musedict)
 #################
 
@@ -387,7 +392,6 @@ for xpkg in effective_scanlist:
 
 		if not fetchcheck.src_uri_error:
 			#######################
-			thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 			thirdparty.check(myaux, ebuild.relative_path)
 			#######################
 		if myaux.get("PROVIDE"):
@@ -616,7 +620,6 @@ for xpkg in effective_scanlist:
 		badprovsyntax = badprovsyntax > 0
 
 		#################
-		use_flag_checks = USEFlagChecks(qatracker, uselist)
 		use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist)
 
 		ebuild_used_useflags = use_flag_checks.getUsedUseFlags()


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-03 18:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-03 18:15 UTC (permalink / raw
  To: gentoo-commits

commit:     c345511a62b9a2f89b43d4e539c7079868e82e91
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:02:47 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun  3 18:14:58 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c345511a

repoman/main.py: Remove some temporary dubug print()

---
 pym/repoman/main.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index a96f38f..5f91713 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -109,15 +109,11 @@ if options.experimental_inherit == 'y':
 can_force = True
 
 portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-print("portdir", portdir)
-print("portdir_overlay", portdir_overlay)
-print("mydir", mydir)
 if portdir is None:
 	sys.exit(1)
 
 myreporoot = os.path.basename(portdir_overlay)
 myreporoot += mydir[len(portdir_overlay):]
-print("myreporoot", myreporoot)
 ##################
 
 vcs_settings = VCSSettings(options, repoman_settings)
@@ -282,7 +278,7 @@ for xpkg in effective_scanlist:
 		checkdir_relative = os.path.join(catdir, checkdir_relative)
 	checkdir_relative = os.path.join(".", checkdir_relative)
 
-#####################^^^^^^^^^^^^^^
+#####################
 	manifester = Manifests(options, qatracker, repoman_settings)
 	if manifester.run(checkdir, portdb):
 		continue


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-03 18:15 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-03 18:15 UTC (permalink / raw
  To: gentoo-commits

commit:     9a17984d163ea81df5cbf0b54eda6b9cbb38301a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:00:05 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun  3 18:07:12 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a17984d

Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned

When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains
the temporaily activated repo.  main.py was not re-assigning repoman_settings to the new object.
Split out _add_repo() to it's own function.
Split out the gpg-sign specific function for git into plugin-ready functions, for later.

---
 pym/repoman/main.py  |   2 +
 pym/repoman/repos.py | 119 ++++++++++++++++++++++++++++++++-------------------
 2 files changed, 77 insertions(+), 44 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 425b891..a96f38f 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -128,6 +128,8 @@ vcs_settings = VCSSettings(options, repoman_settings)
 repo_settings = RepoSettings(config_root, portdir, portdir_overlay,
 		repoman_settings, vcs_settings, options, qawarnings)
 
+repoman_settings = repo_settings.repoman_settings
+
 portdb = repo_settings.portdb
 ##################
 

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index b79e241..6bd1eb4 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -26,75 +26,46 @@ class RepoSettings(object):
 	def __init__(self, config_root, portdir, portdir_overlay,
 		repoman_settings=None, vcs_settings=None, options=None,
 		qawarnings=None):
+		self.repoman_settings = repoman_settings
+		self.vcs_settings = vcs_settings
+
 		# Ensure that current repository is in the list of enabled repositories.
 		self.repodir = os.path.realpath(portdir_overlay)
 		try:
 			repoman_settings.repositories.get_repo_for_location(self.repodir)
 		except KeyError:
-			self.repo_conf = portage.repository.config
-			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
-			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
-			if self.layout_conf_data['repo-name']:
-				self.repo_name = self.layout_conf_data['repo-name']
-			tmp_conf_file = io.StringIO(textwrap.dedent("""
-				[%s]
-				location = %s
-				""") % (self.repo_name, portdir_overlay))
-			# Ensure that the repository corresponding to $PWD overrides a
-			# repository of the same name referenced by the existing PORTDIR
-			# or PORTDIR_OVERLAY settings.
-			repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
-				repoman_settings.get('PORTDIR_OVERLAY', ''),
-				portage._shell_quote(portdir_overlay))
-			self.repositories = self.repo_conf.load_repository_config(
-				repoman_settings, extra_files=[tmp_conf_file])
-			# We have to call the config constructor again so that attributes
-			# dependent on config.repositories are initialized correctly.
-			repoman_settings = portage.config(
-				config_root=config_root, local_config=False, repositories=self.repositories)
+			self._add_repo(config_root, portdir_overlay)
 
-		self.root = repoman_settings['EROOT']
+		self.root = self.repoman_settings['EROOT']
 		self.trees = {
-			self.root: {'porttree': portage.portagetree(settings=repoman_settings)}
+			self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)}
 		}
 		self.portdb = self.trees[self.root]['porttree'].dbapi
 
 		# Constrain dependency resolution to the master(s)
 		# that are specified in layout.conf.
-		self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir)
+		self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir)
 		self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees)
 		self.portdir = self.portdb.porttrees[0]
 		self.commit_env = os.environ.copy()
 		# list() is for iteration on a copy.
-		for repo in list(repoman_settings.repositories):
+		for repo in list(self.repoman_settings.repositories):
 			# all paths are canonical
 			if repo.location not in self.repo_config.eclass_db.porttrees:
-				del repoman_settings.repositories[repo.name]
+				del self.repoman_settings.repositories[repo.name]
 
 		if self.repo_config.allow_provide_virtual:
 			qawarnings.add("virtual.oldstyle")
 
 		if self.repo_config.sign_commit:
-			if vcs_settings.vcs == 'git':
-				# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
-				# the commit arguments. If key_id is unspecified, then it must be
-				# configured by `git config user.signingkey key_id`.
-				vcs_settings.vcs_local_opts.append("--gpg-sign")
-				if repoman_settings.get("PORTAGE_GPG_DIR"):
-					# Pass GNUPGHOME to git for bug #462362.
-					self.commit_env["GNUPGHOME"] = repoman_settings["PORTAGE_GPG_DIR"]
-
-				# Pass GPG_TTY to git for bug #477728.
-				try:
-					self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
-				except OSError:
-					pass
+			func = getattr(self, '_vcs_gpg_%s' % vcs_settings.vcs)
+			func()
 
 		# In order to disable manifest signatures, repos may set
 		# "sign-manifests = false" in metadata/layout.conf. This
 		# can be used to prevent merge conflicts like those that
 		# thin-manifests is designed to prevent.
-		self.sign_manifests = "sign" in repoman_settings.features and \
+		self.sign_manifests = "sign" in self.repoman_settings.features and \
 			self.repo_config.sign_manifest
 
 		if self.repo_config.sign_manifest and self.repo_config.name == "gentoo" and \
@@ -110,13 +81,13 @@ class RepoSettings(object):
 				logging.warn(line)
 
 		is_commit = options.mode in ("commit",)
-		valid_gpg_key = repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
-			r'^%s$' % GPG_KEY_ID_REGEX, repoman_settings["PORTAGE_GPG_KEY"])
+		valid_gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY") and re.match(
+			r'^%s$' % GPG_KEY_ID_REGEX, self.repoman_settings["PORTAGE_GPG_KEY"])
 
 		if self.sign_manifests and is_commit and not valid_gpg_key:
 			logging.error(
 				"PORTAGE_GPG_KEY value is invalid: %s" %
-				repoman_settings["PORTAGE_GPG_KEY"])
+				self.repoman_settings["PORTAGE_GPG_KEY"])
 			sys.exit(1)
 
 		manifest_hashes = self.repo_config.manifest_hashes
@@ -150,6 +121,66 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+
+	def _add_repo(self, config_root, portdir_overlay):
+			self.repo_conf = portage.repository.config
+			self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
+			self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0]
+			if self.layout_conf_data['repo-name']:
+				self.repo_name = self.layout_conf_data['repo-name']
+			tmp_conf_file = io.StringIO(textwrap.dedent("""
+				[%s]
+				location = %s
+				""") % (self.repo_name, portdir_overlay))
+			# Ensure that the repository corresponding to $PWD overrides a
+			# repository of the same name referenced by the existing PORTDIR
+			# or PORTDIR_OVERLAY settings.
+			self.repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % (
+				self.repoman_settings.get('PORTDIR_OVERLAY', ''),
+				portage._shell_quote(portdir_overlay))
+			self.repositories = self.repo_conf.load_repository_config(
+				self.repoman_settings, extra_files=[tmp_conf_file])
+			# We have to call the config constructor again so that attributes
+			# dependent on config.repositories are initialized correctly.
+			self.repoman_settings = portage.config(
+				config_root=config_root, local_config=False, repositories=self.repositories)
+
+	###########  future vcs plugin functions
+
+	def _vcs_gpg_bzr(self):
+		pass
+
+
+	def _vcs_gpg_cvs(self):
+		pass
+
+
+	def _vcs_gpg_git(self):
+		# NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+		# the commit arguments. If key_id is unspecified, then it must be
+		# configured by `git config user.signingkey key_id`.
+		self.vcs_settings.vcs_local_opts.append("--gpg-sign")
+		if self.repoman_settings.get("PORTAGE_GPG_DIR"):
+			# Pass GNUPGHOME to git for bug #462362.
+			self.commit_env["GNUPGHOME"] = self.repoman_settings["PORTAGE_GPG_DIR"]
+
+		# Pass GPG_TTY to git for bug #477728.
+		try:
+			self.commit_env["GPG_TTY"] = os.ttyname(sys.stdin.fileno())
+		except OSError:
+			pass
+
+
+	def _vcs_gpg_hg(self):
+		pass
+
+
+	def _vcs_gpg_svn(self):
+		pass
+
+
+
+
 def list_checks(kwlist, liclist, uselist, repoman_settings):
 	liclist_deprecated = set()
 	if "DEPRECATED" in repoman_settings._license_manager._license_groups:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-03 11:29 Tom Wijsman
  0 siblings, 0 replies; 216+ messages in thread
From: Tom Wijsman @ 2014-06-03 11:29 UTC (permalink / raw
  To: gentoo-commits

commit:     dd3b5ade5fda333a6a12471374a112fac4e043eb
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 11:28:44 2014 +0000
Commit:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
CommitDate: Tue Jun  3 11:28:44 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dd3b5ade

repoman/main.py: Refactor "RepoMan Sez"

---
 pym/repoman/main.py      | 27 ++++++++++-----------------
 pym/repoman/utilities.py |  8 ++++++--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c698265..425b891 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -964,25 +964,21 @@ if options.mode != 'commit':
 	if dofull:
 		print(bold("Note: type \"repoman full\" for a complete listing."))
 	if dowarn and not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're only giving me a partial QA payment?\n"
 			"              I'll take it this time, but I'm not happy.\"")
 	elif not dofail:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"If everyone were like you, I'd be out of business!\"")
 	elif dofail:
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 else:
 	if dofail and can_force and options.force and not options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			" \"You want to commit even with these QA issues?\n"
 			"              I'll take it this time, but I'm not happy.\"\n")
 	elif dofail:
@@ -991,15 +987,13 @@ else:
 				"The --force option has been disabled"
 				" due to extraordinary issues."))
 		print(bad("Please fix these important QA issues first."))
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"Make your QA payment on time"
 			" and you'll never see the likes of me.\"\n")
 		sys.exit(1)
 
 	if options.pretend:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"So, you want to play it safe. Good call.\"\n")
 
 	myunadded = []
@@ -1178,7 +1172,8 @@ else:
 
 	if vcs_settings.vcs:
 		if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
-			print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+			utilities.repoman_sez(
+				"\"Doing nothing is not always good for QA.\"")
 			print()
 			print("(Didn't find any changed files...)")
 			print()
@@ -1578,8 +1573,7 @@ else:
 			portage.util.write_atomic(x, b''.join(mylines), mode='wb')
 
 	if repolevel == 1:
-		print(
-			green("RepoMan sez:"),
+		utilities.repoman_sez(
 			"\"You're rather crazy... "
 			"doing the entire repository.\"\n")
 
@@ -1696,7 +1690,6 @@ else:
 			"repoman was too scared"
 			" by not seeing any familiar version control file"
 			" that he forgot to commit anything")
-	print(
-		green("RepoMan sez:"),
+	utilities.repoman_sez(
 		"\"If everyone were like you, I'd be out of business!\"\n")
 sys.exit(0)

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b7b3945..b19d4e1 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -39,9 +39,10 @@ from portage import shutil
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage import util
 from portage.localization import _
 from portage.process import find_binary
-from portage import util
+from portage.output import green
 
 from repoman.copyrights import update_copyright, update_copyright_year
 
@@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
 			path = os.path.join(startdir, cat)
 			if not os.path.isdir(path):
 				continue
-			pkgdirs = os.listdir(path)
 			scanlist.extend(AddPackagesInDir(path))
 	elif repolevel == 2:  # category level, startdir = catdir
 		# We only want 1 segment of the directory,
@@ -586,3 +586,7 @@ def UpdateChangeLog(
 		except OSError:
 			pass
 		return None
+
+
+def repoman_sez(msg):
+	print (green("RepoMan sez:"), msg)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 17:01 Tom Wijsman
  0 siblings, 0 replies; 216+ messages in thread
From: Tom Wijsman @ 2014-06-02 17:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f2b67b8b0f08272ee841c3cde4ebe4c4e682383a
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 17:00:53 2014 +0000
Commit:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
CommitDate: Mon Jun  2 17:00:53 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f2b67b8b

repoman/main.py: Add global_pmaskdict param to has_global_mask call

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index fcf60f7..f32ddcd 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -481,7 +481,7 @@ for xpkg in effective_scanlist:
 					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
-			if keywords and not has_global_mask(pkg):
+			if keywords and not has_global_mask(pkg, global_pmaskdict):
 				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
 
 		if options.ignore_arches:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 15:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02 15:44 UTC (permalink / raw
  To: gentoo-commits

commit:     5d371987379f32b84651992846fed8f50a59254e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:23:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 15:42:43 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5d371987

repoman/main.py: Remove the exit_handler() and intialization

This script is no longer the start script.
There is a handler in the new start script.

---
 pym/repoman/main.py | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index dfe188d..dfdf6ad 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -96,18 +96,6 @@ if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
 	not sys.stdout.isatty():
 	nocolor()
 
-
-def exithandler(signum=None, _frame=None):
-	logging.fatal("Interrupted; exiting...")
-	if signum is None:
-		sys.exit(1)
-	else:
-		sys.exit(128 + signum)
-
-
-signal.signal(signal.SIGINT, exithandler)
-
-
 options, arguments = parse_args(
 	sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
 
@@ -210,7 +198,6 @@ if repolevel == 1:
 else:
 	startdir = normalize_path(mydir)
 	startdir = os.path.join(repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-
 ###################
 
 # get lists of valid keywords, licenses, and use
@@ -299,7 +286,7 @@ for xpkg in effective_scanlist:
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
-		 manifester.digest_check(checkdir)
+		 manifester.digest_check(xpkg, checkdir)
 ######################
 
 	if options.mode == 'manifest-check':


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 15:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02 15:44 UTC (permalink / raw
  To: gentoo-commits

commit:     fe8b1f48236ac32bb5ab82e4e7bb02f95c3859b3
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:56:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 15:42:51 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fe8b1f48

repoman/{argparser,metadata}.py: Fix up missing imports and definition

---
 pym/repoman/argparser.py | 1 +
 pym/repoman/metadata.py  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
index 5005798..19ec6e9 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -4,6 +4,7 @@
 
 """This module contains functions used in Repoman to parse CLI arguments."""
 
+import logging
 import portage
 from portage import util
 from portage.util._argparse import ArgumentParser

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f281523..b4950ad 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -1,6 +1,7 @@
 
 import errno
 import logging
+import sys
 import tempfile
 import time
 
@@ -15,6 +16,8 @@ from portage import exception
 from portage import os
 from portage.output import green
 
+if sys.hexversion >= 0x3000000:
+	basestring = str
 
 metadata_xml_encoding = 'UTF-8'
 metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 15:44 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02 15:44 UTC (permalink / raw
  To: gentoo-commits

commit:     b5a4e8484f042e453e9038181aedd06f0b1a6427
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:56:29 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 15:42:51 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b5a4e848

repoman/scan.py: Fix an AttributeError for vcs == None

---
 pym/repoman/scan.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py
index 051f170..e7ce8ff 100644
--- a/pym/repoman/scan.py
+++ b/pym/repoman/scan.py
@@ -85,8 +85,9 @@ class Changes(object):
 	def scan(self, vcs_settings):
 		self._reset()
 
-		vcscheck = getattr(self, 'scan_%s' % vcs_settings.vcs)
-		vcscheck()
+		if vcs_settings.vcs:
+			vcscheck = getattr(self, 'scan_%s' % vcs_settings.vcs)
+			vcscheck()
 
 		if vcs_settings.vcs:
 			self.new_ebuilds.update(x for x in self.new if x.endswith(".ebuild"))


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 15:01 Tom Wijsman
  0 siblings, 0 replies; 216+ messages in thread
From: Tom Wijsman @ 2014-06-02 15:01 UTC (permalink / raw
  To: gentoo-commits

commit:     23c506ae53bcfb747783b7436af5f768552b53bc
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:56:43 2014 +0000
Commit:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
CommitDate: Mon Jun  2 14:56:43 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=23c506ae

repoman/{argparser,metadata}.py: Fix up missing imports and definition

---
 pym/repoman/argparser.py | 1 +
 pym/repoman/metadata.py  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
index 5005798..19ec6e9 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -4,6 +4,7 @@
 
 """This module contains functions used in Repoman to parse CLI arguments."""
 
+import logging
 import portage
 from portage import util
 from portage.util._argparse import ArgumentParser

diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index f281523..b4950ad 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -1,6 +1,7 @@
 
 import errno
 import logging
+import sys
 import tempfile
 import time
 
@@ -15,6 +16,8 @@ from portage import exception
 from portage import os
 from portage.output import green
 
+if sys.hexversion >= 0x3000000:
+	basestring = str
 
 metadata_xml_encoding = 'UTF-8'
 metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 14:24 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02 14:24 UTC (permalink / raw
  To: gentoo-commits

commit:     9b3d5b8544074c62ed30a45484039f9c18457a8d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:23:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 14:23:54 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9b3d5b85

repoman/main.py: Remove the exit_handler() and intialization

This script is no longer the start script.
There is a handler in hte new start script.

---
 pym/repoman/main.py | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index dfe188d..c5a6ea6 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -96,18 +96,6 @@ if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
 	not sys.stdout.isatty():
 	nocolor()
 
-
-def exithandler(signum=None, _frame=None):
-	logging.fatal("Interrupted; exiting...")
-	if signum is None:
-		sys.exit(1)
-	else:
-		sys.exit(128 + signum)
-
-
-signal.signal(signal.SIGINT, exithandler)
-
-
 options, arguments = parse_args(
 	sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", ""))
 
@@ -205,12 +193,13 @@ if options.mode == 'commit':
 
 # Make startdir relative to the canonical repodir, so that we can pass
 # it to digestgen and it won't have to be canonicalized again.
+print("REPOLEVEL:", repolevel)
 if repolevel == 1:
 	startdir = repo_settings.repodir
 else:
 	startdir = normalize_path(mydir)
 	startdir = os.path.join(repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:])
-
+print("STARTDIR:", startdir)
 ###################
 
 # get lists of valid keywords, licenses, and use
@@ -299,7 +288,7 @@ for xpkg in effective_scanlist:
 	if manifester.run(checkdir, portdb):
 		continue
 	if not manifester.generated_manifest:
-		 manifester.digest_check(checkdir)
+		 manifester.digest_check(xpkg, checkdir)
 ######################
 
 	if options.mode == 'manifest-check':


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02 14:11 Tom Wijsman
  0 siblings, 0 replies; 216+ messages in thread
From: Tom Wijsman @ 2014-06-02 14:11 UTC (permalink / raw
  To: gentoo-commits

commit:     f40235dc6ae4e9efd5db5be259740dc6f1a70b8e
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 14:10:21 2014 +0000
Commit:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
CommitDate: Mon Jun  2 14:10:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f40235dc

repoman/main.py: Fix qa_tracker import

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

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c680752..dfe188d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -60,7 +60,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, max_desc_len, missingvars,
 	ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
-from qa_tracker import QATracker
+from repoman.qa_tracker import QATracker
 from repoman.repos import has_global_mask, RepoSettings, repo_metadata
 from repoman.scan import Changes, scan
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02  1:10 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02  1:10 UTC (permalink / raw
  To: gentoo-commits

commit:     1a270403eb361c287a09be622242f4d3ae316c4f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 01:06:33 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 01:08:17 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a270403

Repoman: Optimize, consolidate some XmlLint class useage

---
 pym/repoman/_xml.py | 4 ++--
 pym/repoman/main.py | 7 +------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 1b98ede..513b62a 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -47,8 +47,8 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
 
 class XmlLint(object):
 
-	def __init__(self, metadata_dtd, options, repolevel, repoman_settings):
-		self.metadata_dtd = metadata_dtd
+	def __init__(self, options, repolevel, repoman_settings):
+		self.metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
 		self._is_capable = False
 		self.binary = None
 		self._check_capable(options, repolevel, repoman_settings)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index f8bd264..af7c52b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -259,12 +259,6 @@ dev_keywords = dev_keywords(profiles)
 
 qatracker = QATracker()
 
-####################
-
-metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
-xmllint = XmlLint(metadata_dtd, options, repolevel, repoman_settings)
-
-#####################
 
 if options.mode == "manifest":
 	pass
@@ -607,6 +601,7 @@ for xpkg in effective_scanlist:
 #################
 		# Only carry out if in package directory or check forced
 		if not metadata_bad:
+			xmllint = XmlLint(options, repolevel, repoman_settings)
 			if not xmllint.check(checkdir):
 				qatracker.add_error("metadata.bad", xpkg + "/metadata.xml")
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-06-02  1:10 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-06-02  1:10 UTC (permalink / raw
  To: gentoo-commits

commit:     3f96a3f6f4e7192110b0d5b51d1a1188ae0fbecb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  2 01:01:31 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun  2 01:01:31 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f96a3f6

repoman/main.py: Rename manifester return variable 'skip' to 'continue_'

---
 pym/repoman/main.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 6a7ada7..f8bd264 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -333,8 +333,8 @@ for xpkg in effective_scanlist:
 
 #####################
 	manifester = Manifests(options, repoman_settings)
-	skip = manifester.run(checkdir, portdb)
-	if skip:
+	continue_ = manifester.run(checkdir, portdb)
+	if continue_:
 		continue
 ######################
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-30 13:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-30 13:03 UTC (permalink / raw
  To: gentoo-commits

commit:     ccaae712e8d42f5d9bbcc38195d8c072a7b9bc41
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 20:57:39 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu May 29 20:57:39 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ccaae712

repoman/main.py: Replace y with y_ebuild in the loop

This too helps clarify what it is.

---
 pym/repoman/main.py | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 99238d9..ee70735 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -746,9 +746,9 @@ for xpkg in effective_scanlist:
 	# detect unused local USE-descriptions
 	used_useflags = set()
 
-	for y in ebuildlist:
+	for y_ebuild in ebuildlist:
 ##################
-		ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, xpkg, y)
+		ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, xpkg, y_ebuild)
 ##################
 
 		if check_changelog and not changelog_modified \
@@ -756,11 +756,11 @@ for xpkg in effective_scanlist:
 			stats['changelog.ebuildadded'] += 1
 			fails['changelog.ebuildadded'].append(ebuild.relative_path)
 
-		if ebuild.untracked(check_ebuild_notadded, y, eadded):
+		if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded):
 			# ebuild not added to vcs
 			stats["ebuild.notadded"] += 1
-			fails["ebuild.notadded"].append(xpkg + "/" + y + ".ebuild")
-		myesplit = portage.pkgsplit(y)
+			fails["ebuild.notadded"].append(xpkg + "/" + y_ebuild + ".ebuild")
+		myesplit = portage.pkgsplit(y_ebuild)
 
 		is_bad_split = myesplit is None or myesplit[0] != xpkg.split("/")[-1]
 
@@ -770,15 +770,15 @@ for xpkg in effective_scanlist:
 
 			if is_pv_toolong or is_pv_toolong2:
 				stats["ebuild.invalidname"] += 1
-				fails["ebuild.invalidname"].append(xpkg + "/" + y + ".ebuild")
+				fails["ebuild.invalidname"].append(xpkg + "/" + y_ebuild + ".ebuild")
 				continue
 		elif myesplit[0] != pkgdir:
 			print(pkgdir, myesplit[0])
 			stats["ebuild.namenomatch"] += 1
-			fails["ebuild.namenomatch"].append(xpkg + "/" + y + ".ebuild")
+			fails["ebuild.namenomatch"].append(xpkg + "/" + y_ebuild + ".ebuild")
 			continue
 
-		pkg = pkgs[y]
+		pkg = pkgs[y_ebuild]
 
 		if pkg.invalid:
 			allvalid = False
@@ -834,7 +834,7 @@ for xpkg in effective_scanlist:
 					continue
 				myqakey = missingvars[pos] + ".missing"
 				stats[myqakey] += 1
-				fails[myqakey].append(xpkg + "/" + y + ".ebuild")
+				fails[myqakey].append(xpkg + "/" + y_ebuild + ".ebuild")
 
 		if catdir == "virtual":
 			for var in ("HOMEPAGE", "LICENSE"):
@@ -868,7 +868,7 @@ for xpkg in effective_scanlist:
 				stats["KEYWORDS.stable"] += 1
 				fails["KEYWORDS.stable"].append(
 					"%s/%s.ebuild added with stable keywords: %s" %
-					(xpkg, y, " ".join(stable_keywords)))
+					(xpkg, y_ebuild, " ".join(stable_keywords)))
 
 		ebuild_archs = set(
 			kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
@@ -897,7 +897,7 @@ for xpkg in effective_scanlist:
 					haskeyword = True
 			if not haskeyword:
 				stats["KEYWORDS.stupid"] += 1
-				fails["KEYWORDS.stupid"].append(xpkg + "/" + y + ".ebuild")
+				fails["KEYWORDS.stupid"].append(xpkg + "/" + y_ebuild + ".ebuild")
 
 		"""
 		Ebuilds that inherit a "Live" eclass (darcs,subversion,git,cvs,etc..) should
@@ -914,7 +914,7 @@ for xpkg in effective_scanlist:
 				stats["LIVEVCS.stable"] += 1
 				fails["LIVEVCS.stable"].append(
 					"%s/%s.ebuild with stable keywords:%s " %
-					(xpkg, y, bad_stable_keywords))
+					(xpkg, y_ebuild, bad_stable_keywords))
 			del bad_stable_keywords
 
 			if keywords and not has_global_mask(pkg):
@@ -959,7 +959,7 @@ for xpkg in effective_scanlist:
 		baddepsyntax = False
 		badlicsyntax = False
 		badprovsyntax = False
-		catpkg = catdir + "/" + y
+		catpkg = catdir + "/" + y_ebuild
 
 		inherited_java_eclass = "java-pkg-2" in inherited or \
 			"java-pkg-opt-2" in inherited
@@ -1086,7 +1086,7 @@ for xpkg in effective_scanlist:
 
 		for mypos in range(len(myuse)):
 			stats["IUSE.invalid"] += 1
-			fails["IUSE.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % myuse[mypos])
+			fails["IUSE.invalid"].append(xpkg + "/" + y_ebuild + ".ebuild: %s" % myuse[mypos])
 
 		# Check for outdated RUBY targets
 		old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
@@ -1112,7 +1112,7 @@ for xpkg in effective_scanlist:
 				# function will remove it without removing values.
 				if lic not in liclist and lic != "||":
 					stats["LICENSE.invalid"] += 1
-					fails["LICENSE.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % lic)
+					fails["LICENSE.invalid"].append(xpkg + "/" + y_ebuild + ".ebuild: %s" % lic)
 				elif lic in liclist_deprecated:
 					stats["LICENSE.deprecated"] += 1
 					fails["LICENSE.deprecated"].append("%s: %s" % (ebuild.relative_path, lic))
@@ -1129,11 +1129,11 @@ for xpkg in effective_scanlist:
 				if myskey not in kwlist:
 					stats["KEYWORDS.invalid"] += 1
 					fails["KEYWORDS.invalid"].append(
-						"%s/%s.ebuild: %s" % (xpkg, y, mykey))
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
 				elif myskey not in profiles:
 					stats["KEYWORDS.invalid"] += 1
 					fails["KEYWORDS.invalid"].append(
-						"%s/%s.ebuild: %s (profile invalid)" % (xpkg, y, mykey))
+						"%s/%s.ebuild: %s (profile invalid)" % (xpkg, y_ebuild, mykey))
 
 		# restrict checks
 		myrestrict = None
@@ -1151,7 +1151,7 @@ for xpkg in effective_scanlist:
 			if mybadrestrict:
 				stats["RESTRICT.invalid"] += len(mybadrestrict)
 				for mybad in mybadrestrict:
-					fails["RESTRICT.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % mybad)
+					fails["RESTRICT.invalid"].append(xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad)
 		# REQUIRED_USE check
 		required_use = myaux["REQUIRED_USE"]
 		if required_use:


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-30 13:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-30 13:03 UTC (permalink / raw
  To: gentoo-commits

commit:     71f8e844940eba8ba73d833e9e786a7ea65f2bfd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 17:31:19 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 17:31:19 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71f8e844

repoman/main.py: Create ebuild.py and Ebuild class

This moves all relavent data to a class for a common access point.
It also adds an untracked function.

---
 pym/repoman/ebuild.py | 30 ++++++++++++++++++
 pym/repoman/main.py   | 88 ++++++++++++++++++++++++---------------------------
 2 files changed, 71 insertions(+), 47 deletions(-)

diff --git a/pym/repoman/ebuild.py b/pym/repoman/ebuild.py
new file mode 100644
index 0000000..fbe25a9
--- /dev/null
+++ b/pym/repoman/ebuild.py
@@ -0,0 +1,30 @@
+
+
+from portage import os
+
+
+class Ebuild(object):
+	'''Class to run primary checks on ebuilds'''
+
+	def __init__(self, repo_settings, repolevel, pkgdir, catdir, vcs_settings, x, y):
+		self.vcs_settings = vcs_settings
+		self.relative_path = os.path.join(x, y + ".ebuild")
+		self.full_path = os.path.join(repo_settings.repodir, self.relative_path)
+		self.ebuild_path = y + ".ebuild"
+		if repolevel < 3:
+			self.ebuild_path = os.path.join(pkgdir, self.ebuild_path)
+		if repolevel < 2:
+			self.ebuild_path = os.path.join(catdir, self.ebuild_path)
+		self.ebuild_path = os.path.join(".", self.ebuild_path)
+
+
+	def untracked(self, check_ebuild_notadded, y, eadded):
+		do_check = self.vcs_settings.vcs in ("cvs", "svn", "bzr")
+		really_notadded = check_ebuild_notadded and y not in eadded
+
+		if do_check and really_notadded:
+			# ebuild not added to vcs
+			return True
+		return False
+
+

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 158323e..9e2ba76 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -67,6 +67,7 @@ from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import run_checks, checks_init
 from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
 from repoman.checks.herds.herdbase import make_herd_base
+from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name,
 	metadata_dtd_uri, metadata_xml_declaration)
@@ -806,22 +807,16 @@ for x in effective_scanlist:
 	used_useflags = set()
 
 	for y in ebuildlist:
-		relative_path = os.path.join(x, y + ".ebuild")
-		full_path = os.path.join(repo_settings.repodir, relative_path)
-		ebuild_path = y + ".ebuild"
-		if repolevel < 3:
-			ebuild_path = os.path.join(pkgdir, ebuild_path)
-		if repolevel < 2:
-			ebuild_path = os.path.join(catdir, ebuild_path)
-		ebuild_path = os.path.join(".", ebuild_path)
+##################
+		ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, x, y)
+##################
+
 		if check_changelog and not changelog_modified \
-			and ebuild_path in changed.new_ebuilds:
+			and ebuild.ebuild_path in changed.new_ebuilds:
 			stats['changelog.ebuildadded'] += 1
-			fails['changelog.ebuildadded'].append(relative_path)
+			fails['changelog.ebuildadded'].append(ebuild.relative_path)
 
-		vcs_settings.vcs_is_cvs_or_svn_or_bzr = vcs_settings.vcs in ("cvs", "svn", "bzr")
-		check_ebuild_really_notadded = check_ebuild_notadded and y not in eadded
-		if vcs_settings.vcs_is_cvs_or_svn_or_bzr and check_ebuild_really_notadded:
+		if ebuild.untracked(check_ebuild_notadded, y, eadded):
 			# ebuild not added to vcs
 			stats["ebuild.notadded"] += 1
 			fails["ebuild.notadded"].append(x + "/" + y + ".ebuild")
@@ -850,7 +845,7 @@ for x in effective_scanlist:
 			for k, msgs in pkg.invalid.items():
 				for msg in msgs:
 					stats[k] += 1
-					fails[k].append("%s: %s" % (relative_path, msg))
+					fails[k].append("%s: %s" % (ebuild.relative_path, msg))
 			continue
 
 		myaux = pkg._metadata
@@ -861,12 +856,12 @@ for x in effective_scanlist:
 		if repo_settings.repo_config.eapi_is_banned(eapi):
 			stats["repo.eapi.banned"] += 1
 			fails["repo.eapi.banned"].append(
-				"%s: %s" % (relative_path, eapi))
+				"%s: %s" % (ebuild.relative_path, eapi))
 
 		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
 			stats["repo.eapi.deprecated"] += 1
 			fails["repo.eapi.deprecated"].append(
-				"%s: %s" % (relative_path, eapi))
+				"%s: %s" % (ebuild.relative_path, eapi))
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):
@@ -877,18 +872,18 @@ for x in effective_scanlist:
 				fails["variable.invalidchar"].append(
 					"%s: %s variable contains non-ASCII "
 					"character at position %s" %
-					(relative_path, k, m.start() + 1))
+					(ebuild.relative_path, k, m.start() + 1))
 
 		if not src_uri_error:
 			#######################
 			thirdparty = ThirdPartyMirrors(repoman_settings)
-			thirdparty.check(myaux, relative_path)
+			thirdparty.check(myaux, ebuild.relative_path)
 			stats["SRC_URI.mirror"] = thirdparty.stats
 			fails["SRC_URI.mirror"] = thirdparty.fails
 			#######################
 		if myaux.get("PROVIDE"):
 			stats["virtual.oldstyle"] += 1
-			fails["virtual.oldstyle"].append(relative_path)
+			fails["virtual.oldstyle"].append(ebuild.relative_path)
 
 		for pos, missing_var in enumerate(missingvars):
 			if not myaux.get(missing_var):
@@ -906,20 +901,20 @@ for x in effective_scanlist:
 				if myaux.get(var):
 					myqakey = var + ".virtual"
 					stats[myqakey] += 1
-					fails[myqakey].append(relative_path)
+					fails[myqakey].append(ebuild.relative_path)
 
 		if myaux['DESCRIPTION'][-1:] in ['.']:
 			stats['DESCRIPTION.punctuation'] += 1
 			fails['DESCRIPTION.punctuation'].append(
 				"%s: DESCRIPTION ends with a '%s' character"
-				% (relative_path, myaux['DESCRIPTION'][-1:]))
+				% (ebuild.relative_path, myaux['DESCRIPTION'][-1:]))
 
 		# 14 is the length of DESCRIPTION=""
 		if len(myaux['DESCRIPTION']) > max_desc_len:
 			stats['DESCRIPTION.toolong'] += 1
 			fails['DESCRIPTION.toolong'].append(
 				"%s: DESCRIPTION is %d characters (max %d)" %
-				(relative_path, len(myaux['DESCRIPTION']), max_desc_len))
+				(ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
 
 		keywords = myaux["KEYWORDS"].split()
 		stable_keywords = []
@@ -928,7 +923,7 @@ for x in effective_scanlist:
 				not keyword.startswith("-"):
 				stable_keywords.append(keyword)
 		if stable_keywords:
-			if ebuild_path in changed.new_ebuilds and catdir != "virtual":
+			if ebuild.ebuild_path in changed.new_ebuilds and catdir != "virtual":
 				stable_keywords.sort()
 				stats["KEYWORDS.stable"] += 1
 				fails["KEYWORDS.stable"].append(
@@ -947,7 +942,7 @@ for x in effective_scanlist:
 				stats["KEYWORDS.dropped"] += 1
 				fails["KEYWORDS.dropped"].append(
 					"%s: %s" %
-					(relative_path, " ".join(sorted(dropped_keywords))))
+					(ebuild.relative_path, " ".join(sorted(dropped_keywords))))
 
 		slot_keywords[pkg.slot].update(ebuild_archs)
 
@@ -984,7 +979,7 @@ for x in effective_scanlist:
 
 			if keywords and not has_global_mask(pkg):
 				stats["LIVEVCS.unmasked"] += 1
-				fails["LIVEVCS.unmasked"].append(relative_path)
+				fails["LIVEVCS.unmasked"].append(ebuild.relative_path)
 
 		if options.ignore_arches:
 			arches = [[
@@ -1054,7 +1049,7 @@ for x in effective_scanlist:
 					stats[mytype + '.suspect'] += 1
 					fails[mytype + '.suspect'].append(
 						"%s: 'test?' USE conditional in %s" %
-						(relative_path, mytype))
+						(ebuild.relative_path, mytype))
 
 				for atom in atoms:
 					if atom == "||":
@@ -1075,7 +1070,7 @@ for x in effective_scanlist:
 							atom.cp in suspect_virtual:
 							stats['virtual.suspect'] += 1
 							fails['virtual.suspect'].append(
-								relative_path +
+								ebuild.relative_path +
 								": %s: consider using '%s' instead of '%s'" %
 								(mytype, suspect_virtual[atom.cp], atom))
 
@@ -1084,7 +1079,7 @@ for x in effective_scanlist:
 						not inherited_java_eclass and \
 						atom.cp == "virtual/jdk":
 						stats['java.eclassesnotused'] += 1
-						fails['java.eclassesnotused'].append(relative_path)
+						fails['java.eclassesnotused'].append(ebuild.relative_path)
 					elif buildtime and \
 						not is_blocker and \
 						not inherited_wxwidgets_eclass and \
@@ -1092,13 +1087,13 @@ for x in effective_scanlist:
 						stats['wxwidgets.eclassnotused'] += 1
 						fails['wxwidgets.eclassnotused'].append(
 							"%s: %ss on x11-libs/wxGTK without inheriting"
-							" wxwidgets.eclass" % (relative_path, mytype))
+							" wxwidgets.eclass" % (ebuild.relative_path, mytype))
 					elif runtime:
 						if not is_blocker and \
 							atom.cp in suspect_rdepend:
 							stats[mytype + '.suspect'] += 1
 							fails[mytype + '.suspect'].append(
-								relative_path + ": '%s'" % atom)
+								ebuild.relative_path + ": '%s'" % atom)
 
 					if atom.operator == "~" and \
 						portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
@@ -1107,7 +1102,7 @@ for x in effective_scanlist:
 						fails[qacat].append(
 							"%s: %s uses the ~ operator"
 							" with a non-zero revision: '%s'" %
-							(relative_path, mytype, atom))
+							(ebuild.relative_path, mytype, atom))
 
 			type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
 
@@ -1117,7 +1112,7 @@ for x in effective_scanlist:
 			else:
 				qacat = m + ".syntax"
 			stats[qacat] += 1
-			fails[qacat].append("%s: %s: %s" % (relative_path, m, b))
+			fails[qacat].append("%s: %s: %s" % (ebuild.relative_path, m, b))
 
 		badlicsyntax = len([z for z in type_list if z == "LICENSE"])
 		badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
@@ -1147,7 +1142,7 @@ for x in effective_scanlist:
 				fails['EAPI.incompatible'].append(
 					"%s: IUSE defaults"
 					" not supported with EAPI='%s': '%s'" %
-					(relative_path, eapi, myflag))
+					(ebuild.relative_path, eapi, myflag))
 
 		for mypos in range(len(myuse)):
 			stats["IUSE.invalid"] += 1
@@ -1163,7 +1158,7 @@ for x in effective_scanlist:
 				for myruby in ruby_intersection:
 					stats["IUSE.rubydeprecated"] += 1
 					fails["IUSE.rubydeprecated"].append(
-						(relative_path + ": Deprecated ruby target: %s") % myruby)
+						(ebuild.relative_path + ": Deprecated ruby target: %s") % myruby)
 
 		# license checks
 		if not badlicsyntax:
@@ -1180,7 +1175,7 @@ for x in effective_scanlist:
 					fails["LICENSE.invalid"].append(x + "/" + y + ".ebuild: %s" % lic)
 				elif lic in liclist_deprecated:
 					stats["LICENSE.deprecated"] += 1
-					fails["LICENSE.deprecated"].append("%s: %s" % (relative_path, lic))
+					fails["LICENSE.deprecated"].append("%s: %s" % (ebuild.relative_path, lic))
 
 		# keyword checks
 		myuse = myaux["KEYWORDS"].split()
@@ -1208,7 +1203,7 @@ for x in effective_scanlist:
 		except portage.exception.InvalidDependString as e:
 			stats["RESTRICT.syntax"] += 1
 			fails["RESTRICT.syntax"].append(
-				"%s: RESTRICT: %s" % (relative_path, e))
+				"%s: RESTRICT: %s" % (ebuild.relative_path, e))
 			del e
 		if myrestrict:
 			myrestrict = set(myrestrict)
@@ -1224,33 +1219,32 @@ for x in effective_scanlist:
 				stats['EAPI.incompatible'] += 1
 				fails['EAPI.incompatible'].append(
 					"%s: REQUIRED_USE"
-					" not supported with EAPI='%s'" % (relative_path, eapi,))
+					" not supported with EAPI='%s'" % (ebuild.relative_path, eapi,))
 			try:
 				portage.dep.check_required_use(
 					required_use, (), pkg.iuse.is_valid_flag, eapi=eapi)
 			except portage.exception.InvalidDependString as e:
 				stats["REQUIRED_USE.syntax"] += 1
 				fails["REQUIRED_USE.syntax"].append(
-					"%s: REQUIRED_USE: %s" % (relative_path, e))
+					"%s: REQUIRED_USE: %s" % (ebuild.relative_path, e))
 				del e
 
 		# Syntax Checks
-		relative_path = os.path.join(x, y + ".ebuild")
-		full_path = os.path.join(repo_settings.repodir, relative_path)
+
 		if not vcs_settings.vcs_preserves_mtime:
-			if ebuild_path not in changed.new_ebuilds and \
-				ebuild_path not in changed.ebuilds:
+			if ebuild.ebuild_path not in changed.new_ebuilds and \
+				ebuild.ebuild_path not in changed.ebuilds:
 				pkg.mtime = None
 		try:
 			# All ebuilds should have utf_8 encoding.
 			f = io.open(
 				_unicode_encode(
-					full_path, encoding=_encodings['fs'], errors='strict'),
+					ebuild.full_path, encoding=_encodings['fs'], errors='strict'),
 				mode='r', encoding=_encodings['repo.content'])
 			try:
 				for check_name, e in run_checks(f, pkg):
 					stats[check_name] += 1
-					fails[check_name].append(relative_path + ': %s' % e)
+					fails[check_name].append(ebuild.relative_path + ': %s' % e)
 			finally:
 				f.close()
 		except UnicodeDecodeError:
@@ -1410,13 +1404,13 @@ for x in effective_scanlist:
 							stats[mykey] += 1
 							fails[mykey].append(
 								"%s: %s: %s(%s) %s" % (
-									relative_path, mytype, keyword, prof,
+									ebuild.relative_path, mytype, keyword, prof,
 									repr(atoms)))
 					else:
 						stats[mykey] += 1
 						fails[mykey].append(
 							"%s: %s: %s(%s) %s" % (
-								relative_path, mytype, keyword, prof,
+								ebuild.relative_path, mytype, keyword, prof,
 								repr(atoms)))
 
 		if not baddepsyntax and unknown_pkgs:
@@ -1427,7 +1421,7 @@ for x in effective_scanlist:
 				stats["dependency.unknown"] += 1
 				fails["dependency.unknown"].append(
 					"%s: %s: %s" % (
-						relative_path, mytype, ", ".join(sorted(atoms))))
+						ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
 
 	# check if there are unused local USE-descriptions in metadata.xml
 	# (unless there are any invalids, to avoid noise)


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-30 13:03 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-30 13:03 UTC (permalink / raw
  To: gentoo-commits

commit:     b3f8adf37c195420511ebe3849ea0dffe14bd270
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 20:32:44 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu May 29 20:32:44 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b3f8adf3

repoman/main.py: Rename x variable in loop to xpkg

This will help clarify what it is better.

---
 pym/repoman/main.py | 82 ++++++++++++++++++++++++++---------------------------
 1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 46cdefd..99238d9 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -321,14 +321,14 @@ if options.if_modified == "y":
 	effective_scanlist = sorted(vcs_files_to_cps(
 		chain(changed.changed, changed.new, changed.removed)))
 
-for x in effective_scanlist:
+for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
-	logging.info("checking package %s" % x)
+	logging.info("checking package %s" % xpkg)
 	# save memory by discarding xmatch caches from previous package(s)
 	arch_xmatch_caches.clear()
 	eadded = []
-	catdir, pkgdir = x.split("/")
-	checkdir = repo_settings.repodir + "/" + x
+	catdir, pkgdir = xpkg.split("/")
+	checkdir = repo_settings.repodir + "/" + xpkg
 	checkdir_relative = ""
 	if repolevel < 3:
 		checkdir_relative = os.path.join(pkgdir, checkdir_relative)
@@ -348,7 +348,7 @@ for x in effective_scanlist:
 		repoman_settings['PORTAGE_QUIET'] = '1'
 		if not portage.digestcheck([], repoman_settings, strict=1):
 			stats["manifest.bad"] += 1
-			fails["manifest.bad"].append(os.path.join(x, 'Manifest'))
+			fails["manifest.bad"].append(os.path.join(xpkg, 'Manifest'))
 		repoman_settings.pop('PORTAGE_QUIET', None)
 
 	if options.mode == 'manifest-check':
@@ -378,17 +378,17 @@ for x in effective_scanlist:
 			except KeyError:
 				allvalid = False
 				stats["ebuild.syntax"] += 1
-				fails["ebuild.syntax"].append(os.path.join(x, y))
+				fails["ebuild.syntax"].append(os.path.join(xpkg, y))
 				continue
 			except IOError:
 				allvalid = False
 				stats["ebuild.output"] += 1
-				fails["ebuild.output"].append(os.path.join(x, y))
+				fails["ebuild.output"].append(os.path.join(xpkg, y))
 				continue
 			if not portage.eapi_is_supported(myaux["EAPI"]):
 				allvalid = False
 				stats["EAPI.unsupported"] += 1
-				fails["EAPI.unsupported"].append(os.path.join(x, y))
+				fails["EAPI.unsupported"].append(os.path.join(xpkg, y))
 				continue
 			pkgs[pf] = Package(
 				cpv=cpv, metadata=myaux, root_config=root_config,
@@ -462,7 +462,7 @@ for x in effective_scanlist:
 			if l[:-1][-7:] == ".ebuild":
 				stats["ebuild.notadded"] += 1
 				fails["ebuild.notadded"].append(
-					os.path.join(x, os.path.basename(l[:-1])))
+					os.path.join(xpkg, os.path.basename(l[:-1])))
 		myf.close()
 
 	if vcs_settings.vcs in ("cvs", "svn", "bzr") and check_ebuild_notadded:
@@ -570,7 +570,7 @@ for x in effective_scanlist:
 		# so people can't hide > 20k files in a subdirectory.
 		while filesdirlist:
 			y = filesdirlist.pop(0)
-			relative_path = os.path.join(x, "files", y)
+			relative_path = os.path.join(xpkg, "files", y)
 			full_path = os.path.join(repo_settings.repodir, relative_path)
 			try:
 				mystat = os.stat(full_path)
@@ -594,11 +594,11 @@ for x in effective_scanlist:
 			elif mystat.st_size > 61440:
 				stats["file.size.fatal"] += 1
 				fails["file.size.fatal"].append(
-					"(%d KiB) %s/files/%s" % (mystat.st_size // 1024, x, y))
+					"(%d KiB) %s/files/%s" % (mystat.st_size // 1024, xpkg, y))
 			elif mystat.st_size > 20480:
 				stats["file.size"] += 1
 				fails["file.size"].append(
-					"(%d KiB) %s/files/%s" % (mystat.st_size // 1024, x, y))
+					"(%d KiB) %s/files/%s" % (mystat.st_size // 1024, xpkg, y))
 
 			index = repo_settings.repo_config.find_invalid_path_char(y)
 			if index != -1:
@@ -617,13 +617,13 @@ for x in effective_scanlist:
 
 	if check_changelog and "ChangeLog" not in checkdirlist:
 		stats["changelog.missing"] += 1
-		fails["changelog.missing"].append(x + "/ChangeLog")
+		fails["changelog.missing"].append(xpkg + "/ChangeLog")
 
 	musedict = {}
 	# metadata.xml file check
 	if "metadata.xml" not in checkdirlist:
 		stats["metadata.missing"] += 1
-		fails["metadata.missing"].append(x + "/metadata.xml")
+		fails["metadata.missing"].append(xpkg + "/metadata.xml")
 	# metadata.xml parse check
 	else:
 		metadata_bad = False
@@ -640,7 +640,7 @@ for x in effective_scanlist:
 		except (ExpatError, SyntaxError, EnvironmentError) as e:
 			metadata_bad = True
 			stats["metadata.bad"] += 1
-			fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
+			fails["metadata.bad"].append("%s/metadata.xml: %s" % (xpkg, e))
 			del e
 		else:
 			if not hasattr(xml_parser, 'parser') or \
@@ -654,7 +654,7 @@ for x in effective_scanlist:
 					fails["metadata.bad"].append(
 						"%s/metadata.xml: "
 						"xml declaration is missing on first line, "
-						"should be '%s'" % (x, metadata_xml_declaration))
+						"should be '%s'" % (xpkg, metadata_xml_declaration))
 				else:
 					xml_version, xml_encoding, xml_standalone = \
 						xml_info["XML_DECLARATION"]
@@ -668,13 +668,13 @@ for x in effective_scanlist:
 						fails["metadata.bad"].append(
 							"%s/metadata.xml: "
 							"xml declaration encoding should be '%s', %s" %
-							(x, metadata_xml_encoding, encoding_problem))
+							(xpkg, metadata_xml_encoding, encoding_problem))
 
 				if "DOCTYPE" not in xml_info:
 					metadata_bad = True
 					stats["metadata.bad"] += 1
 					fails["metadata.bad"].append(
-						"%s/metadata.xml: %s" % (x, "DOCTYPE is missing"))
+						"%s/metadata.xml: %s" % (xpkg, "DOCTYPE is missing"))
 				else:
 					doctype_name, doctype_system, doctype_pubid = \
 						xml_info["DOCTYPE"]
@@ -687,14 +687,14 @@ for x in effective_scanlist:
 						fails["metadata.bad"].append(
 							"%s/metadata.xml: "
 							"DOCTYPE: SYSTEM should refer to '%s', %s" %
-							(x, metadata_dtd_uri, system_problem))
+							(xpkg, metadata_dtd_uri, system_problem))
 
 					if doctype_name != metadata_doctype_name:
 						stats["metadata.bad"] += 1
 						fails["metadata.bad"].append(
 							"%s/metadata.xml: "
 							"DOCTYPE: name should be '%s', not '%s'" %
-							(x, metadata_doctype_name, doctype_name))
+							(xpkg, metadata_doctype_name, doctype_name))
 
 			# load USE flags from metadata.xml
 			try:
@@ -702,7 +702,7 @@ for x in effective_scanlist:
 			except portage.exception.ParseError as e:
 				metadata_bad = True
 				stats["metadata.bad"] += 1
-				fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
+				fails["metadata.bad"].append("%s/metadata.xml: %s" % (xpkg, e))
 			else:
 				for atom in chain(*musedict.values()):
 					if atom is None:
@@ -712,13 +712,13 @@ for x in effective_scanlist:
 					except InvalidAtom as e:
 						stats["metadata.bad"] += 1
 						fails["metadata.bad"].append(
-							"%s/metadata.xml: Invalid atom: %s" % (x, e))
+							"%s/metadata.xml: Invalid atom: %s" % (xpkg, e))
 					else:
-						if atom.cp != x:
+						if atom.cp != xpkg:
 							stats["metadata.bad"] += 1
 							fails["metadata.bad"].append(
 								"%s/metadata.xml: Atom contains "
-								"unexpected cat/pn: %s" % (x, atom))
+								"unexpected cat/pn: %s" % (xpkg, atom))
 
 			# Run other metadata.xml checkers
 			try:
@@ -726,7 +726,7 @@ for x in effective_scanlist:
 			except (utilities.UnknownHerdsError, ) as e:
 				metadata_bad = True
 				stats["metadata.bad"] += 1
-				fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
+				fails["metadata.bad"].append("%s/metadata.xml: %s" % (xpkg, e))
 				del e
 
 #################
@@ -734,7 +734,7 @@ for x in effective_scanlist:
 		if not metadata_bad:
 			if not xmllint.check(checkdir):
 				stats["metadata.bad"] += 1
-				fails["metadata.bad"].append(x + "/metadata.xml")
+				fails["metadata.bad"].append(xpkg + "/metadata.xml")
 
 #################
 		del metadata_bad
@@ -748,7 +748,7 @@ for x in effective_scanlist:
 
 	for y in ebuildlist:
 ##################
-		ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, x, y)
+		ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, xpkg, y)
 ##################
 
 		if check_changelog and not changelog_modified \
@@ -759,10 +759,10 @@ for x in effective_scanlist:
 		if ebuild.untracked(check_ebuild_notadded, y, eadded):
 			# ebuild not added to vcs
 			stats["ebuild.notadded"] += 1
-			fails["ebuild.notadded"].append(x + "/" + y + ".ebuild")
+			fails["ebuild.notadded"].append(xpkg + "/" + y + ".ebuild")
 		myesplit = portage.pkgsplit(y)
 
-		is_bad_split = myesplit is None or myesplit[0] != x.split("/")[-1]
+		is_bad_split = myesplit is None or myesplit[0] != xpkg.split("/")[-1]
 
 		if is_bad_split:
 			is_pv_toolong = pv_toolong_re.search(myesplit[1])
@@ -770,12 +770,12 @@ for x in effective_scanlist:
 
 			if is_pv_toolong or is_pv_toolong2:
 				stats["ebuild.invalidname"] += 1
-				fails["ebuild.invalidname"].append(x + "/" + y + ".ebuild")
+				fails["ebuild.invalidname"].append(xpkg + "/" + y + ".ebuild")
 				continue
 		elif myesplit[0] != pkgdir:
 			print(pkgdir, myesplit[0])
 			stats["ebuild.namenomatch"] += 1
-			fails["ebuild.namenomatch"].append(x + "/" + y + ".ebuild")
+			fails["ebuild.namenomatch"].append(xpkg + "/" + y + ".ebuild")
 			continue
 
 		pkg = pkgs[y]
@@ -834,7 +834,7 @@ for x in effective_scanlist:
 					continue
 				myqakey = missingvars[pos] + ".missing"
 				stats[myqakey] += 1
-				fails[myqakey].append(x + "/" + y + ".ebuild")
+				fails[myqakey].append(xpkg + "/" + y + ".ebuild")
 
 		if catdir == "virtual":
 			for var in ("HOMEPAGE", "LICENSE"):
@@ -868,7 +868,7 @@ for x in effective_scanlist:
 				stats["KEYWORDS.stable"] += 1
 				fails["KEYWORDS.stable"].append(
 					"%s/%s.ebuild added with stable keywords: %s" %
-					(x, y, " ".join(stable_keywords)))
+					(xpkg, y, " ".join(stable_keywords)))
 
 		ebuild_archs = set(
 			kw.lstrip("~") for kw in keywords if not kw.startswith("-"))
@@ -897,7 +897,7 @@ for x in effective_scanlist:
 					haskeyword = True
 			if not haskeyword:
 				stats["KEYWORDS.stupid"] += 1
-				fails["KEYWORDS.stupid"].append(x + "/" + y + ".ebuild")
+				fails["KEYWORDS.stupid"].append(xpkg + "/" + y + ".ebuild")
 
 		"""
 		Ebuilds that inherit a "Live" eclass (darcs,subversion,git,cvs,etc..) should
@@ -914,7 +914,7 @@ for x in effective_scanlist:
 				stats["LIVEVCS.stable"] += 1
 				fails["LIVEVCS.stable"].append(
 					"%s/%s.ebuild with stable keywords:%s " %
-					(x, y, bad_stable_keywords))
+					(xpkg, y, bad_stable_keywords))
 			del bad_stable_keywords
 
 			if keywords and not has_global_mask(pkg):
@@ -1086,7 +1086,7 @@ for x in effective_scanlist:
 
 		for mypos in range(len(myuse)):
 			stats["IUSE.invalid"] += 1
-			fails["IUSE.invalid"].append(x + "/" + y + ".ebuild: %s" % myuse[mypos])
+			fails["IUSE.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % myuse[mypos])
 
 		# Check for outdated RUBY targets
 		old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
@@ -1112,7 +1112,7 @@ for x in effective_scanlist:
 				# function will remove it without removing values.
 				if lic not in liclist and lic != "||":
 					stats["LICENSE.invalid"] += 1
-					fails["LICENSE.invalid"].append(x + "/" + y + ".ebuild: %s" % lic)
+					fails["LICENSE.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % lic)
 				elif lic in liclist_deprecated:
 					stats["LICENSE.deprecated"] += 1
 					fails["LICENSE.deprecated"].append("%s: %s" % (ebuild.relative_path, lic))
@@ -1129,11 +1129,11 @@ for x in effective_scanlist:
 				if myskey not in kwlist:
 					stats["KEYWORDS.invalid"] += 1
 					fails["KEYWORDS.invalid"].append(
-						"%s/%s.ebuild: %s" % (x, y, mykey))
+						"%s/%s.ebuild: %s" % (xpkg, y, mykey))
 				elif myskey not in profiles:
 					stats["KEYWORDS.invalid"] += 1
 					fails["KEYWORDS.invalid"].append(
-						"%s/%s.ebuild: %s (profile invalid)" % (x, y, mykey))
+						"%s/%s.ebuild: %s (profile invalid)" % (xpkg, y, mykey))
 
 		# restrict checks
 		myrestrict = None
@@ -1151,7 +1151,7 @@ for x in effective_scanlist:
 			if mybadrestrict:
 				stats["RESTRICT.invalid"] += len(mybadrestrict)
 				for mybad in mybadrestrict:
-					fails["RESTRICT.invalid"].append(x + "/" + y + ".ebuild: %s" % mybad)
+					fails["RESTRICT.invalid"].append(xpkg + "/" + y + ".ebuild: %s" % mybad)
 		# REQUIRED_USE check
 		required_use = myaux["REQUIRED_USE"]
 		if required_use:
@@ -1370,7 +1370,7 @@ for x in effective_scanlist:
 			stats["metadata.warning"] += 1
 			fails["metadata.warning"].append(
 				"%s/metadata.xml: unused local USE-description: '%s'" %
-				(x, myflag))
+				(xpkg, myflag))
 
 if options.if_modified == "y" and len(effective_scanlist) < 1:
 	logging.warn("--if-modified is enabled, but no modified packages were found!")


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  6:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     d82b7a95d697435dffd80028df21517e8c5fda7d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 06:03:33 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 06:04:40 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d82b7a95

repoman/main.py: Create a new Changes class

This new class is to scan for and hold the changes in the repo.
Later it will act as a manager class to run the individual VCS plugin modules scan function.

---
 pym/repoman/main.py | 103 +++++-------------------------------------
 pym/repoman/scan.py | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 139 insertions(+), 91 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e03788f..49ad79d 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -75,7 +75,7 @@ from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, no_exec, allvars, max_desc_len, missingvars,
 	ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.repos import has_global_mask, RepoSettings, repo_metadata
-from repoman.scan import scan
+from repoman.scan import Changes, scan
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
@@ -275,91 +275,12 @@ elif options.pretend:
 else:
 	print(green("\nRepoMan scours the neighborhood..."))
 
-new_ebuilds = set()
-modified_ebuilds = set()
-modified_changelogs = set()
-mychanged = []
-mynew = []
-myremoved = []
-
-if vcs_settings.vcs == "cvs":
-	mycvstree = cvstree.getentries("./", recursive=1)
-	mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
-	mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-	if options.if_modified == "y":
-		myremoved = cvstree.findremoved(mycvstree, recursive=1, basedir="./")
-
-elif vcs_settings.vcs == "svn":
-	with repoman_popen("svn status") as f:
-		svnstatus = f.readlines()
-	mychanged = [
-		"./" + elem.split()[-1:][0]
-		for elem in svnstatus
-		if elem and elem[:1] in "MR"]
-	mynew = [
-		"./" + elem.split()[-1:][0]
-		for elem in svnstatus
-		if elem.startswith("A")]
-	if options.if_modified == "y":
-		myremoved = [
-			"./" + elem.split()[-1:][0]
-			for elem in svnstatus
-			if elem.startswith("D")]
-
-elif vcs_settings.vcs == "git":
-	with repoman_popen(
-		"git diff-index --name-only "
-		"--relative --diff-filter=M HEAD") as f:
-		mychanged = f.readlines()
-	mychanged = ["./" + elem[:-1] for elem in mychanged]
-
-	with repoman_popen(
-		"git diff-index --name-only "
-		"--relative --diff-filter=A HEAD") as f:
-		mynew = f.readlines()
-	mynew = ["./" + elem[:-1] for elem in mynew]
-	if options.if_modified == "y":
-		with repoman_popen(
-			"git diff-index --name-only "
-			"--relative --diff-filter=D HEAD") as f:
-			myremoved = f.readlines()
-		myremoved = ["./" + elem[:-1] for elem in myremoved]
-
-elif vcs_settings.vcs == "bzr":
-	with repoman_popen("bzr status -S .") as f:
-		bzrstatus = f.readlines()
-	mychanged = [
-		"./" + elem.split()[-1:][0].split('/')[-1:][0]
-		for elem in bzrstatus
-		if elem and elem[1:2] == "M"]
-	mynew = [
-		"./" + elem.split()[-1:][0].split('/')[-1:][0]
-		for elem in bzrstatus
-		if elem and (elem[1:2] == "NK" or elem[0:1] == "R")]
-	if options.if_modified == "y":
-		myremoved = [
-			"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
-			for elem in bzrstatus
-			if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+#####################
 
-elif vcs_settings.vcs == "hg":
-	with repoman_popen("hg status --no-status --modified .") as f:
-		mychanged = f.readlines()
-	mychanged = ["./" + elem.rstrip() for elem in mychanged]
-	with repoman_popen("hg status --no-status --added .") as f:
-		mynew = f.readlines()
-	mynew = ["./" + elem.rstrip() for elem in mynew]
-	if options.if_modified == "y":
-		with repoman_popen("hg status --no-status --removed .") as f:
-			myremoved = f.readlines()
-		myremoved = ["./" + elem.rstrip() for elem in myremoved]
+changed = Changes(options)
+changed.scan(vcs_settings)
 
-if vcs_settings.vcs:
-	new_ebuilds.update(x for x in mynew if x.endswith(".ebuild"))
-	modified_ebuilds.update(x for x in mychanged if x.endswith(".ebuild"))
-	modified_changelogs.update(
-		x for x in chain(mychanged, mynew)
-		if os.path.basename(x) == "ChangeLog")
+######################
 
 have_pmasked = False
 have_dev_keywords = False
@@ -403,7 +324,7 @@ except FileNotFound:
 effective_scanlist = scanlist
 if options.if_modified == "y":
 	effective_scanlist = sorted(vcs_files_to_cps(
-		chain(mychanged, mynew, myremoved)))
+		chain(changed.changed, changed.new, changed.removed)))
 
 for x in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
@@ -886,7 +807,7 @@ for x in effective_scanlist:
 	muselist = frozenset(musedict)
 
 	changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-	changelog_modified = changelog_path in modified_changelogs
+	changelog_modified = changelog_path in changed.changelogs
 
 	# detect unused local USE-descriptions
 	used_useflags = set()
@@ -901,7 +822,7 @@ for x in effective_scanlist:
 			ebuild_path = os.path.join(catdir, ebuild_path)
 		ebuild_path = os.path.join(".", ebuild_path)
 		if check_changelog and not changelog_modified \
-			and ebuild_path in new_ebuilds:
+			and ebuild_path in changed.new_ebuilds:
 			stats['changelog.ebuildadded'] += 1
 			fails['changelog.ebuildadded'].append(relative_path)
 
@@ -1025,7 +946,7 @@ for x in effective_scanlist:
 				not keyword.startswith("-"):
 				stable_keywords.append(keyword)
 		if stable_keywords:
-			if ebuild_path in new_ebuilds and catdir != "virtual":
+			if ebuild_path in changed.new_ebuilds and catdir != "virtual":
 				stable_keywords.sort()
 				stats["KEYWORDS.stable"] += 1
 				fails["KEYWORDS.stable"].append(
@@ -1335,8 +1256,8 @@ for x in effective_scanlist:
 		relative_path = os.path.join(x, y + ".ebuild")
 		full_path = os.path.join(repo_settings.repodir, relative_path)
 		if not vcs_settings.vcs_preserves_mtime:
-			if ebuild_path not in new_ebuilds and \
-				ebuild_path not in modified_ebuilds:
+			if ebuild_path not in changed.new_ebuilds and \
+				ebuild_path not in changed.ebuilds:
 				pkg.mtime = None
 		try:
 			# All ebuilds should have utf_8 encoding.
@@ -1947,7 +1868,7 @@ else:
 			checkdir_relative = os.path.join(".", checkdir_relative)
 
 			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
-			changelog_modified = changelog_path in modified_changelogs
+			changelog_modified = changelog_path in changed.changelogs
 			if changelog_modified and options.echangelog != 'force':
 				continue
 

diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py
index 575069f..051f170 100644
--- a/pym/repoman/scan.py
+++ b/pym/repoman/scan.py
@@ -2,8 +2,13 @@
 import logging
 import os
 import sys
+from itertools import chain
+
+from portage import cvstree
 
 from repoman.errors import caterror
+from repoman._subprocess import repoman_popen
+
 
 def scan(repolevel, reposplit, startdir, categories, repo_settings):
 	scanlist = []
@@ -48,3 +53,125 @@ def scan(repolevel, reposplit, startdir, categories, repo_settings):
 		"Found the following packages to scan:\n%s" % '\n'.join(scanlist))
 
 	return scanlist
+
+
+class Changes(object):
+	'''Class object to scan and hold the resultant data
+	for all changes to process.
+
+	Basic plan is move the spaghetti code here, refactor the code
+	to split it into separate functions for each cvs type.
+	Later refactoring can then move the individual scan_ functions
+	to their respective VCS plugin module.
+	Leaving this class as the manager class which runs the correct VCS plugin.
+	This will ease future addition of new VCS types.
+	'''
+
+
+	def __init__(self, options):
+		self.options = options
+		self._reset()
+
+
+	def _reset(self):
+		self.new_ebuilds = set()
+		self.ebuilds = set()
+		self.changelogs = set()
+		self.changed = []
+		self.new = []
+		self.removed = []
+
+
+	def scan(self, vcs_settings):
+		self._reset()
+
+		vcscheck = getattr(self, 'scan_%s' % vcs_settings.vcs)
+		vcscheck()
+
+		if vcs_settings.vcs:
+			self.new_ebuilds.update(x for x in self.new if x.endswith(".ebuild"))
+			self.ebuilds.update(x for x in self.changed if x.endswith(".ebuild"))
+			self.changelogs.update(
+				x for x in chain(self.changed, self.new)
+				if os.path.basename(x) == "ChangeLog")
+
+
+	def scan_cvs(self):
+		tree = cvstree.getentries("./", recursive=1)
+		self.changed = cvstree.findchanged(tree, recursive=1, basedir="./")
+		self.new = cvstree.findnew(tree, recursive=1, basedir="./")
+		if self.options.if_modified == "y":
+			self.removed = cvstree.findremoved(tree, recursive=1, basedir="./")
+		del tree
+
+
+	def scan_svn(self):
+		with repoman_popen("svn status") as f:
+			svnstatus = f.readlines()
+		self.changed = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem and elem[:1] in "MR"]
+		self.new = [
+			"./" + elem.split()[-1:][0]
+			for elem in svnstatus
+			if elem.startswith("A")]
+		if self.options.if_modified == "y":
+			self.removed = [
+				"./" + elem.split()[-1:][0]
+				for elem in svnstatus
+				if elem.startswith("D")]
+
+
+	def scan_git(self):
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=M HEAD") as f:
+			changed = f.readlines()
+		self.changed = ["./" + elem[:-1] for elem in changed]
+		del changed
+
+		with repoman_popen(
+			"git diff-index --name-only "
+			"--relative --diff-filter=A HEAD") as f:
+			new = f.readlines()
+		self.new = ["./" + elem[:-1] for elem in new]
+		if self.options.if_modified == "y":
+			with repoman_popen(
+				"git diff-index --name-only "
+				"--relative --diff-filter=D HEAD") as f:
+				removed = f.readlines()
+			self.removed = ["./" + elem[:-1] for elem in removed]
+			del removed
+
+
+	def scan_bzr(self):
+		with repoman_popen("bzr status -S .") as f:
+			bzrstatus = f.readlines()
+		self.changed = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and elem[1:2] == "M"]
+		self.new = [
+			"./" + elem.split()[-1:][0].split('/')[-1:][0]
+			for elem in bzrstatus
+			if elem and (elem[1:2] == "NK" or elem[0:1] == "R")]
+		if self.options.if_modified == "y":
+			self.removed = [
+				"./" + elem.split()[-3:-2][0].split('/')[-1:][0]
+				for elem in bzrstatus
+				if elem and (elem[1:2] == "K" or elem[0:1] == "R")]
+
+
+	def scan_hg(self):
+		with repoman_popen("hg status --no-status --modified .") as f:
+			changed = f.readlines()
+		self.changed = ["./" + elem.rstrip() for elem in changed]
+		with repoman_popen("hg status --no-status --added .") as f:
+			new = f.readlines()
+		self.new = ["./" + elem.rstrip() for elem in new]
+		if self.options.if_modified == "y":
+			with repoman_popen("hg status --no-status --removed .") as f:
+				removed = f.readlines()
+			self.removed = ["./" + elem.rstrip() for elem in removed]
+		del changed, new, removed


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  6:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     75c50245b8bf0d3e50ce217c52f5f12307f62867
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 05:03:10 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 06:04:40 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75c50245

repoman/main.py: Create a new XmlLint class

Create the new class in _xml.py.
Consolodate all the xmllint code in this one class.

---
 pym/repoman/_xml.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 pym/repoman/main.py | 40 +++++++++++--------------------------
 2 files changed, 68 insertions(+), 29 deletions(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index e59f357..1b98ede 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -1,6 +1,15 @@
 
+import sys
 import xml
 
+import portage
+from portage import os
+from portage.output import red
+from portage.process import find_binary
+
+from repoman.metadata import fetch_metadata_dtd
+from repoman._subprocess import repoman_getstatusoutput
+
 
 class _XMLParser(xml.etree.ElementTree.XMLParser):
 	def __init__(self, data, **kwargs):
@@ -34,3 +43,51 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
 	"""
 	def doctype(self, name, pubid, system):
 		pass
+
+
+class XmlLint(object):
+
+	def __init__(self, metadata_dtd, options, repolevel, repoman_settings):
+		self.metadata_dtd = metadata_dtd
+		self._is_capable = False
+		self.binary = None
+		self._check_capable(options, repolevel, repoman_settings)
+
+
+	def _check_capable(self, options, repolevel, repoman_settings):
+		if options.mode == "manifest":
+			return
+		self.binary = find_binary('xmllint')
+		if not self.binary:
+			print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
+			if options.xml_parse or repolevel == 3:
+				print("%s sorry, xmllint is needed.  failing\n" % red("!!!"))
+				sys.exit(1)
+		else:
+			if not fetch_metadata_dtd(self.metadata_dtd, repoman_settings):
+				sys.exit(1)
+			# this can be problematic if xmllint changes their output
+			self._is_capable = True
+
+
+	@property
+	def capable(self):
+		return self._is_capable
+
+
+	def check(self, checkdir):
+		if not self.capable:
+			return true
+		# xmlint can produce garbage output even on success, so only dump
+		# the ouput when it fails.
+		st, out = repoman_getstatusoutput(
+			self.binary + " --nonet --noout --dtdvalid %s %s" % (
+				portage._shell_quote(self.metadata_dtd),
+				portage._shell_quote(
+					os.path.join(checkdir, "metadata.xml"))))
+		if st != os.EX_OK:
+			print(red("!!!") + " metadata.xml is invalid:")
+			for z in out.splitlines():
+				print(red("!!! ") + z)
+			return False
+		return True

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 836ca1e..e03788f 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -66,9 +66,9 @@ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import run_checks, checks_init
 from repoman.checks.herds.herdbase import make_herd_base
-from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding,
-	metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration)
 from repoman.errors import err
+from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name,
+	metadata_dtd_uri, metadata_xml_declaration)
 from repoman.modules import commit
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
@@ -80,7 +80,7 @@ from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
 	vcs_new_changed, VCSSettings)
-from repoman._xml import _XMLParser, _MetadataTreeBuilder
+from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
 
 
 if sys.hexversion >= 0x3000000:
@@ -261,22 +261,12 @@ for x in qacats:
 	stats[x] = 0
 	fails[x] = []
 
-xmllint_capable = False
-metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
+####################
 
-if options.mode == "manifest":
-	pass
-elif not find_binary('xmllint'):
-	print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
-	if options.xml_parse or repolevel == 3:
-		print("%s sorry, xmllint is needed.  failing\n" % red("!!!"))
-		sys.exit(1)
-else:
-	if not fetch_metadata_dtd(metadata_dtd, repoman_settings):
-		sys.exit(1)
-	# this can be problematic if xmllint changes their output
-	xmllint_capable = True
+metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
+xmllint = XmlLint(metadata_dtd, options, repolevel, repoman_settings)
 
+#####################
 
 if options.mode == "manifest":
 	pass
@@ -884,22 +874,14 @@ for x in effective_scanlist:
 				fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
 				del e
 
+#################
 		# Only carry out if in package directory or check forced
-		if xmllint_capable and not metadata_bad:
-			# xmlint can produce garbage output even on success, so only dump
-			# the ouput when it fails.
-			st, out = repoman_getstatusoutput(
-				"xmllint --nonet --noout --dtdvalid %s %s" % (
-					portage._shell_quote(metadata_dtd),
-					portage._shell_quote(
-						os.path.join(checkdir, "metadata.xml"))))
-			if st != os.EX_OK:
-				print(red("!!!") + " metadata.xml is invalid:")
-				for z in out.splitlines():
-					print(red("!!! ") + z)
+		if not metadata_bad:
+			if not xmllint.check(checkdir):
 				stats["metadata.bad"] += 1
 				fails["metadata.bad"].append(x + "/metadata.xml")
 
+#################
 		del metadata_bad
 	muselist = frozenset(musedict)
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  6:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     d9feded23ad346756be0d6e55568a1a9ff1dfbe5
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 04:09:27 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 06:04:40 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d9feded2

repoman/main.pt: Move some additional code to repos.py

---
 pym/repoman/main.py  | 23 ++---------------------
 pym/repoman/repos.py | 24 ++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2697b1b..836ca1e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -232,8 +232,8 @@ else:
 ###################
 
 # get lists of valid keywords, licenses, and use
-new_data = repo_metadata(repo_settings.portdb)
-kwlist, liclist, uselist, profile_list, global_pmaskdict = new_data
+new_data = repo_metadata(repo_settings.portdb, repoman_settings)
+kwlist, liclist, uselist, profile_list, global_pmaskdict, liclist_deprecated = new_data
 
 repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
 repoman_settings.backup_changes('PORTAGE_ARCHLIST')
@@ -248,25 +248,6 @@ check_profiles(profiles, repoman_settings.archlist())
 
 ####################
 
-liclist_deprecated = set()
-if "DEPRECATED" in repoman_settings._license_manager._license_groups:
-	liclist_deprecated.update(
-		repoman_settings._license_manager.expandLicenseTokens(["@DEPRECATED"]))
-
-if not liclist:
-	logging.fatal("Couldn't find licenses?")
-	sys.exit(1)
-
-if not kwlist:
-	logging.fatal("Couldn't read KEYWORDS from arch.list")
-	sys.exit(1)
-
-if not uselist:
-	logging.fatal("Couldn't find use.desc?")
-	sys.exit(1)
-
-####################
-
 scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
 ####################

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index d5eaf60..16de8bf 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -148,8 +148,27 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+def list_checks(kwlist, liclist, uselist, repoman_settings):
+	liclist_deprecated = set()
+	if "DEPRECATED" in repoman_settings._license_manager._license_groups:
+		liclist_deprecated.update(
+			repoman_settings._license_manager.expandLicenseTokens(["@DEPRECATED"]))
 
-def repo_metadata(portdb):
+	if not liclist:
+		logging.fatal("Couldn't find licenses?")
+		sys.exit(1)
+
+	if not kwlist:
+		logging.fatal("Couldn't read KEYWORDS from arch.list")
+		sys.exit(1)
+
+	if not uselist:
+		logging.fatal("Couldn't find use.desc?")
+		sys.exit(1)
+	return liclist_deprecated
+
+
+def repo_metadata(portdb, repoman_settings):
 	# get lists of valid keywords, licenses, and use
 	kwlist = set()
 	liclist = set()
@@ -236,7 +255,8 @@ def repo_metadata(portdb):
 		global_pmaskdict.setdefault(x.cp, []).append(x)
 	del global_pmasklines
 
-	return (kwlist, liclist, uselist, profile_list, global_pmaskdict)
+	return (kwlist, liclist, uselist, profile_list, global_pmaskdict,
+		list_checks(kwlist, liclist, uselist, repoman_settings))
 
 
 def has_global_mask(pkg, global_pmaskdict):


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  6:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     9b19b5835abf159a95a242719400c47fd96f4aa3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 03:54:32 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 06:04:24 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9b19b583

repoman/main/py: Create new scan.py and scan()

This moves the main scan code out to a function.
Comment out some unused variables.

---
 pym/repoman/main.py | 45 +++++----------------------------------------
 pym/repoman/scan.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 40 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8e15e76..2697b1b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -66,15 +66,16 @@ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import run_checks, checks_init
 from repoman.checks.herds.herdbase import make_herd_base
-from repoman.errors import caterror, err
 from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding,
 	metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration)
+from repoman.errors import err
 from repoman.modules import commit
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, no_exec, allvars, max_desc_len, missingvars,
 	ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.repos import has_global_mask, RepoSettings, repo_metadata
+from repoman.scan import scan
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
@@ -264,47 +265,11 @@ if not uselist:
 	logging.fatal("Couldn't find use.desc?")
 	sys.exit(1)
 
-scanlist = []
-if repolevel == 2:
-	# we are inside a category directory
-	catdir = reposplit[-1]
-	if catdir not in categories:
-		caterror(catdir, repo_settings.repodir)
-	mydirlist = os.listdir(startdir)
-	for x in mydirlist:
-		if x == "CVS" or x.startswith("."):
-			continue
-		if os.path.isdir(startdir + "/" + x):
-			scanlist.append(catdir + "/" + x)
-	repo_subdir = catdir + os.sep
-elif repolevel == 1:
-	for x in categories:
-		if not os.path.isdir(startdir + "/" + x):
-			continue
-		for y in os.listdir(startdir + "/" + x):
-			if y == "CVS" or y.startswith("."):
-				continue
-			if os.path.isdir(startdir + "/" + x + "/" + y):
-				scanlist.append(x + "/" + y)
-	repo_subdir = ""
-elif repolevel == 3:
-	catdir = reposplit[-2]
-	if catdir not in categories:
-		caterror(catdir,repo_settings.repodir)
-	scanlist.append(catdir + "/" + reposplit[-1])
-	repo_subdir = scanlist[-1] + os.sep
-else:
-	msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \
-		' from the current working directory'
-	logging.critical(msg)
-	sys.exit(1)
-
-repo_subdir_len = len(repo_subdir)
-scanlist.sort()
+####################
 
-logging.debug(
-	"Found the following packages to scan:\n%s" % '\n'.join(scanlist))
+scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
+####################
 
 dev_keywords = dev_keywords(profiles)
 

diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py
new file mode 100644
index 0000000..575069f
--- /dev/null
+++ b/pym/repoman/scan.py
@@ -0,0 +1,50 @@
+
+import logging
+import os
+import sys
+
+from repoman.errors import caterror
+
+def scan(repolevel, reposplit, startdir, categories, repo_settings):
+	scanlist = []
+	if repolevel == 2:
+		# we are inside a category directory
+		catdir = reposplit[-1]
+		if catdir not in categories:
+			caterror(catdir, repo_settings.repodir)
+		mydirlist = os.listdir(startdir)
+		for x in mydirlist:
+			if x == "CVS" or x.startswith("."):
+				continue
+			if os.path.isdir(startdir + "/" + x):
+				scanlist.append(catdir + "/" + x)
+		#repo_subdir = catdir + os.sep
+	elif repolevel == 1:
+		for x in categories:
+			if not os.path.isdir(startdir + "/" + x):
+				continue
+			for y in os.listdir(startdir + "/" + x):
+				if y == "CVS" or y.startswith("."):
+					continue
+				if os.path.isdir(startdir + "/" + x + "/" + y):
+					scanlist.append(x + "/" + y)
+		#repo_subdir = ""
+	elif repolevel == 3:
+		catdir = reposplit[-2]
+		if catdir not in categories:
+			caterror(catdir,repo_settings.repodir)
+		scanlist.append(catdir + "/" + reposplit[-1])
+		#repo_subdir = scanlist[-1] + os.sep
+	else:
+		msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \
+			' from the current working directory'
+		logging.critical(msg)
+		sys.exit(1)
+
+	#repo_subdir_len = len(repo_subdir)
+	scanlist.sort()
+
+	logging.debug(
+		"Found the following packages to scan:\n%s" % '\n'.join(scanlist))
+
+	return scanlist


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  5:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  5:04 UTC (permalink / raw
  To: gentoo-commits

commit:     541d7d9325ef3481ef03cb129477ad10e865c5ab
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 05:03:10 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 05:04:00 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=541d7d93

repoman/main.py: Create a new XmlLint class

Create the new class in _xml.py.
Consolodate all the xmllint code in this one class.

---
 pym/repoman/_xml.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 pym/repoman/main.py | 40 +++++++++++--------------------------
 2 files changed, 68 insertions(+), 29 deletions(-)

diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index e59f357..1b98ede 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -1,6 +1,15 @@
 
+import sys
 import xml
 
+import portage
+from portage import os
+from portage.output import red
+from portage.process import find_binary
+
+from repoman.metadata import fetch_metadata_dtd
+from repoman._subprocess import repoman_getstatusoutput
+
 
 class _XMLParser(xml.etree.ElementTree.XMLParser):
 	def __init__(self, data, **kwargs):
@@ -34,3 +43,51 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
 	"""
 	def doctype(self, name, pubid, system):
 		pass
+
+
+class XmlLint(object):
+
+	def __init__(self, metadata_dtd, options, repolevel, repoman_settings):
+		self.metadata_dtd = metadata_dtd
+		self._is_capable = False
+		self.binary = None
+		self._check_capable(options, repolevel, repoman_settings)
+
+
+	def _check_capable(self, options, repolevel, repoman_settings):
+		if options.mode == "manifest":
+			return
+		self.binary = find_binary('xmllint')
+		if not self.binary:
+			print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
+			if options.xml_parse or repolevel == 3:
+				print("%s sorry, xmllint is needed.  failing\n" % red("!!!"))
+				sys.exit(1)
+		else:
+			if not fetch_metadata_dtd(self.metadata_dtd, repoman_settings):
+				sys.exit(1)
+			# this can be problematic if xmllint changes their output
+			self._is_capable = True
+
+
+	@property
+	def capable(self):
+		return self._is_capable
+
+
+	def check(self, checkdir):
+		if not self.capable:
+			return true
+		# xmlint can produce garbage output even on success, so only dump
+		# the ouput when it fails.
+		st, out = repoman_getstatusoutput(
+			self.binary + " --nonet --noout --dtdvalid %s %s" % (
+				portage._shell_quote(self.metadata_dtd),
+				portage._shell_quote(
+					os.path.join(checkdir, "metadata.xml"))))
+		if st != os.EX_OK:
+			print(red("!!!") + " metadata.xml is invalid:")
+			for z in out.splitlines():
+				print(red("!!! ") + z)
+			return False
+		return True

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 836ca1e..e03788f 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -66,9 +66,9 @@ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import run_checks, checks_init
 from repoman.checks.herds.herdbase import make_herd_base
-from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding,
-	metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration)
 from repoman.errors import err
+from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name,
+	metadata_dtd_uri, metadata_xml_declaration)
 from repoman.modules import commit
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
@@ -80,7 +80,7 @@ from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
 	vcs_new_changed, VCSSettings)
-from repoman._xml import _XMLParser, _MetadataTreeBuilder
+from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
 
 
 if sys.hexversion >= 0x3000000:
@@ -261,22 +261,12 @@ for x in qacats:
 	stats[x] = 0
 	fails[x] = []
 
-xmllint_capable = False
-metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
+####################
 
-if options.mode == "manifest":
-	pass
-elif not find_binary('xmllint'):
-	print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
-	if options.xml_parse or repolevel == 3:
-		print("%s sorry, xmllint is needed.  failing\n" % red("!!!"))
-		sys.exit(1)
-else:
-	if not fetch_metadata_dtd(metadata_dtd, repoman_settings):
-		sys.exit(1)
-	# this can be problematic if xmllint changes their output
-	xmllint_capable = True
+metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
+xmllint = XmlLint(metadata_dtd, options, repolevel, repoman_settings)
 
+#####################
 
 if options.mode == "manifest":
 	pass
@@ -884,22 +874,14 @@ for x in effective_scanlist:
 				fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
 				del e
 
+#################
 		# Only carry out if in package directory or check forced
-		if xmllint_capable and not metadata_bad:
-			# xmlint can produce garbage output even on success, so only dump
-			# the ouput when it fails.
-			st, out = repoman_getstatusoutput(
-				"xmllint --nonet --noout --dtdvalid %s %s" % (
-					portage._shell_quote(metadata_dtd),
-					portage._shell_quote(
-						os.path.join(checkdir, "metadata.xml"))))
-			if st != os.EX_OK:
-				print(red("!!!") + " metadata.xml is invalid:")
-				for z in out.splitlines():
-					print(red("!!! ") + z)
+		if not metadata_bad:
+			if not xmllint.check(checkdir):
 				stats["metadata.bad"] += 1
 				fails["metadata.bad"].append(x + "/metadata.xml")
 
+#################
 		del metadata_bad
 	muselist = frozenset(musedict)
 


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  5:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  5:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2fb6926a6a78b5f78408989faba4c7c04547db16
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 03:54:32 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 05:03:49 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2fb6926a

repoman/main/py: Create new scan.py and scan()

This moves the main scan code out to a function.
Comment out some unused variables.

---
 pym/repoman/main.py | 45 +++++----------------------------------------
 pym/repoman/scan.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 40 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 8e15e76..2697b1b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -66,15 +66,16 @@ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
 from repoman.argparser import parse_args
 from repoman.checks.ebuilds.checks import run_checks, checks_init
 from repoman.checks.herds.herdbase import make_herd_base
-from repoman.errors import caterror, err
 from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding,
 	metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration)
+from repoman.errors import err
 from repoman.modules import commit
 from repoman.profile import check_profiles, dev_keywords, setup_profile
 from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, no_exec, allvars, max_desc_len, missingvars,
 	ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.repos import has_global_mask, RepoSettings, repo_metadata
+from repoman.scan import scan
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
@@ -264,47 +265,11 @@ if not uselist:
 	logging.fatal("Couldn't find use.desc?")
 	sys.exit(1)
 
-scanlist = []
-if repolevel == 2:
-	# we are inside a category directory
-	catdir = reposplit[-1]
-	if catdir not in categories:
-		caterror(catdir, repo_settings.repodir)
-	mydirlist = os.listdir(startdir)
-	for x in mydirlist:
-		if x == "CVS" or x.startswith("."):
-			continue
-		if os.path.isdir(startdir + "/" + x):
-			scanlist.append(catdir + "/" + x)
-	repo_subdir = catdir + os.sep
-elif repolevel == 1:
-	for x in categories:
-		if not os.path.isdir(startdir + "/" + x):
-			continue
-		for y in os.listdir(startdir + "/" + x):
-			if y == "CVS" or y.startswith("."):
-				continue
-			if os.path.isdir(startdir + "/" + x + "/" + y):
-				scanlist.append(x + "/" + y)
-	repo_subdir = ""
-elif repolevel == 3:
-	catdir = reposplit[-2]
-	if catdir not in categories:
-		caterror(catdir,repo_settings.repodir)
-	scanlist.append(catdir + "/" + reposplit[-1])
-	repo_subdir = scanlist[-1] + os.sep
-else:
-	msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \
-		' from the current working directory'
-	logging.critical(msg)
-	sys.exit(1)
-
-repo_subdir_len = len(repo_subdir)
-scanlist.sort()
+####################
 
-logging.debug(
-	"Found the following packages to scan:\n%s" % '\n'.join(scanlist))
+scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
+####################
 
 dev_keywords = dev_keywords(profiles)
 

diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py
new file mode 100644
index 0000000..d7cd1be
--- /dev/null
+++ b/pym/repoman/scan.py
@@ -0,0 +1,50 @@
+
+import logging
+import os
+import sys
+
+from repoman.errors import caterror
+
+def scan(repolevel, reposplit, startdir, categories, repo_settings):
+	scanlist = []
+	if repolevel == 2:
+		# we are inside a category directory
+		catdir = reposplit[-1]
+		if catdir not in categories:
+			caterror(catdir, repo_settings.repodir)
+		mydirlist = os.listdir(startdir)
+		for x in mydirlist:
+			if x == "CVS" or x.startswith("."):
+				continue
+			if os.path.isdir(startdir + "/" + x):
+				scanlist.append(catdir + "/" + x)
+		#repo_subdir = catdir + os.sep
+	elif repolevel == 1:
+		for x in categories:
+			if not os.path.isdir(startdir + "/" + x):
+				continue
+			for y in os.listdir(startdir + "/" + x):
+				if y == "CVS" or y.startswith("."):
+					continue
+				if os.path.isdir(startdir + "/" + x + "/" + y):
+					scanlist.append(x + "/" + y)
+		#repo_subdir = ""
+	elif repolevel == 3:
+		catdir = reposplit[-2]
+		if catdir not in categories:
+			caterror(catdir,repo_settings.repodir)
+		scanlist.append(catdir + "/" + reposplit[-1])
+		repo_subdir = scanlist[-1] + os.sep
+	else:
+		msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \
+			' from the current working directory'
+		logging.critical(msg)
+		sys.exit(1)
+
+	#repo_subdir_len = len(repo_subdir)
+	scanlist.sort()
+
+	logging.debug(
+		"Found the following packages to scan:\n%s" % '\n'.join(scanlist))
+
+	return scanlist


^ permalink raw reply related	[flat|nested] 216+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
@ 2014-05-27  5:04 Brian Dolbec
  0 siblings, 0 replies; 216+ messages in thread
From: Brian Dolbec @ 2014-05-27  5:04 UTC (permalink / raw
  To: gentoo-commits

commit:     10d674e542d54980eea6bcede2819af3504fc85a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 27 04:09:27 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue May 27 05:04:00 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=10d674e5

repoman/main.pt: Move some additional code to repos.py

---
 pym/repoman/main.py  | 23 ++---------------------
 pym/repoman/repos.py | 24 ++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2697b1b..836ca1e 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -232,8 +232,8 @@ else:
 ###################
 
 # get lists of valid keywords, licenses, and use
-new_data = repo_metadata(repo_settings.portdb)
-kwlist, liclist, uselist, profile_list, global_pmaskdict = new_data
+new_data = repo_metadata(repo_settings.portdb, repoman_settings)
+kwlist, liclist, uselist, profile_list, global_pmaskdict, liclist_deprecated = new_data
 
 repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
 repoman_settings.backup_changes('PORTAGE_ARCHLIST')
@@ -248,25 +248,6 @@ check_profiles(profiles, repoman_settings.archlist())
 
 ####################
 
-liclist_deprecated = set()
-if "DEPRECATED" in repoman_settings._license_manager._license_groups:
-	liclist_deprecated.update(
-		repoman_settings._license_manager.expandLicenseTokens(["@DEPRECATED"]))
-
-if not liclist:
-	logging.fatal("Couldn't find licenses?")
-	sys.exit(1)
-
-if not kwlist:
-	logging.fatal("Couldn't read KEYWORDS from arch.list")
-	sys.exit(1)
-
-if not uselist:
-	logging.fatal("Couldn't find use.desc?")
-	sys.exit(1)
-
-####################
-
 scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings)
 
 ####################

diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index d5eaf60..16de8bf 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -148,8 +148,27 @@ class RepoSettings(object):
 					logging.error(line)
 				sys.exit(1)
 
+def list_checks(kwlist, liclist, uselist, repoman_settings):
+	liclist_deprecated = set()
+	if "DEPRECATED" in repoman_settings._license_manager._license_groups:
+		liclist_deprecated.update(
+			repoman_settings._license_manager.expandLicenseTokens(["@DEPRECATED"]))
 
-def repo_metadata(portdb):
+	if not liclist:
+		logging.fatal("Couldn't find licenses?")
+		sys.exit(1)
+
+	if not kwlist:
+		logging.fatal("Couldn't read KEYWORDS from arch.list")
+		sys.exit(1)
+
+	if not uselist:
+		logging.fatal("Couldn't find use.desc?")
+		sys.exit(1)
+	return liclist_deprecated
+
+
+def repo_metadata(portdb, repoman_settings):
 	# get lists of valid keywords, licenses, and use
 	kwlist = set()
 	liclist = set()
@@ -236,7 +255,8 @@ def repo_metadata(portdb):
 		global_pmaskdict.setdefault(x.cp, []).append(x)
 	del global_pmasklines
 
-	return (kwlist, liclist, uselist, profile_list, global_pmaskdict)
+	return (kwlist, liclist, uselist, profile_list, global_pmaskdict,
+		list_checks(kwlist, liclist, uselist, repoman_settings))
 
 
 def has_global_mask(pkg, global_pmaskdict):


^ permalink raw reply related	[flat|nested] 216+ messages in thread

end of thread, other threads:[~2016-05-03  9:33 UTC | newest]

Thread overview: 216+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  0:55 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-05-03  9:33 Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-26 14:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-28 15:05 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-26 18:08 Zac Medico
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-17 15:42 Brian Dolbec
2016-04-16 20:00 Zac Medico
2016-03-15 19:00 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-02-01  7:55 Zac Medico
2016-02-01  7:21 Zac Medico
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:15 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-06  4:21 Brian Dolbec
2016-01-06  4:21 Brian Dolbec
2015-12-30 23:38 Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  0:20 Brian Dolbec
2015-09-19 17:32 Brian Dolbec
2015-09-19 16:48 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  1:22 Brian Dolbec
2015-09-19  1:22 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 15:32 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2014-11-17  2:08 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-06-03 19:33 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 11:29 Tom Wijsman
2014-06-02 17:01 Tom Wijsman
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:01 Tom Wijsman
2014-06-02 14:24 Brian Dolbec
2014-06-02 14:11 Tom Wijsman
2014-06-02  1:10 Brian Dolbec
2014-06-02  1:10 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox