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

2016-01-10 Thread Brian Dolbec
commit: 40475b12719c76ce6176c72587f8d976362a7042
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:57:36 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:38 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=40475b12

repoman: Move the large depency checks loop to a new plugin 
ProfileDependsChecks class

 pym/repoman/modules/scan/depend/__init__.py |   8 ++
 pym/repoman/modules/scan/depend/profile.py  | 211 
 pym/repoman/repos.py|   1 +
 pym/repoman/scanner.py  | 181 +---
 4 files changed, 227 insertions(+), 174 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'profile-module': {
+   'name': "profile",
+   'class': "ProfileDependsChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/profile.py 
b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+   return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+   self.profiles = kwargs.get('profiles')
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.include_arches = kwargs.get('include_arches')
+   self.caches = kwargs.get('caches')
+   self.repoman_incrementals = kwargs.get('repoman_incrementals')
+   self.env = kwargs.get('env')
+   self.have = kwargs.get('have')
+   self.dev_keywords = kwargs.get('dev_keywords')
+
+   def check(self, **kwargs):
+   arches = kwargs.get('arches')
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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.repo_settings.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 

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

2016-01-10 Thread Brian Dolbec
commit: a75fbc2fb47f5f76e71ddbcc2c4e6a04067eeb97
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:56:25 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:35 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a75fbc2f

repoman: Migrate more metadata checks to ebuild_metadata.py

 .../modules/scan/metadata/ebuild_metadata.py   | 32 --
 pym/repoman/scanner.py | 17 
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
 import re
 import sys
 
+from repoman.qa_data import missingvars
+
 if sys.hexversion >= 0x300:
basestring = str
 
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
 
-   def check(self, **kwargs):
+   def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   return {'continue': False}
+
+   def missing(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for pos, missing_var in enumerate(missingvars):
+   if not ebuild.metadata.get(missing_var):
+   if kwargs.get('catdir') == "virtual" and \
+   missing_var in ("HOMEPAGE", "LICENSE"):
+   continue
+   if kwargs.get('live_ebuild') and missing_var == 
"KEYWORDS":
+   continue
+   myqakey = missingvars[pos] + ".missing"
+   self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+   % (kwargs.get('xpkg'), 
kwargs.get('y_ebuild')))
+   return {'continue': False}
+
+   def old_virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+   return {'continue': False}
 
+   def virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   if kwargs.get('catdir') == "virtual":
+   for var in ("HOMEPAGE", "LICENSE"):
+   if ebuild.metadata.get(var):
+   myqakey = var + ".virtual"
+   self.qatracker.add_error(myqakey, 
ebuild.relative_path)
return {'continue': False}
 
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
 
@property
def runInEbuilds(self):
-   return (True, [self.check])
+   return (True, [self.invalidchar, self.missing, 
self.old_virtual, self.virtual])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for pos, missing_var in enumerate(missingvars):
-   if not 
dynamic_data['ebuild'].metadata.get(missing_var):
-   if dynamic_data['catdir'] == "virtual" 
and \
-   missing_var in ("HOMEPAGE", 
"LICENSE"):
-   continue
-   if dynamic_data['live_ebuild'] and 
missing_var == "KEYWORDS":
-   continue
-   myqakey = missingvars[pos] + ".missing"
-   self.qatracker.add_error(myqakey, xpkg 
+ "/" + y_ebuild + ".ebuild")
-
-   if dynamic_data['catdir'] == "virtual":
-   for var in ("HOMEPAGE", "LICENSE"):
-   if 
dynamic_data['ebuild'].metadata.get(var):
-   myqakey = var + ".virtual"
-   
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if 

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

2016-01-10 Thread Brian Dolbec
commit: d775bb08d44ccff3dc7c4c686faf32be16c064bf
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:55:55 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:37 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d775bb08

repoman: Create a new Options class plugin

This handles an options.force bypass using the is_forced() from withing the 
plugin system.

 pym/repoman/modules/scan/options/__init__.py | 23 +++
 pym/repoman/modules/scan/options/options.py  | 22 ++
 pym/repoman/scanner.py   | 10 ++
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/pym/repoman/modules/scan/options/__init__.py 
b/pym/repoman/modules/scan/options/__init__.py
new file mode 100644
index 000..8424058
--- /dev/null
+++ b/pym/repoman/modules/scan/options/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Options plug-in module for repoman.
+Performs option related actions on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'options',
+   'description': doc,
+   'provides':{
+   'options-module': {
+   'name': "options",
+   'class': "Options",
+   'description': doc,
+   'functions': ['is_forced'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/options/options.py 
b/pym/repoman/modules/scan/options/options.py
new file mode 100644
index 000..b592884
--- /dev/null
+++ b/pym/repoman/modules/scan/options/options.py
@@ -0,0 +1,22 @@
+
+
+class Options(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+
+   def is_forced(self, **kwargs):
+   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.
+   return {'continue': True}
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.is_forced])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ac77d1f..a047237 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -290,6 +290,8 @@ class Scanner(object):
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
+   # Options.is_forced() is used to bypass further 
checks
+   ('options', 'Options'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -317,14 +319,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   # Syntax Checks
-
-   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 dynamic_data['arches']:
if arch not in self.profiles:



[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-10 Thread Brian Dolbec
commit: 31fd105a9897fee5a77a893e23062c37195767e4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:36:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:33 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=31fd105a

repoman: Migrate DescriptionChecks to the plugin system

 pym/repoman/modules/scan/metadata/__init__.py|  8 
 .../scan/metadata}/description.py| 20 ++--
 pym/repoman/scanner.py   |  5 +
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'description-metadata': {
+   'name': "description",
+   'class': "DescriptionChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/description.py 
b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
 class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, ebuild):
+   def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
-   self._checkTooLong(pkg, ebuild)
-
-   def _checkTooLong(self, pkg, ebuild):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), 
max_desc_len))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.checkTooLong])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 955440e..bb856b8 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks
 from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -216,7 +215,6 @@ class Scanner(object):
# initialize our checks classes here before the big xpkg loop
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
-   self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+   ('description', 'DescriptionChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -347,8 +346,6 @@ class 

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

2016-01-10 Thread Brian Dolbec
commit: b273922a63f9b18b86d3dcdcaac8492c1e60ac69
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:31:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:35 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b273922a

scanner.py: Migrate another metadata check to ebuild_metadata

 pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
 pym/repoman/scanner.py   | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   if ebuild.metadata.get("PROVIDE"):
+   self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+
return {'continue': False}
 
@property

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if dynamic_data['ebuild'].metadata.get("PROVIDE"):
-   self.qatracker.add_error("virtual.oldstyle", 
dynamic_data['ebuild'].relative_path)
 
for pos, missing_var in enumerate(missingvars):
if not 
dynamic_data['ebuild'].metadata.get(missing_var):



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

2016-01-10 Thread Brian Dolbec
commit: 7eb2e3fe039783645a3feee9b7333f40e9159ee9
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:29:42 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:32 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7eb2e3fe

repoman: Create the ThirdPartyMirrors class plugin

 pym/repoman/checks/ebuilds/thirdpartymirrors.py| 39 --
 pym/repoman/modules/scan/mirrors/__init__.py   | 23 +
 .../modules/scan/mirrors/thirdpartymirrors.py  | 59 ++
 pym/repoman/scanner.py |  6 +--
 4 files changed, 85 insertions(+), 42 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py 
b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
deleted file mode 100644
index 848dfb9..000
--- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding:utf-8 -*-
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class ThirdPartyMirrors(object):
-
-   def __init__(self, repoman_settings, qatracker):
-   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
-   self.thirdpartymirrors = {}
-   profile_thirdpartymirrors = 
repoman_settings.thirdpartymirrors().items()
-   for mirror_alias, mirrors in profile_thirdpartymirrors:
-   for mirror in mirrors:
-   if not mirror.endswith("/"):
-   mirror += "/"
-   self.thirdpartymirrors[mirror] = mirror_alias
-
-   self.qatracker = qatracker
-
-   def check(self, myaux, relative_path):
-   # Check that URIs don't reference a server from 
thirdpartymirrors.
-   for uri in portage.dep.use_reduce(
-   myaux["SRC_URI"], matchall=True, is_src_uri=True,
-   eapi=myaux["EAPI"], flat=True):
-   contains_mirror = False
-   for mirror, mirror_alias in 
self.thirdpartymirrors.items():
-   if uri.startswith(mirror):
-   contains_mirror = True
-   break
-   if not contains_mirror:
-   continue
-
-   new_uri = "mirror://%s/%s" % (mirror_alias, 
uri[len(mirror):])
-   self.qatracker.add_error(
-   "SRC_URI.mirror",
-   "%s: '%s' found in thirdpartymirrors, use '%s'" 
% (
-   relative_path, mirror, new_uri))
-   return

diff --git a/pym/repoman/modules/scan/mirrors/__init__.py 
b/pym/repoman/modules/scan/mirrors/__init__.py
new file mode 100644
index 000..37dfc53
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Mirrors plug-in module for repoman.
+Performs third party mirrors checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'mirrors',
+   'description': doc,
+   'provides':{
+   'mirrors-module': {
+   'name': "thirdpartymirrors",
+   'class': "ThirdPartyMirrors",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py 
b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
new file mode 100644
index 000..9404e28
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -0,0 +1,59 @@
+# -*- coding:utf-8 -*-
+
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.modules.scan.scanbase import ScanBase
+
+
+class ThirdPartyMirrors(ScanBase):
+
+   def __init__(self, **kwargs):
+   '''Class init
+
+   @param repo_settings: settings instance
+   @param qatracker: QATracker instance
+   '''
+   super(ThirdPartyMirrors, self).__init__(**kwargs)
+   repo_settings = kwargs.get('repo_settings')
+   self.qatracker = kwargs.get('qatracker')
+
+   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
+   self.thirdpartymirrors = {}
+   profile_thirdpartymirrors = 
repo_settings.repoman_settings.thirdpartymirrors().items()
+   for mirror_alias, mirrors in profile_thirdpartymirrors:
+   for mirror in mirrors:
+   if not mirror.endswith("/"):
+   mirror += "/"
+

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

2016-01-10 Thread Brian Dolbec
commit: 940c48cedbd1b24d6a58697d8827327d4b629df2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:37:39 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:34 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=940c48ce

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py   | 23 ++
 .../ebuilds => modules/scan/use}/use_flags.py  | 36 ++
 pym/repoman/scanner.py |  8 ++---
 3 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py 
b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 000..e400719
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'use',
+   'description': doc,
+   'provides':{
+   'use-module': {
+   'name': "use_flags",
+   'class': "USEFlagChecks",
+   'description': doc,
+   'functions': ['check', 'getUsedUseFlags'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py 
b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
'''Performs checks on USE flags listed in the ebuilds and 
metadata.xml'''
 
-   def __init__(self, qatracker, globalUseFlags):
-   '''
+   def __init__(self, **kwargs):
+   '''Class init
+
@param qatracker: QATracker instance
@param globalUseFlags: Global USE flags
'''
-   self.qatracker = qatracker
-   self.globalUseFlags = globalUseFlags
+   super(USEFlagChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
+   self.globalUseFlags = kwargs.get('uselist')
self.useFlags = []
self.defaultUseFlags = []
self.usedUseFlags = set()
 
-   def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+   def check(self, **kwargs):
'''Perform the check.
 
@param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
+   @param xpkg: Package in which we check (string).
@param ebuild: Ebuild which we check (object).
@param y_ebuild: Ebuild which we check (string).
-   @param localUseFlags: Local USE flags of the package
+   @param muselist: Local USE flags of the package
'''
+   pkg = kwargs.get('pkg')
+   package = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   localUseFlags = kwargs.get('muselist')
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
-
-   def getUsedUseFlags(self):
-   '''Get the USE flags that this check has seen'''
-   return self.usedUseFlags
+   used_useflags = 
kwargs.get('used_useflags').union(self.usedUseFlags)
+   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags,
+   'used_useflags': used_useflags}
 
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
"REQUIRED_USE.syntax",
"%s: REQUIRED_USE: %s" % 
(ebuild.relative_path, e))
del e
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7f770c3..0227a93 100644
--- 

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

2016-01-10 Thread Brian Dolbec
commit: 891dd1e6bda1a5368562629c2864ec043ee9ec76
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:35:49 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:32 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=891dd1e6

repoman: Migrate code from _scan_ebuilds to a new EbuildMetadata class and check

 pym/repoman/modules/scan/metadata/__init__.py  | 10 +-
 .../modules/scan/metadata/ebuild_metadata.py   | 39 ++
 pym/repoman/scanner.py | 27 +--
 3 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 7327ec0..eba6565 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -10,7 +10,7 @@ module_spec = {
'name': 'metadata',
'description': doc,
'provides':{
-   'metadata-module': {
+   'pkg-metadata': {
'name': "pkgmetadata",
'class': "PkgMetadata",
'description': doc,
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'ebuild-metadata': {
+   'name': "ebuild_metadata",
+   'class': "EbuildMetadata",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
new file mode 100644
index 000..143a40e
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+
+'''Ebuild Metadata Checks'''
+
+import re
+import sys
+
+if sys.hexversion >= 0x300:
+   basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+class EbuildMetadata(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for k, v in ebuild.metadata.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))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a8aa2f3..6f3fb53 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -5,8 +5,6 @@ from __future__ import print_function, unicode_literals
 import copy
 import io
 import logging
-import re
-import sys
 from itertools import chain
 from pprint import pformat
 
@@ -47,18 +45,10 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
 MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
 
 
-
-if sys.hexversion >= 0x300:
-   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'''
 
@@ -311,7 +301,7 @@ class Scanner(object):
# initialize per ebuild plugin checks here
# need to set it up for ==> self.modules_list or some 
other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
-   ('eapi', 'EAPIChecks')]:
+   ('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata')]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: 
%s", mod_class.__name__)
@@ -338,21 +328,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for k, v in dynamic_data['ebuild'].metadata.items():
-   if not isinstance(v, basestring):
-   continue
-   m = NON_ASCII_RE.search(v)
-

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

2016-01-10 Thread Brian Dolbec
commit: 47e56e141b8d1f09782ed640142ef658e0e312c7
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:08:08 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:39 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=47e56e14

repoman: Delete unused subpkgs

 pym/repoman/checks/ebuilds/variables/__init__.py | 0
 pym/repoman/modules/fix/__init__.py  | 0
 pym/repoman/modules/full/__init__.py | 0
 pym/repoman/modules/manifest/__init__.py | 0
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py 
b/pym/repoman/checks/ebuilds/variables/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/fix/__init__.py 
b/pym/repoman/modules/fix/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/full/__init__.py 
b/pym/repoman/modules/full/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/manifest/__init__.py 
b/pym/repoman/modules/manifest/__init__.py
deleted file mode 100644
index e69de29..000



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

2016-01-10 Thread Brian Dolbec
commit: 07395fe2d7275f6663fd0e936aa2f36fcd3688d4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:09:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:38 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=07395fe2

repoman: Create a new DependUnknown plugin class

 pym/repoman/modules/scan/depend/__init__.py |  8 
 pym/repoman/modules/scan/depend/unknown.py  | 30 +
 pym/repoman/scanner.py  | 10 +-
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..6b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'unknown-module': {
+   'name': "unknown",
+   'class': "DependUnknown",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/unknown.py 
b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
# Options.is_forced() is used to bypass further 
checks
('options', 'Options'), ('profile', 
'ProfileDependsChecks'),
+   ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
-   type_map = {}
-   for mytype, atom in 
dynamic_data['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"
-   % 
(dynamic_data['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 dynamic_data['allvalid']:



[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-10 Thread Brian Dolbec
commit: 6bc227162986a9d79e72a79e1cae393c45bb910f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:03:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:32 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6bc22716

repoman: Migrate eapi.py to the plugin module

 pym/repoman/checks/ebuilds/variables/eapi.py | 44 -
 pym/repoman/modules/scan/eapi/__init__.py| 23 +
 pym/repoman/modules/scan/eapi/eapi.py| 49 
 pym/repoman/scanner.py   |  6 ++--
 4 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py 
b/pym/repoman/checks/ebuilds/variables/eapi.py
deleted file mode 100644
index 2f8b1cb..000
--- a/pym/repoman/checks/ebuilds/variables/eapi.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-'''eapi.py
-Perform checks on the EAPI variable.
-'''
-
-
-class EAPIChecks(object):
-   '''Perform checks on the EAPI variable.'''
-
-   def __init__(self, qatracker, repo_settings):
-   '''
-   @param qatracker: QATracker instance
-   @param repo_settings: Repository settings
-   '''
-   self.qatracker = qatracker
-   self.repo_settings = repo_settings
-
-   def check(self, pkg, ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param ebuild: Ebuild which we check (object).
-   '''
-   eapi = pkg._metadata["EAPI"]
-
-   if not self._checkBanned(ebuild, eapi):
-   self._checkDeprecated(ebuild, eapi)
-
-   def _checkBanned(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_banned(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False
-
-   def _checkDeprecated(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False

diff --git a/pym/repoman/modules/scan/eapi/__init__.py 
b/pym/repoman/modules/scan/eapi/__init__.py
new file mode 100644
index 000..de586a8
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Eapi plug-in module for repoman.
+Performs an IsEbuild check on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'eapi',
+   'description': doc,
+   'provides':{
+   'live-module': {
+   'name': "eapi",
+   'class': "EAPIChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/eapi/eapi.py 
b/pym/repoman/modules/scan/eapi/eapi.py
new file mode 100644
index 000..1190b1a
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -0,0 +1,49 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+   '''Perform checks on the EAPI variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_settings: Repository settings
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_settings = kwargs.get('repo_settings')
+
+   def check(self, **kwargs):
+   '''
+   @param pkg: Package in which we check (object).
+   @param ebuild: Ebuild which we check (object).
+   '''
+   ebuild = kwargs.get('ebuild')
+
+   if not self._checkBanned(ebuild):
+   self._checkDeprecated(ebuild)
+   return {'continue': False}
+
+   def _checkBanned(self, ebuild):
+   if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+   def _checkDeprecated(self, ebuild):
+   if 
self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+

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

2016-01-10 Thread Brian Dolbec
commit: 06dd8b268827accbc089fa198845e57f0a8a21d5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 05:33:17 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:39 2016 +
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 >= 0x300:
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)
  

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

2016-01-10 Thread Brian Dolbec
commit: 35b9fb610626831c008cffbfb5c403c1243b6175
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:23:52 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:37 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=35b9fb61

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 
 pym/repoman/modules/scan/directories/mtime.py| 24 
 pym/repoman/scanner.py   |  5 +
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'mtime-module': {
+   'name': "mtime",
+   'class': "MtimeChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py 
b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+   def __init__(self, **kwargs):
+   self.vcs_settings = kwargs.get('vcs_settings')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   changed = kwargs.get('changed')
+   pkg = kwargs.get('pkg')
+   if not self.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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
+   ('mtime', 'MtimeChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
continue
 
# Syntax Checks
-   if not self.vcs_settings.vcs_preserves_mtime:
-   if dynamic_data['ebuild'].ebuild_path not in 
self.changed.new_ebuilds and \
-   dynamic_data['ebuild'].ebuild_path not 
in self.changed.ebuilds:
-   dynamic_data['pkg'].mtime = None
try:
# All ebuilds should have utf_8 encoding.
f = io.open(



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

2016-01-10 Thread Brian Dolbec
commit: d2bdf2bbd826318819b53b56504ec38fe2f4ac2c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 20:38:11 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:34 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d2bdf2bb

repoman: New DependChecks plugin

Migrate code from _scan_ebuilds to the plugin system

 pym/repoman/modules/scan/depend/__init__.py |  23 +
 pym/repoman/modules/scan/depend/depend.py   | 132 
 pym/repoman/scanner.py  | 119 ++---
 3 files changed, 162 insertions(+), 112 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'depend',
+   'description': doc,
+   'provides':{
+   'depend-module': {
+   'name': "depend",
+   'class': "DependChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+
+   unknown_pkgs = set()
+
+   inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+   "java-pkg-opt-2" in ebuild.inherited,
+   inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+   # operator_tokens = set(["||", "(", ")"])
+   type_list, badsyntax = [], []
+   for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", 
"PROVIDE"):
+   mydepstr = ebuild.metadata[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))
+
+   

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

2016-01-10 Thread Brian Dolbec
commit: ae74454e7cf02e22d55bb0124fe3ccced6ac5792
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 08:46:01 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:34 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ae74454e

repoman: Create RubyEclassChecks class plugin

 pym/repoman/checks/ebuilds/eclasses/__init__.py|  0
 pym/repoman/modules/scan/eclasses/__init__.py  |  8 
 .../{checks/ebuilds => modules/scan}/eclasses/ruby.py  | 18 ++
 pym/repoman/scanner.py |  9 ++---
 4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/eclasses/__init__.py 
b/pym/repoman/checks/ebuilds/eclasses/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/scan/eclasses/__init__.py 
b/pym/repoman/modules/scan/eclasses/__init__.py
index a821f5c..70a6252 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'ruby-module': {
+   'name': "ruby",
+   'class': "RubyEclassChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py 
b/pym/repoman/modules/scan/eclasses/ruby.py
similarity index 62%
rename from pym/repoman/checks/ebuilds/eclasses/ruby.py
rename to pym/repoman/modules/scan/eclasses/ruby.py
index e8d36ea..4dc5d62 100644
--- a/pym/repoman/checks/ebuilds/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -4,19 +4,23 @@ Performs Ruby eclass checks
 '''
 
 from repoman.qa_data import ruby_deprecated
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class RubyEclassChecks(object):
+class RubyEclassChecks(ScanBase):
'''Performs checks for the usage of Ruby eclasses in ebuilds'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   super(RubyEclassChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
 
-   def check(self, pkg, ebuild):
+   def check(self, **kwargs):
+   pkg = kwargs.get('pkg')
+   ebuild = kwargs.get('ebuild')
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -30,3 +34,9 @@ class RubyEclassChecks(object):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": 
Deprecated ruby target: %s")
% myruby)
+   return {'continue': False}
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 0227a93..e6a17cd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -211,7 +210,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -298,7 +296,7 @@ class Scanner(object):
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
-   ('use_flags', 'USEFlagChecks'),
+   ('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
]:
if mod[0]:

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

2016-01-10 Thread Brian Dolbec
commit: 2e37f83673e8da4fd0ce97c49fc23d527abb2589
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Jan  7 01:41:02 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:39 2016 +
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 = '' \
% (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
 



[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/, ...

2016-01-10 Thread Brian Dolbec
commit: b73593a4aa649be2c77a23f04f696522f5eb74b4
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 22:59:36 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b73593a4

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  8 
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/license.py 
b/pym/repoman/checks/ebuilds/variables/license.py
deleted file mode 100644
index bdc859c..000
--- a/pym/repoman/checks/ebuilds/variables/license.py
+++ /dev/null
@@ -1,47 +0,0 @@
-
-'''description.py
-Perform checks on the LICENSE variable.
-'''
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class LicenseChecks(object):
-   '''Perform checks on the LICENSE variable.'''
-
-   def __init__(self, qatracker, liclist, liclist_deprecated):
-   '''
-   @param qatracker: QATracker instance
-   @param liclist: List of licenses.
-   @param liclist: List of deprecated licenses.
-   '''
-   self.qatracker = qatracker
-   self.liclist = liclist
-   self.liclist_deprecated = liclist_deprecated
-
-   def check(
-   self, pkg, package, ebuild, y_ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
-   @param ebuild: Ebuild which we check (object).
-   @param y_ebuild: Ebuild which we check (string).
-   '''
-
-   # Parse the LICENSE variable, remove USE conditions and flatten 
it.
-   licenses = portage.dep.use_reduce(
-   pkg._metadata["LICENSE"], matchall=1, flat=True)
-
-   # Check each entry to ensure that it exists in 
${PORTDIR}/licenses/.
-   for lic in licenses:
-   # Need to check for "||" manually as no portage
-   # function will remove it without removing values.
-   if lic not in self.liclist and lic != "||":
-   self.qatracker.add_error(
-   "LICENSE.invalid",
-   package + "/" + y_ebuild + ".ebuild: 
%s" % lic)
-   elif lic in self.liclist_deprecated:
-   self.qatracker.add_error(
-   "LICENSE.deprecated",
-   "%s: %s" % (ebuild.relative_path, lic))

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 2506521..ed0c59d 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -34,6 +34,14 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'class': "LicenseChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/license.py 
b/pym/repoman/modules/scan/metadata/license.py
new file mode 100644
index 000..b022b20
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -0,0 +1,53 @@
+
+'''license.py
+Perform checks on the LICENSE variable.
+'''
+
+# import our initialized portage instance
+from repoman._portage import portage
+
+
+class LicenseChecks(object):
+   '''Perform checks on the LICENSE variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_metadata: dictionary of various repository items.
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_metadata = kwargs.get('repo_metadata')
+
+   def check(self, **kwargs):
+   '''
+   @param xpkg: Package in which we check (string).
+   @param ebuild: Ebuild which we check (object).
+   @param y_ebuild: Ebuild which we check (string).
+   '''
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   if not kwargs.get('badlicsyntax'):
+   # Parse the LICENSE variable, remove USE conditions and 

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

2016-01-10 Thread Brian Dolbec
commit: ae123d5af1e2c33e22e1d501b252ea9954b384dc
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:56:25 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ae123d5a

repoman: Migrate more metadata checks to ebuild_metadata.py

 .../modules/scan/metadata/ebuild_metadata.py   | 32 --
 pym/repoman/scanner.py | 17 
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
 import re
 import sys
 
+from repoman.qa_data import missingvars
+
 if sys.hexversion >= 0x300:
basestring = str
 
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
 
-   def check(self, **kwargs):
+   def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   return {'continue': False}
+
+   def missing(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for pos, missing_var in enumerate(missingvars):
+   if not ebuild.metadata.get(missing_var):
+   if kwargs.get('catdir') == "virtual" and \
+   missing_var in ("HOMEPAGE", "LICENSE"):
+   continue
+   if kwargs.get('live_ebuild') and missing_var == 
"KEYWORDS":
+   continue
+   myqakey = missingvars[pos] + ".missing"
+   self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+   % (kwargs.get('xpkg'), 
kwargs.get('y_ebuild')))
+   return {'continue': False}
+
+   def old_virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+   return {'continue': False}
 
+   def virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   if kwargs.get('catdir') == "virtual":
+   for var in ("HOMEPAGE", "LICENSE"):
+   if ebuild.metadata.get(var):
+   myqakey = var + ".virtual"
+   self.qatracker.add_error(myqakey, 
ebuild.relative_path)
return {'continue': False}
 
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
 
@property
def runInEbuilds(self):
-   return (True, [self.check])
+   return (True, [self.invalidchar, self.missing, 
self.old_virtual, self.virtual])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for pos, missing_var in enumerate(missingvars):
-   if not 
dynamic_data['ebuild'].metadata.get(missing_var):
-   if dynamic_data['catdir'] == "virtual" 
and \
-   missing_var in ("HOMEPAGE", 
"LICENSE"):
-   continue
-   if dynamic_data['live_ebuild'] and 
missing_var == "KEYWORDS":
-   continue
-   myqakey = missingvars[pos] + ".missing"
-   self.qatracker.add_error(myqakey, xpkg 
+ "/" + y_ebuild + ".ebuild")
-
-   if dynamic_data['catdir'] == "virtual":
-   for var in ("HOMEPAGE", "LICENSE"):
-   if 
dynamic_data['ebuild'].metadata.get(var):
-   myqakey = var + ".virtual"
-   
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if 

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/, ...

2016-01-10 Thread Brian Dolbec
commit: d2f25e7b23d65fa9d11d29d0117e6ef8067383be
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:36:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d2f25e7b

repoman: Migrate DescriptionChecks to the plugin system

 pym/repoman/modules/scan/metadata/__init__.py|  8 
 .../scan/metadata}/description.py| 20 ++--
 pym/repoman/scanner.py   |  5 +
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'description-metadata': {
+   'name': "description",
+   'class': "DescriptionChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/description.py 
b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
 class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, ebuild):
+   def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
-   self._checkTooLong(pkg, ebuild)
-
-   def _checkTooLong(self, pkg, ebuild):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), 
max_desc_len))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.checkTooLong])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 955440e..bb856b8 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks
 from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -216,7 +215,6 @@ class Scanner(object):
# initialize our checks classes here before the big xpkg loop
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
-   self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+   ('description', 'DescriptionChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -347,8 +346,6 @@ class 

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

2016-01-10 Thread Brian Dolbec
commit: afb256c55cadb6c033b3c1721b672bda2b46c46f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 04:44:05 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=afb256c5

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +
 pym/repoman/modules/scan/directories/encoding.py | 41 
 pym/repoman/scanner.py   | 21 +---
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'encoding-module': {
+   'name': "encoding",
+   'class': "EncodingCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py 
b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   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.
+   pass
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b00dbd9..ac77d1f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ 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.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -293,7 +289,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
-   ('mtime', 'MtimeChecks'),
+   ('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -322,21 +318,6 @@ class Scanner(object):
continue
 
# Syntax Checks
-   try:
-   # All ebuilds should have utf_8 encoding.
-   f = io.open(
-   _unicode_encode(
-   
dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-   mode='r', 

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/, ...

2016-01-10 Thread Brian Dolbec
commit: 98db70d4576c0df34e51964ebb164df0a7268fee
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:03:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=98db70d4

repoman: Migrate eapi.py to the plugin module

 pym/repoman/checks/ebuilds/variables/eapi.py | 44 -
 pym/repoman/modules/scan/eapi/__init__.py| 23 +
 pym/repoman/modules/scan/eapi/eapi.py| 49 
 pym/repoman/scanner.py   |  6 ++--
 4 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py 
b/pym/repoman/checks/ebuilds/variables/eapi.py
deleted file mode 100644
index 2f8b1cb..000
--- a/pym/repoman/checks/ebuilds/variables/eapi.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-'''eapi.py
-Perform checks on the EAPI variable.
-'''
-
-
-class EAPIChecks(object):
-   '''Perform checks on the EAPI variable.'''
-
-   def __init__(self, qatracker, repo_settings):
-   '''
-   @param qatracker: QATracker instance
-   @param repo_settings: Repository settings
-   '''
-   self.qatracker = qatracker
-   self.repo_settings = repo_settings
-
-   def check(self, pkg, ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param ebuild: Ebuild which we check (object).
-   '''
-   eapi = pkg._metadata["EAPI"]
-
-   if not self._checkBanned(ebuild, eapi):
-   self._checkDeprecated(ebuild, eapi)
-
-   def _checkBanned(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_banned(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False
-
-   def _checkDeprecated(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False

diff --git a/pym/repoman/modules/scan/eapi/__init__.py 
b/pym/repoman/modules/scan/eapi/__init__.py
new file mode 100644
index 000..de586a8
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Eapi plug-in module for repoman.
+Performs an IsEbuild check on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'eapi',
+   'description': doc,
+   'provides':{
+   'live-module': {
+   'name': "eapi",
+   'class': "EAPIChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/eapi/eapi.py 
b/pym/repoman/modules/scan/eapi/eapi.py
new file mode 100644
index 000..1190b1a
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -0,0 +1,49 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+   '''Perform checks on the EAPI variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_settings: Repository settings
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_settings = kwargs.get('repo_settings')
+
+   def check(self, **kwargs):
+   '''
+   @param pkg: Package in which we check (object).
+   @param ebuild: Ebuild which we check (object).
+   '''
+   ebuild = kwargs.get('ebuild')
+
+   if not self._checkBanned(ebuild):
+   self._checkDeprecated(ebuild)
+   return {'continue': False}
+
+   def _checkBanned(self, ebuild):
+   if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+   def _checkDeprecated(self, ebuild):
+   if 
self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+

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

2016-01-10 Thread Brian Dolbec
commit: ed9f7a5e850c9954ea5cacec332c30807e0cbd6b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:23:52 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed9f7a5e

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 
 pym/repoman/modules/scan/directories/mtime.py| 24 
 pym/repoman/scanner.py   |  5 +
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'mtime-module': {
+   'name': "mtime",
+   'class': "MtimeChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py 
b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+   def __init__(self, **kwargs):
+   self.vcs_settings = kwargs.get('vcs_settings')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   changed = kwargs.get('changed')
+   pkg = kwargs.get('pkg')
+   if not self.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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
+   ('mtime', 'MtimeChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
continue
 
# Syntax Checks
-   if not self.vcs_settings.vcs_preserves_mtime:
-   if dynamic_data['ebuild'].ebuild_path not in 
self.changed.new_ebuilds and \
-   dynamic_data['ebuild'].ebuild_path not 
in self.changed.ebuilds:
-   dynamic_data['pkg'].mtime = None
try:
# All ebuilds should have utf_8 encoding.
f = io.open(



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

2016-01-10 Thread Brian Dolbec
commit: c4a8f9ab920c6e96f1d8c6e5cafa02073e128dc2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:09:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c4a8f9ab

repoman: Create a new DependUnknown plugin class

 pym/repoman/modules/scan/depend/__init__.py |  8 
 pym/repoman/modules/scan/depend/unknown.py  | 30 +
 pym/repoman/scanner.py  | 10 +-
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..6b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'unknown-module': {
+   'name': "unknown",
+   'class': "DependUnknown",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/unknown.py 
b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
# Options.is_forced() is used to bypass further 
checks
('options', 'Options'), ('profile', 
'ProfileDependsChecks'),
+   ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
-   type_map = {}
-   for mytype, atom in 
dynamic_data['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"
-   % 
(dynamic_data['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 dynamic_data['allvalid']:



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

2016-01-10 Thread Brian Dolbec
commit: e229d734c6d01dc6f74ca64d24d32827506eda2b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:33:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e229d734

repoman: Move ebuild_archs to the Ebuild class

 pym/repoman/modules/scan/ebuild/ebuild.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py 
b/pym/repoman/modules/scan/ebuild/ebuild.py
index 62c9e52..7362ff7 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -35,6 +35,7 @@ class Ebuild(ScanBase):
self.eapi = None
self.inherited = None
self.keywords = None
+   self.archs = None
 
def _set_paths(self, **kwargs):
repolevel = kwargs.get('repolevel')



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

2016-01-10 Thread Brian Dolbec
commit: 928fe92aaacdb806743c3815cf15ab60f767adbe
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:37:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=928fe92a

repoman: Create a metadata UnusedCheck and final pkg checks

Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml

 pym/repoman/modules/scan/metadata/__init__.py |  8 ++
 pym/repoman/modules/scan/metadata/unused.py   | 32 
 pym/repoman/scanner.py| 36 ---
 3 files changed, 67 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+   'unused-metadata': {
+   'name': "unused",
+   'class': "UnusedCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/unused.py 
b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   muselist = kwargs.get('muselist')
+   used_useflags = kwargs.get('used_useflags')
+   # check if there are unused local USE-descriptions in 
metadata.xml
+   # (unless there are any invalids, to avoid noise)
+   if kwargs.get('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 {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (False, [])
+
+   @property
+   def runInFinal(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 89eaa57..50dd259 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
 
 
def _scan_ebuilds(self, ebuildlist, dynamic_data):
-   xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
 
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   # 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(dynamic_data['used_useflags']):
-   self.qatracker.add_error(
-   "metadata.warning",
-   "%s/metadata.xml: unused local 
USE-description: '%s'"
-   % (xpkg, myflag))
+   # Final checks
+   # initialize per pkg plugin final checks here
+   # need to set it up for ==> self.modules_list or some other 
ordered list
+   xpkg_complete = False
+   for mod in [('unused', 'UnusedChecks')]:
+   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 final checks: module:", mod[1])
+   do_it, functions = self.modules[mod[1]].runInFinal
+   # print("do_it", do_it, "functions", functions)
+   if do_it:
+   for func in functions:
+   print("\tRunning function:", func)
+   rdata = func(**dynamic_data)
+   if 

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

2016-01-10 Thread Brian Dolbec
commit: 76e5b13788076339bbf816ba876602cf5fbf64d9
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=76e5b137

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  8 
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/license.py 
b/pym/repoman/checks/ebuilds/variables/license.py
deleted file mode 100644
index bdc859c..000
--- a/pym/repoman/checks/ebuilds/variables/license.py
+++ /dev/null
@@ -1,47 +0,0 @@
-
-'''description.py
-Perform checks on the LICENSE variable.
-'''
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class LicenseChecks(object):
-   '''Perform checks on the LICENSE variable.'''
-
-   def __init__(self, qatracker, liclist, liclist_deprecated):
-   '''
-   @param qatracker: QATracker instance
-   @param liclist: List of licenses.
-   @param liclist: List of deprecated licenses.
-   '''
-   self.qatracker = qatracker
-   self.liclist = liclist
-   self.liclist_deprecated = liclist_deprecated
-
-   def check(
-   self, pkg, package, ebuild, y_ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
-   @param ebuild: Ebuild which we check (object).
-   @param y_ebuild: Ebuild which we check (string).
-   '''
-
-   # Parse the LICENSE variable, remove USE conditions and flatten 
it.
-   licenses = portage.dep.use_reduce(
-   pkg._metadata["LICENSE"], matchall=1, flat=True)
-
-   # Check each entry to ensure that it exists in 
${PORTDIR}/licenses/.
-   for lic in licenses:
-   # Need to check for "||" manually as no portage
-   # function will remove it without removing values.
-   if lic not in self.liclist and lic != "||":
-   self.qatracker.add_error(
-   "LICENSE.invalid",
-   package + "/" + y_ebuild + ".ebuild: 
%s" % lic)
-   elif lic in self.liclist_deprecated:
-   self.qatracker.add_error(
-   "LICENSE.deprecated",
-   "%s: %s" % (ebuild.relative_path, lic))

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 2506521..ed0c59d 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -34,6 +34,14 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'class': "LicenseChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/license.py 
b/pym/repoman/modules/scan/metadata/license.py
new file mode 100644
index 000..b022b20
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -0,0 +1,53 @@
+
+'''license.py
+Perform checks on the LICENSE variable.
+'''
+
+# import our initialized portage instance
+from repoman._portage import portage
+
+
+class LicenseChecks(object):
+   '''Perform checks on the LICENSE variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_metadata: dictionary of various repository items.
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_metadata = kwargs.get('repo_metadata')
+
+   def check(self, **kwargs):
+   '''
+   @param xpkg: Package in which we check (string).
+   @param ebuild: Ebuild which we check (object).
+   @param y_ebuild: Ebuild which we check (string).
+   '''
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   if not kwargs.get('badlicsyntax'):
+   # Parse the LICENSE variable, remove USE conditions and 

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

2016-01-10 Thread Brian Dolbec
commit: 9404bbfa1a596a93f37fd29bb8ee559358e10d12
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:55:55 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9404bbfa

repoman: Create a new Options class plugin

This handles an options.force bypass using the is_forced() from withing the 
plugin system.

 pym/repoman/modules/scan/options/__init__.py | 23 +++
 pym/repoman/modules/scan/options/options.py  | 22 ++
 pym/repoman/scanner.py   | 10 ++
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/pym/repoman/modules/scan/options/__init__.py 
b/pym/repoman/modules/scan/options/__init__.py
new file mode 100644
index 000..8424058
--- /dev/null
+++ b/pym/repoman/modules/scan/options/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Options plug-in module for repoman.
+Performs option related actions on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'options',
+   'description': doc,
+   'provides':{
+   'options-module': {
+   'name': "options",
+   'class': "Options",
+   'description': doc,
+   'functions': ['is_forced'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/options/options.py 
b/pym/repoman/modules/scan/options/options.py
new file mode 100644
index 000..b592884
--- /dev/null
+++ b/pym/repoman/modules/scan/options/options.py
@@ -0,0 +1,22 @@
+
+
+class Options(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+
+   def is_forced(self, **kwargs):
+   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.
+   return {'continue': True}
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.is_forced])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ac77d1f..a047237 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -290,6 +290,8 @@ class Scanner(object):
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
+   # Options.is_forced() is used to bypass further 
checks
+   ('options', 'Options'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -317,14 +319,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   # Syntax Checks
-
-   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 dynamic_data['arches']:
if arch not in self.profiles:



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

2016-01-10 Thread Brian Dolbec
commit: 4eade71285b32b32f4ee590ae74cbba2f68c116a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Jan  7 01:41:02 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
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 = '' \
% (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
 



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

2016-01-10 Thread Brian Dolbec
commit: f1546d59102e763ad74097401ab68e3c996d250e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:35:49 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f1546d59

repoman: Migrate code from _scan_ebuilds to a new EbuildMetadata class and check

 pym/repoman/modules/scan/metadata/__init__.py  | 10 +-
 .../modules/scan/metadata/ebuild_metadata.py   | 39 ++
 pym/repoman/scanner.py | 27 +--
 3 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 7327ec0..eba6565 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -10,7 +10,7 @@ module_spec = {
'name': 'metadata',
'description': doc,
'provides':{
-   'metadata-module': {
+   'pkg-metadata': {
'name': "pkgmetadata",
'class': "PkgMetadata",
'description': doc,
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'ebuild-metadata': {
+   'name': "ebuild_metadata",
+   'class': "EbuildMetadata",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
new file mode 100644
index 000..143a40e
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+
+'''Ebuild Metadata Checks'''
+
+import re
+import sys
+
+if sys.hexversion >= 0x300:
+   basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+class EbuildMetadata(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for k, v in ebuild.metadata.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))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a8aa2f3..6f3fb53 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -5,8 +5,6 @@ from __future__ import print_function, unicode_literals
 import copy
 import io
 import logging
-import re
-import sys
 from itertools import chain
 from pprint import pformat
 
@@ -47,18 +45,10 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
 MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
 
 
-
-if sys.hexversion >= 0x300:
-   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'''
 
@@ -311,7 +301,7 @@ class Scanner(object):
# initialize per ebuild plugin checks here
# need to set it up for ==> self.modules_list or some 
other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
-   ('eapi', 'EAPIChecks')]:
+   ('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata')]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: 
%s", mod_class.__name__)
@@ -338,21 +328,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for k, v in dynamic_data['ebuild'].metadata.items():
-   if not isinstance(v, basestring):
-   continue
-   m = NON_ASCII_RE.search(v)
-

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

2016-01-10 Thread Brian Dolbec
commit: cece35a90acbbf960ee93893038cccb1a36a9c11
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:31:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cece35a9

scanner.py: Migrate another metadata check to ebuild_metadata

 pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
 pym/repoman/scanner.py   | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   if ebuild.metadata.get("PROVIDE"):
+   self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+
return {'continue': False}
 
@property

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if dynamic_data['ebuild'].metadata.get("PROVIDE"):
-   self.qatracker.add_error("virtual.oldstyle", 
dynamic_data['ebuild'].relative_path)
 
for pos, missing_var in enumerate(missingvars):
if not 
dynamic_data['ebuild'].metadata.get(missing_var):



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

2016-01-10 Thread Brian Dolbec
commit: 6cd0ec7dfe6cea518416561188b8e3ed6cb4cfa0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:57:36 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6cd0ec7d

repoman: Move the large depency checks loop to a new plugin 
ProfileDependsChecks class

 pym/repoman/modules/scan/depend/__init__.py |   8 ++
 pym/repoman/modules/scan/depend/profile.py  | 211 
 pym/repoman/repos.py|   1 +
 pym/repoman/scanner.py  | 181 +---
 4 files changed, 227 insertions(+), 174 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'profile-module': {
+   'name': "profile",
+   'class': "ProfileDependsChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/profile.py 
b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+   return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+   self.profiles = kwargs.get('profiles')
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.include_arches = kwargs.get('include_arches')
+   self.caches = kwargs.get('caches')
+   self.repoman_incrementals = kwargs.get('repoman_incrementals')
+   self.env = kwargs.get('env')
+   self.have = kwargs.get('have')
+   self.dev_keywords = kwargs.get('dev_keywords')
+
+   def check(self, **kwargs):
+   arches = kwargs.get('arches')
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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.repo_settings.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 

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

2016-01-10 Thread Brian Dolbec
commit: f283abcf58d478cb0f8ece9d2d6cf02ce386012a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 18:28:58 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f283abcf

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ---
 pym/repoman/scanner.py|  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py 
b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
super(KeywordChecks, self).__init__(**kwargs)
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
+   self.repo_metadata = kwargs.get('repo_metadata')
+   self.profiles = kwargs.get('profiles')
self.slot_keywords = {}
 
def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
live_ebuild = kwargs.get('live_ebuild')
if not self.options.straight_to_stable:
self._checkAddedWithStableKeywords(
-   package, ebuild, y_ebuild, keywords, changed)
+   xpkg, ebuild, y_ebuild, ebuild.keywords, 
changed)
 
-   self._checkForDroppedKeywords(
-   pkg, ebuild, ebuild_archs, live_ebuild)
+   self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, 
live_ebuild)
 
-   self._checkForInvalidKeywords(
-   pkg, package, y_ebuild, kwlist, profiles)
+   self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-   self._checkForMaskLikeKeywords(
-   package, y_ebuild, keywords, kwlist)
+   self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-   self.slot_keywords[pkg.slot].update(ebuild_archs)
+   self.slot_keywords[pkg.slot].update(ebuild.archs)
return {'continue': False}
 
-   def _isKeywordStable(self, keyword):
+   @staticmethod
+   def _isKeywordStable(keyword):
return not keyword.startswith("~") and not 
keyword.startswith("-")
 
def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
ebuild.relative_path,
" 
".join(sorted(dropped_keywords
 
-   def _checkForInvalidKeywords(
-   self, pkg, package, y_ebuild, kwlist, profiles):
-   myuse = pkg._metadata["KEYWORDS"].split()
+   def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+   myuse = ebuild.keywords
 
for mykey in myuse:
if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
if not self._isKeywordStable(myskey[:1]):
myskey = myskey[1:]
 
-   if myskey not in kwlist:
+   if myskey not in self.repo_metadata['kwlist']:
+   
self.qatracker.add_error("KEYWORDS.invalid",
+   "%s/%s.ebuild: %s" % (xpkg, 
y_ebuild, mykey))
+   elif myskey not in self.profiles:
self.qatracker.add_error(
"KEYWORDS.invalid",
-   "%s/%s.ebuild: %s" % (
-   package, y_ebuild, 
mykey))
-   elif myskey not in profiles:
-   self.qatracker.add_error(
-   "KEYWORDS.invalid",
-   "%s/%s.ebuild: %s (profile 
invalid)" % (
-   package, y_ebuild, 
mykey))
-
-   def _checkForMaskLikeKeywords(
-   self, package, y_ebuild, keywords, kwlist):
+   "%s/%s.ebuild: %s (profile 
invalid)"
+   % (xpkg, y_ebuild, 
mykey))
 
+   def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
# KEYWORDS="-*" is a stupid replacement for package.mask
# and screws general KEYWORDS semantics
if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
for kw in keywords:
   

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

2016-01-10 Thread Brian Dolbec
commit: 4d9b1d6fc00b48583bec7439b548cd29530c518b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 19:11:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d9b1d6f

repoman: Create a new ArchChecks class plugin

 pym/repoman/modules/scan/arches/__init__.py | 23 +++
 pym/repoman/modules/scan/arches/arches.py   | 64 +
 pym/repoman/scanner.py  | 47 +
 3 files changed, 89 insertions(+), 45 deletions(-)

diff --git a/pym/repoman/modules/scan/arches/__init__.py 
b/pym/repoman/modules/scan/arches/__init__.py
new file mode 100644
index 000..b570dac
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Arches plug-in module for repoman.
+Performs archs checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'arches',
+   'description': doc,
+   'provides':{
+   'archs-module': {
+   'name': "arches",
+   'class': "ArchChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/arches/arches.py 
b/pym/repoman/modules/scan/arches/arches.py
new file mode 100644
index 000..2c32028
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/arches.py
@@ -0,0 +1,64 @@
+# -*- coding:utf-8 -*-
+
+
+class ArchChecks(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.profiles = kwargs.get('profiles')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   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 ebuild.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:
+   # For ebuilds with stable keywords, 
check if the
+   # dependencies are satisfiable for 
unstable
+   # configurations, since use.stable.mask 
is not
+   # applied for unstable configurations 
(see bug
+   # 563546).
+   if keyword == "*":
+   for expanded_arch in 
self.profiles:
+   if expanded_arch == 
"**":
+   continue
+   arches.add(
+   (keyword, 
expanded_arch, (expanded_arch,)))
+   arches.add(
+   (keyword, 
expanded_arch,
+   
(expanded_arch, "~" + expanded_arch)))
+   else:
+   arches.add((keyword, keyword, 
(keyword,)))
+   arches.add((keyword, keyword,
+   (keyword, "~" + 
keyword)))
+   if not arches:
+   # Use an empty profile for checking 
dependencies of
+  

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/modules/manifest/, ...

2016-01-10 Thread Brian Dolbec
commit: b65b0e172847648afc9be49bab7658bb869ab08f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:08:08 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b65b0e17

repoman: Delete unused subpkgs

 pym/repoman/checks/ebuilds/variables/__init__.py | 0
 pym/repoman/modules/fix/__init__.py  | 0
 pym/repoman/modules/full/__init__.py | 0
 pym/repoman/modules/manifest/__init__.py | 0
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py 
b/pym/repoman/checks/ebuilds/variables/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/fix/__init__.py 
b/pym/repoman/modules/fix/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/full/__init__.py 
b/pym/repoman/modules/full/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/manifest/__init__.py 
b/pym/repoman/modules/manifest/__init__.py
deleted file mode 100644
index e69de29..000



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

2016-01-10 Thread Brian Dolbec
commit: 36952e7f42d5aa84d58b41c6fb99d94a9876af28
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 20:38:11 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=36952e7f

repoman: New DependChecks plugin

Migrate code from _scan_ebuilds to the plugin system

 pym/repoman/modules/scan/depend/__init__.py |  23 +
 pym/repoman/modules/scan/depend/depend.py   | 132 
 pym/repoman/scanner.py  | 119 ++---
 3 files changed, 162 insertions(+), 112 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'depend',
+   'description': doc,
+   'provides':{
+   'depend-module': {
+   'name': "depend",
+   'class': "DependChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+
+   unknown_pkgs = set()
+
+   inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+   "java-pkg-opt-2" in ebuild.inherited,
+   inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+   # operator_tokens = set(["||", "(", ")"])
+   type_list, badsyntax = [], []
+   for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", 
"PROVIDE"):
+   mydepstr = ebuild.metadata[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))
+
+   

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

2016-01-10 Thread Brian Dolbec
commit: bb0cafd73c2bb39f45929d15354ef29cebb262c6
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 05:33:17 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
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 >= 0x300:
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)
  

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

2016-01-10 Thread Brian Dolbec
commit: c3afb59b2903b7c6eab14b675657e308bb618243
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:29:42 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c3afb59b

repoman: Create the ThirdPartyMirrors class plugin

 pym/repoman/checks/ebuilds/thirdpartymirrors.py| 39 --
 pym/repoman/modules/scan/mirrors/__init__.py   | 23 +
 .../modules/scan/mirrors/thirdpartymirrors.py  | 59 ++
 pym/repoman/scanner.py |  6 +--
 4 files changed, 85 insertions(+), 42 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py 
b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
deleted file mode 100644
index 848dfb9..000
--- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding:utf-8 -*-
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class ThirdPartyMirrors(object):
-
-   def __init__(self, repoman_settings, qatracker):
-   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
-   self.thirdpartymirrors = {}
-   profile_thirdpartymirrors = 
repoman_settings.thirdpartymirrors().items()
-   for mirror_alias, mirrors in profile_thirdpartymirrors:
-   for mirror in mirrors:
-   if not mirror.endswith("/"):
-   mirror += "/"
-   self.thirdpartymirrors[mirror] = mirror_alias
-
-   self.qatracker = qatracker
-
-   def check(self, myaux, relative_path):
-   # Check that URIs don't reference a server from 
thirdpartymirrors.
-   for uri in portage.dep.use_reduce(
-   myaux["SRC_URI"], matchall=True, is_src_uri=True,
-   eapi=myaux["EAPI"], flat=True):
-   contains_mirror = False
-   for mirror, mirror_alias in 
self.thirdpartymirrors.items():
-   if uri.startswith(mirror):
-   contains_mirror = True
-   break
-   if not contains_mirror:
-   continue
-
-   new_uri = "mirror://%s/%s" % (mirror_alias, 
uri[len(mirror):])
-   self.qatracker.add_error(
-   "SRC_URI.mirror",
-   "%s: '%s' found in thirdpartymirrors, use '%s'" 
% (
-   relative_path, mirror, new_uri))
-   return

diff --git a/pym/repoman/modules/scan/mirrors/__init__.py 
b/pym/repoman/modules/scan/mirrors/__init__.py
new file mode 100644
index 000..37dfc53
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Mirrors plug-in module for repoman.
+Performs third party mirrors checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'mirrors',
+   'description': doc,
+   'provides':{
+   'mirrors-module': {
+   'name': "thirdpartymirrors",
+   'class': "ThirdPartyMirrors",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py 
b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
new file mode 100644
index 000..9404e28
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -0,0 +1,59 @@
+# -*- coding:utf-8 -*-
+
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.modules.scan.scanbase import ScanBase
+
+
+class ThirdPartyMirrors(ScanBase):
+
+   def __init__(self, **kwargs):
+   '''Class init
+
+   @param repo_settings: settings instance
+   @param qatracker: QATracker instance
+   '''
+   super(ThirdPartyMirrors, self).__init__(**kwargs)
+   repo_settings = kwargs.get('repo_settings')
+   self.qatracker = kwargs.get('qatracker')
+
+   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
+   self.thirdpartymirrors = {}
+   profile_thirdpartymirrors = 
repo_settings.repoman_settings.thirdpartymirrors().items()
+   for mirror_alias, mirrors in profile_thirdpartymirrors:
+   for mirror in mirrors:
+   if not mirror.endswith("/"):
+   mirror += "/"
+

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

2016-01-10 Thread Brian Dolbec
commit: c2b721b6a84ddf819e6bc12f697bbe1049beb1f5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 08:46:01 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2b721b6

repoman: Create RubyEclassChecks class plugin

 pym/repoman/checks/ebuilds/eclasses/__init__.py|  0
 pym/repoman/modules/scan/eclasses/__init__.py  |  8 
 .../{checks/ebuilds => modules/scan}/eclasses/ruby.py  | 18 ++
 pym/repoman/scanner.py |  9 ++---
 4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/eclasses/__init__.py 
b/pym/repoman/checks/ebuilds/eclasses/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/scan/eclasses/__init__.py 
b/pym/repoman/modules/scan/eclasses/__init__.py
index a821f5c..70a6252 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'ruby-module': {
+   'name': "ruby",
+   'class': "RubyEclassChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py 
b/pym/repoman/modules/scan/eclasses/ruby.py
similarity index 62%
rename from pym/repoman/checks/ebuilds/eclasses/ruby.py
rename to pym/repoman/modules/scan/eclasses/ruby.py
index e8d36ea..4dc5d62 100644
--- a/pym/repoman/checks/ebuilds/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -4,19 +4,23 @@ Performs Ruby eclass checks
 '''
 
 from repoman.qa_data import ruby_deprecated
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class RubyEclassChecks(object):
+class RubyEclassChecks(ScanBase):
'''Performs checks for the usage of Ruby eclasses in ebuilds'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   super(RubyEclassChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
 
-   def check(self, pkg, ebuild):
+   def check(self, **kwargs):
+   pkg = kwargs.get('pkg')
+   ebuild = kwargs.get('ebuild')
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -30,3 +34,9 @@ class RubyEclassChecks(object):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": 
Deprecated ruby target: %s")
% myruby)
+   return {'continue': False}
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 0227a93..e6a17cd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -211,7 +210,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -298,7 +296,7 @@ class Scanner(object):
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
-   ('use_flags', 'USEFlagChecks'),
+   ('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
]:
if mod[0]:

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

2016-01-10 Thread Brian Dolbec
commit: b014aa2a3c56bd03e82e795f6064f3a7ba81c5e8
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:55:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
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'"



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

2016-01-10 Thread Brian Dolbec
commit: 3942a053d591d077ed1fc69cbf44ee14d1ada7a0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:19:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3942a053

repoman: Migrate some additional Dependency code to the plugin

 pym/repoman/modules/scan/depend/depend.py | 13 -
 pym/repoman/scanner.py| 22 +++---
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
 
 from _emerge.Package import Package
 
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, 
b))
-   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list}
+
+   # data required for some other tests
+   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
+
+   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list,
+   'badlicsyntax': badlicsyntax, 'baddepsyntax': 
baddepsyntax}
 
@property
def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if dynamic_data['live_ebuild'] and 
self.repo_settings.repo_config.name == "gentoo":
-   self.liveeclasscheck.check(
-   dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, 
self.repo_metadata['pmaskdict'])
-
-   unknown_pkgs = set()
-   baddepsyntax = False
-   badlicsyntax = False
-   badprovsyntax = False
-   # catpkg = catdir + "/" + y_ebuild
-
-   badlicsyntax = len([z for z in 
dynamic_data['type_list'] if z == "LICENSE"])
-   badprovsyntax = len([z for z in 
dynamic_data['type_list'] if z == "PROVIDE"])
-   baddepsyntax = len(dynamic_data['type_list']) != 
badlicsyntax + badprovsyntax
-   badlicsyntax = badlicsyntax > 0
-   badprovsyntax = badprovsyntax > 0
-
used_useflags = 
used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
 
# license checks
-   if not badlicsyntax:
+   if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], 
xpkg, dynamic_data['ebuild'], y_ebuild)
 
self.restrictcheck.check(dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = 
dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], 
stable=dep_settings._parent_stable)
 
-   if not baddepsyntax:
+   if not dynamic_data['baddepsyntax']:
ismasked = not 
dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in 
self.portdb.xmatch("match-visible",
Atom("%s::%s" % 
(dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% 
(dynamic_data['ebuild'].relative_path, mytype, keyword,

prof, pformat(atoms, indent=6)))
 
-   if not baddepsyntax and dynamic_data['unknown_pkgs']:
+   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in 
dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, 
set()).add(atom)



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

2016-01-10 Thread Brian Dolbec
commit: 50b8e2d62f8e6312706e51f55e72720637a31d74
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:10:48 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=50b8e2d6

repoman: Migrate RestrictChecks to a plugin module

 pym/repoman/modules/scan/metadata/__init__.py  |  8 ++
 .../scan/metadata}/restrict.py | 29 +++---
 pym/repoman/scanner.py |  7 +-
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index ed0c59d..6ab44f6 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -42,6 +42,14 @@ module_spec = {
'func_desc': {
},
},
+   'restrict-metadata': {
+   'name': "restrict",
+   'class': "RestrictChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py 
b/pym/repoman/modules/scan/metadata/restrict.py
similarity index 54%
rename from pym/repoman/checks/ebuilds/variables/restrict.py
rename to pym/repoman/modules/scan/metadata/restrict.py
index 215b792..93ca298 100644
--- a/pym/repoman/checks/ebuilds/variables/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict
 class RestrictChecks(object):
'''Perform checks on the RESTRICT variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, package, ebuild, y_ebuild):
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
 
try:
myrestrict = portage.dep.use_reduce(
-   pkg._metadata["RESTRICT"], matchall=1, 
flat=True)
+   ebuild.metadata["RESTRICT"], matchall=1, 
flat=True)
except portage.exception.InvalidDependString as e:
-   self. qatracker.add_error(
-   "RESTRICT.syntax",
+   self.qatracker.add_error("RESTRICT.syntax",
"%s: RESTRICT: %s" % (ebuild.relative_path, e))
del e
 
@@ -36,6 +38,15 @@ class RestrictChecks(object):
 
if mybadrestrict:
for mybad in mybadrestrict:
-   self.qatracker.add_error(
-   "RESTRICT.invalid",
-   package + "/" + y_ebuild + 
".ebuild: %s" % mybad)
+   
self.qatracker.add_error("RESTRICT.invalid",
+   "%s/%s.ebuild: %s" % (xpkg, 
y_ebuild, mybad))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])
+

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f792bd..8657c73 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -209,8 +208,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.restrictcheck = RestrictChecks(self.qatracker)
-
 
def scan_pkgs(self, can_force):
dynamic_data = {'can_force': can_force}
@@ -295,7 +292,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 

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

2016-01-10 Thread Brian Dolbec
commit: 2689ab447435d6432c18d454af8f7e0b83f79f85
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:37:39 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 20:15:08 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2689ab44

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py   | 23 ++
 .../ebuilds => modules/scan/use}/use_flags.py  | 36 ++
 pym/repoman/scanner.py |  8 ++---
 3 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py 
b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 000..e400719
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'use',
+   'description': doc,
+   'provides':{
+   'use-module': {
+   'name': "use_flags",
+   'class': "USEFlagChecks",
+   'description': doc,
+   'functions': ['check', 'getUsedUseFlags'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py 
b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
'''Performs checks on USE flags listed in the ebuilds and 
metadata.xml'''
 
-   def __init__(self, qatracker, globalUseFlags):
-   '''
+   def __init__(self, **kwargs):
+   '''Class init
+
@param qatracker: QATracker instance
@param globalUseFlags: Global USE flags
'''
-   self.qatracker = qatracker
-   self.globalUseFlags = globalUseFlags
+   super(USEFlagChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
+   self.globalUseFlags = kwargs.get('uselist')
self.useFlags = []
self.defaultUseFlags = []
self.usedUseFlags = set()
 
-   def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+   def check(self, **kwargs):
'''Perform the check.
 
@param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
+   @param xpkg: Package in which we check (string).
@param ebuild: Ebuild which we check (object).
@param y_ebuild: Ebuild which we check (string).
-   @param localUseFlags: Local USE flags of the package
+   @param muselist: Local USE flags of the package
'''
+   pkg = kwargs.get('pkg')
+   package = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   localUseFlags = kwargs.get('muselist')
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
-
-   def getUsedUseFlags(self):
-   '''Get the USE flags that this check has seen'''
-   return self.usedUseFlags
+   used_useflags = 
kwargs.get('used_useflags').union(self.usedUseFlags)
+   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags,
+   'used_useflags': used_useflags}
 
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
"REQUIRED_USE.syntax",
"%s: REQUIRED_USE: %s" % 
(ebuild.relative_path, e))
del e
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7f770c3..0227a93 100644
--- 

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

2016-01-09 Thread Brian Dolbec
commit: a4a0bd1b60818e3099ef835324d13e93c1d7de37
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:57:36 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:52 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a4a0bd1b

repoman: Move the large depency checks loop to a new plugin 
ProfileDependsChecks class

 pym/repoman/modules/scan/depend/__init__.py |   8 ++
 pym/repoman/modules/scan/depend/profile.py  | 211 
 pym/repoman/repos.py|   1 +
 pym/repoman/scanner.py  | 181 +---
 4 files changed, 227 insertions(+), 174 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'profile-module': {
+   'name': "profile",
+   'class': "ProfileDependsChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/profile.py 
b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+   return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+   self.profiles = kwargs.get('profiles')
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.include_arches = kwargs.get('include_arches')
+   self.caches = kwargs.get('caches')
+   self.repoman_incrementals = kwargs.get('repoman_incrementals')
+   self.env = kwargs.get('env')
+   self.have = kwargs.get('have')
+   self.dev_keywords = kwargs.get('dev_keywords')
+
+   def check(self, **kwargs):
+   arches = kwargs.get('arches')
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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.repo_settings.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 

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

2016-01-09 Thread Brian Dolbec
commit: f2e20a96e9f1d9073bb6c8722170667ba96915a0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:35:49 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:49 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f2e20a96

repoman: Migrate code from _scan_ebuilds to a new EbuildMetadata class and check

 pym/repoman/modules/scan/metadata/__init__.py  | 10 +-
 .../modules/scan/metadata/ebuild_metadata.py   | 39 ++
 pym/repoman/scanner.py | 27 +--
 3 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 7327ec0..eba6565 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -10,7 +10,7 @@ module_spec = {
'name': 'metadata',
'description': doc,
'provides':{
-   'metadata-module': {
+   'pkg-metadata': {
'name': "pkgmetadata",
'class': "PkgMetadata",
'description': doc,
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'ebuild-metadata': {
+   'name': "ebuild_metadata",
+   'class': "EbuildMetadata",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
new file mode 100644
index 000..143a40e
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+
+'''Ebuild Metadata Checks'''
+
+import re
+import sys
+
+if sys.hexversion >= 0x300:
+   basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+class EbuildMetadata(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for k, v in ebuild.metadata.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))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a8aa2f3..6f3fb53 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -5,8 +5,6 @@ from __future__ import print_function, unicode_literals
 import copy
 import io
 import logging
-import re
-import sys
 from itertools import chain
 from pprint import pformat
 
@@ -47,18 +45,10 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, 
namepath="repoman.modules.scan")
 MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
 
 
-
-if sys.hexversion >= 0x300:
-   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'''
 
@@ -311,7 +301,7 @@ class Scanner(object):
# initialize per ebuild plugin checks here
# need to set it up for ==> self.modules_list or some 
other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
-   ('eapi', 'EAPIChecks')]:
+   ('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata')]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: 
%s", mod_class.__name__)
@@ -338,21 +328,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for k, v in dynamic_data['ebuild'].metadata.items():
-   if not isinstance(v, basestring):
-   continue
-   m = NON_ASCII_RE.search(v)
-

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-09 Thread Brian Dolbec
commit: 2e358284573f56c6b5b67a736e38852fc55f55a7
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:36:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:49 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e358284

repoman: Migrate DescriptionChecks to the plugin system

 pym/repoman/modules/scan/metadata/__init__.py|  8 
 .../scan/metadata}/description.py| 20 ++--
 pym/repoman/scanner.py   |  5 +
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'description-metadata': {
+   'name': "description",
+   'class': "DescriptionChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/description.py 
b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
 class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, ebuild):
+   def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
-   self._checkTooLong(pkg, ebuild)
-
-   def _checkTooLong(self, pkg, ebuild):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), 
max_desc_len))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.checkTooLong])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 955440e..bb856b8 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks
 from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -216,7 +215,6 @@ class Scanner(object):
# initialize our checks classes here before the big xpkg loop
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
-   self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+   ('description', 'DescriptionChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -347,8 +346,6 @@ class 

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

2016-01-09 Thread Brian Dolbec
commit: 9ac49c16de562debc7ecd6f7155fef20cc320803
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 05:33:17 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:53 2016 +
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 >= 0x300:
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)
  

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

2016-01-09 Thread Brian Dolbec
commit: cf6693c8e27b4b540076821d97c6dadaea697e76
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 20:38:11 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:50 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cf6693c8

repoman: New DependChecks plugin

Migrate code from _scan_ebuilds to the plugin system

 pym/repoman/modules/scan/depend/__init__.py |  23 +
 pym/repoman/modules/scan/depend/depend.py   | 132 
 pym/repoman/scanner.py  | 119 ++---
 3 files changed, 162 insertions(+), 112 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'depend',
+   'description': doc,
+   'provides':{
+   'depend-module': {
+   'name': "depend",
+   'class': "DependChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+
+   unknown_pkgs = set()
+
+   inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+   "java-pkg-opt-2" in ebuild.inherited,
+   inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+   # operator_tokens = set(["||", "(", ")"])
+   type_list, badsyntax = [], []
+   for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", 
"PROVIDE"):
+   mydepstr = ebuild.metadata[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))
+
+   

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

2016-01-09 Thread Brian Dolbec
commit: 2df2c8204bcb6f54b3cbc7f22951fdcb897ac34f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:31:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:50 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2df2c820

scanner.py: Migrate another metadata check to ebuild_metadata

 pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
 pym/repoman/scanner.py   | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   if ebuild.metadata.get("PROVIDE"):
+   self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+
return {'continue': False}
 
@property

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if dynamic_data['ebuild'].metadata.get("PROVIDE"):
-   self.qatracker.add_error("virtual.oldstyle", 
dynamic_data['ebuild'].relative_path)
 
for pos, missing_var in enumerate(missingvars):
if not 
dynamic_data['ebuild'].metadata.get(missing_var):



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

2016-01-09 Thread Brian Dolbec
commit: 0d13a8f7aab7206aae4a5e13dbe99ddaee8e69ba
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 19:11:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:49 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0d13a8f7

repoman: Create a new ArchChecks class plugin

 pym/repoman/modules/scan/arches/__init__.py | 23 +++
 pym/repoman/modules/scan/arches/arches.py   | 64 +
 pym/repoman/scanner.py  | 47 +
 3 files changed, 89 insertions(+), 45 deletions(-)

diff --git a/pym/repoman/modules/scan/arches/__init__.py 
b/pym/repoman/modules/scan/arches/__init__.py
new file mode 100644
index 000..b570dac
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Arches plug-in module for repoman.
+Performs archs checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'arches',
+   'description': doc,
+   'provides':{
+   'archs-module': {
+   'name': "arches",
+   'class': "ArchChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/arches/arches.py 
b/pym/repoman/modules/scan/arches/arches.py
new file mode 100644
index 000..2c32028
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/arches.py
@@ -0,0 +1,64 @@
+# -*- coding:utf-8 -*-
+
+
+class ArchChecks(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.profiles = kwargs.get('profiles')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   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 ebuild.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:
+   # For ebuilds with stable keywords, 
check if the
+   # dependencies are satisfiable for 
unstable
+   # configurations, since use.stable.mask 
is not
+   # applied for unstable configurations 
(see bug
+   # 563546).
+   if keyword == "*":
+   for expanded_arch in 
self.profiles:
+   if expanded_arch == 
"**":
+   continue
+   arches.add(
+   (keyword, 
expanded_arch, (expanded_arch,)))
+   arches.add(
+   (keyword, 
expanded_arch,
+   
(expanded_arch, "~" + expanded_arch)))
+   else:
+   arches.add((keyword, keyword, 
(keyword,)))
+   arches.add((keyword, keyword,
+   (keyword, "~" + 
keyword)))
+   if not arches:
+   # Use an empty profile for checking 
dependencies of
+  

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/manifest/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-09 Thread Brian Dolbec
commit: ef1932499b2307795c94b0624b739198f899b9fb
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:08:08 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef193249

repoman: Delete unused subpkgs

 pym/repoman/checks/ebuilds/variables/__init__.py | 0
 pym/repoman/modules/fix/__init__.py  | 0
 pym/repoman/modules/full/__init__.py | 0
 pym/repoman/modules/manifest/__init__.py | 0
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py 
b/pym/repoman/checks/ebuilds/variables/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/fix/__init__.py 
b/pym/repoman/modules/fix/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/full/__init__.py 
b/pym/repoman/modules/full/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/manifest/__init__.py 
b/pym/repoman/modules/manifest/__init__.py
deleted file mode 100644
index e69de29..000



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

2016-01-09 Thread Brian Dolbec
commit: 579b15fcc854b1bd10f087af41c9b10ec6e252c1
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:37:39 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:50 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=579b15fc

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py   | 23 ++
 .../ebuilds => modules/scan/use}/use_flags.py  | 36 ++
 pym/repoman/scanner.py |  8 ++---
 3 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py 
b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 000..e400719
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'use',
+   'description': doc,
+   'provides':{
+   'use-module': {
+   'name': "use_flags",
+   'class': "USEFlagChecks",
+   'description': doc,
+   'functions': ['check', 'getUsedUseFlags'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py 
b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
'''Performs checks on USE flags listed in the ebuilds and 
metadata.xml'''
 
-   def __init__(self, qatracker, globalUseFlags):
-   '''
+   def __init__(self, **kwargs):
+   '''Class init
+
@param qatracker: QATracker instance
@param globalUseFlags: Global USE flags
'''
-   self.qatracker = qatracker
-   self.globalUseFlags = globalUseFlags
+   super(USEFlagChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
+   self.globalUseFlags = kwargs.get('uselist')
self.useFlags = []
self.defaultUseFlags = []
self.usedUseFlags = set()
 
-   def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+   def check(self, **kwargs):
'''Perform the check.
 
@param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
+   @param xpkg: Package in which we check (string).
@param ebuild: Ebuild which we check (object).
@param y_ebuild: Ebuild which we check (string).
-   @param localUseFlags: Local USE flags of the package
+   @param muselist: Local USE flags of the package
'''
+   pkg = kwargs.get('pkg')
+   package = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   localUseFlags = kwargs.get('muselist')
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
-
-   def getUsedUseFlags(self):
-   '''Get the USE flags that this check has seen'''
-   return self.usedUseFlags
+   used_useflags = 
kwargs.get('used_useflags').union(self.usedUseFlags)
+   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags,
+   'used_useflags': used_useflags}
 
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
"REQUIRED_USE.syntax",
"%s: REQUIRED_USE: %s" % 
(ebuild.relative_path, e))
del e
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7f770c3..0227a93 100644
--- 

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

2016-01-09 Thread Brian Dolbec
commit: 0e960ff50b42073ae40293d90d6d7a67af3f26be
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 01:29:42 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:49 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e960ff5

repoman: Create the ThirdPartyMirrors class plugin

 pym/repoman/checks/ebuilds/thirdpartymirrors.py| 39 --
 pym/repoman/modules/scan/mirrors/__init__.py   | 23 +
 .../modules/scan/mirrors/thirdpartymirrors.py  | 59 ++
 pym/repoman/scanner.py |  6 +--
 4 files changed, 85 insertions(+), 42 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py 
b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
deleted file mode 100644
index 848dfb9..000
--- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding:utf-8 -*-
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class ThirdPartyMirrors(object):
-
-   def __init__(self, repoman_settings, qatracker):
-   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
-   self.thirdpartymirrors = {}
-   profile_thirdpartymirrors = 
repoman_settings.thirdpartymirrors().items()
-   for mirror_alias, mirrors in profile_thirdpartymirrors:
-   for mirror in mirrors:
-   if not mirror.endswith("/"):
-   mirror += "/"
-   self.thirdpartymirrors[mirror] = mirror_alias
-
-   self.qatracker = qatracker
-
-   def check(self, myaux, relative_path):
-   # Check that URIs don't reference a server from 
thirdpartymirrors.
-   for uri in portage.dep.use_reduce(
-   myaux["SRC_URI"], matchall=True, is_src_uri=True,
-   eapi=myaux["EAPI"], flat=True):
-   contains_mirror = False
-   for mirror, mirror_alias in 
self.thirdpartymirrors.items():
-   if uri.startswith(mirror):
-   contains_mirror = True
-   break
-   if not contains_mirror:
-   continue
-
-   new_uri = "mirror://%s/%s" % (mirror_alias, 
uri[len(mirror):])
-   self.qatracker.add_error(
-   "SRC_URI.mirror",
-   "%s: '%s' found in thirdpartymirrors, use '%s'" 
% (
-   relative_path, mirror, new_uri))
-   return

diff --git a/pym/repoman/modules/scan/mirrors/__init__.py 
b/pym/repoman/modules/scan/mirrors/__init__.py
new file mode 100644
index 000..37dfc53
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Mirrors plug-in module for repoman.
+Performs third party mirrors checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'mirrors',
+   'description': doc,
+   'provides':{
+   'mirrors-module': {
+   'name': "thirdpartymirrors",
+   'class': "ThirdPartyMirrors",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py 
b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
new file mode 100644
index 000..9404e28
--- /dev/null
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -0,0 +1,59 @@
+# -*- coding:utf-8 -*-
+
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.modules.scan.scanbase import ScanBase
+
+
+class ThirdPartyMirrors(ScanBase):
+
+   def __init__(self, **kwargs):
+   '''Class init
+
+   @param repo_settings: settings instance
+   @param qatracker: QATracker instance
+   '''
+   super(ThirdPartyMirrors, self).__init__(**kwargs)
+   repo_settings = kwargs.get('repo_settings')
+   self.qatracker = kwargs.get('qatracker')
+
+   # TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
+   self.thirdpartymirrors = {}
+   profile_thirdpartymirrors = 
repo_settings.repoman_settings.thirdpartymirrors().items()
+   for mirror_alias, mirrors in profile_thirdpartymirrors:
+   for mirror in mirrors:
+   if not mirror.endswith("/"):
+   mirror += "/"
+

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-09 Thread Brian Dolbec
commit: 1f41972b0b5dc6a61853935dbbbf9f0bd033918b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 10:03:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:48 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1f41972b

repoman: Migrate eapi.py to the plugin module

 pym/repoman/checks/ebuilds/variables/eapi.py | 44 -
 pym/repoman/modules/scan/eapi/__init__.py| 23 +
 pym/repoman/modules/scan/eapi/eapi.py| 49 
 pym/repoman/scanner.py   |  6 ++--
 4 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py 
b/pym/repoman/checks/ebuilds/variables/eapi.py
deleted file mode 100644
index 2f8b1cb..000
--- a/pym/repoman/checks/ebuilds/variables/eapi.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-'''eapi.py
-Perform checks on the EAPI variable.
-'''
-
-
-class EAPIChecks(object):
-   '''Perform checks on the EAPI variable.'''
-
-   def __init__(self, qatracker, repo_settings):
-   '''
-   @param qatracker: QATracker instance
-   @param repo_settings: Repository settings
-   '''
-   self.qatracker = qatracker
-   self.repo_settings = repo_settings
-
-   def check(self, pkg, ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param ebuild: Ebuild which we check (object).
-   '''
-   eapi = pkg._metadata["EAPI"]
-
-   if not self._checkBanned(ebuild, eapi):
-   self._checkDeprecated(ebuild, eapi)
-
-   def _checkBanned(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_banned(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False
-
-   def _checkDeprecated(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False

diff --git a/pym/repoman/modules/scan/eapi/__init__.py 
b/pym/repoman/modules/scan/eapi/__init__.py
new file mode 100644
index 000..de586a8
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Eapi plug-in module for repoman.
+Performs an IsEbuild check on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'eapi',
+   'description': doc,
+   'provides':{
+   'live-module': {
+   'name': "eapi",
+   'class': "EAPIChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/eapi/eapi.py 
b/pym/repoman/modules/scan/eapi/eapi.py
new file mode 100644
index 000..1190b1a
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -0,0 +1,49 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+   '''Perform checks on the EAPI variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_settings: Repository settings
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_settings = kwargs.get('repo_settings')
+
+   def check(self, **kwargs):
+   '''
+   @param pkg: Package in which we check (object).
+   @param ebuild: Ebuild which we check (object).
+   '''
+   ebuild = kwargs.get('ebuild')
+
+   if not self._checkBanned(ebuild):
+   self._checkDeprecated(ebuild)
+   return {'continue': False}
+
+   def _checkBanned(self, ebuild):
+   if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+   def _checkDeprecated(self, ebuild):
+   if 
self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi):
+   self.qatracker.add_error(
+   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, ebuild.eapi))
+   return True
+   return False
+
+

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

2016-01-09 Thread Brian Dolbec
commit: 89295567960c110468afb5b972583b4c56f7180a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:19:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:51 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=89295567

repoman: Migrate some additional Dependency code to the plugin

 pym/repoman/modules/scan/depend/depend.py | 13 -
 pym/repoman/scanner.py| 22 +++---
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
 
 from _emerge.Package import Package
 
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, 
b))
-   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list}
+
+   # data required for some other tests
+   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
+
+   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list,
+   'badlicsyntax': badlicsyntax, 'baddepsyntax': 
baddepsyntax}
 
@property
def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if dynamic_data['live_ebuild'] and 
self.repo_settings.repo_config.name == "gentoo":
-   self.liveeclasscheck.check(
-   dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, 
self.repo_metadata['pmaskdict'])
-
-   unknown_pkgs = set()
-   baddepsyntax = False
-   badlicsyntax = False
-   badprovsyntax = False
-   # catpkg = catdir + "/" + y_ebuild
-
-   badlicsyntax = len([z for z in 
dynamic_data['type_list'] if z == "LICENSE"])
-   badprovsyntax = len([z for z in 
dynamic_data['type_list'] if z == "PROVIDE"])
-   baddepsyntax = len(dynamic_data['type_list']) != 
badlicsyntax + badprovsyntax
-   badlicsyntax = badlicsyntax > 0
-   badprovsyntax = badprovsyntax > 0
-
used_useflags = 
used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
 
# license checks
-   if not badlicsyntax:
+   if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], 
xpkg, dynamic_data['ebuild'], y_ebuild)
 
self.restrictcheck.check(dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = 
dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], 
stable=dep_settings._parent_stable)
 
-   if not baddepsyntax:
+   if not dynamic_data['baddepsyntax']:
ismasked = not 
dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in 
self.portdb.xmatch("match-visible",
Atom("%s::%s" % 
(dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% 
(dynamic_data['ebuild'].relative_path, mytype, keyword,

prof, pformat(atoms, indent=6)))
 
-   if not baddepsyntax and dynamic_data['unknown_pkgs']:
+   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in 
dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, 
set()).add(atom)



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

2016-01-09 Thread Brian Dolbec
commit: 7e9737c24de6c9f548d1bc7ea90573ff955ca767
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Jan  7 01:41:02 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:53 2016 +
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 = '' \
% (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
 



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

2016-01-09 Thread Brian Dolbec
commit: 2bd3c35cb00033f17b4426e75a30f2d7e73173c3
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:55:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:51 2016 +
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'"



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

2016-01-09 Thread Brian Dolbec
commit: 9f58a4fc9e62c30f02c1284e8e0ae7af361c6f78
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:56:25 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:50 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9f58a4fc

repoman: Migrate more metadata checks to ebuild_metadata.py

 .../modules/scan/metadata/ebuild_metadata.py   | 32 --
 pym/repoman/scanner.py | 17 
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
 import re
 import sys
 
+from repoman.qa_data import missingvars
+
 if sys.hexversion >= 0x300:
basestring = str
 
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
 
-   def check(self, **kwargs):
+   def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   return {'continue': False}
+
+   def missing(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for pos, missing_var in enumerate(missingvars):
+   if not ebuild.metadata.get(missing_var):
+   if kwargs.get('catdir') == "virtual" and \
+   missing_var in ("HOMEPAGE", "LICENSE"):
+   continue
+   if kwargs.get('live_ebuild') and missing_var == 
"KEYWORDS":
+   continue
+   myqakey = missingvars[pos] + ".missing"
+   self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+   % (kwargs.get('xpkg'), 
kwargs.get('y_ebuild')))
+   return {'continue': False}
+
+   def old_virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+   return {'continue': False}
 
+   def virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   if kwargs.get('catdir') == "virtual":
+   for var in ("HOMEPAGE", "LICENSE"):
+   if ebuild.metadata.get(var):
+   myqakey = var + ".virtual"
+   self.qatracker.add_error(myqakey, 
ebuild.relative_path)
return {'continue': False}
 
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
 
@property
def runInEbuilds(self):
-   return (True, [self.check])
+   return (True, [self.invalidchar, self.missing, 
self.old_virtual, self.virtual])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-
-   for pos, missing_var in enumerate(missingvars):
-   if not 
dynamic_data['ebuild'].metadata.get(missing_var):
-   if dynamic_data['catdir'] == "virtual" 
and \
-   missing_var in ("HOMEPAGE", 
"LICENSE"):
-   continue
-   if dynamic_data['live_ebuild'] and 
missing_var == "KEYWORDS":
-   continue
-   myqakey = missingvars[pos] + ".missing"
-   self.qatracker.add_error(myqakey, xpkg 
+ "/" + y_ebuild + ".ebuild")
-
-   if dynamic_data['catdir'] == "virtual":
-   for var in ("HOMEPAGE", "LICENSE"):
-   if 
dynamic_data['ebuild'].metadata.get(var):
-   myqakey = var + ".virtual"
-   
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if 

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...

2016-01-09 Thread Brian Dolbec
commit: c45eaee3439b05bd90cbafa2b48d3e2bbd03
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:10:48 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:51 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c45eaee3

repoman: Migrate RestrictChecks to a plugin module

 pym/repoman/modules/scan/metadata/__init__.py  |  8 ++
 .../scan/metadata}/restrict.py | 29 +++---
 pym/repoman/scanner.py |  7 +-
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index ed0c59d..6ab44f6 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -42,6 +42,14 @@ module_spec = {
'func_desc': {
},
},
+   'restrict-metadata': {
+   'name': "restrict",
+   'class': "RestrictChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py 
b/pym/repoman/modules/scan/metadata/restrict.py
similarity index 54%
rename from pym/repoman/checks/ebuilds/variables/restrict.py
rename to pym/repoman/modules/scan/metadata/restrict.py
index 215b792..93ca298 100644
--- a/pym/repoman/checks/ebuilds/variables/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict
 class RestrictChecks(object):
'''Perform checks on the RESTRICT variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, package, ebuild, y_ebuild):
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
 
try:
myrestrict = portage.dep.use_reduce(
-   pkg._metadata["RESTRICT"], matchall=1, 
flat=True)
+   ebuild.metadata["RESTRICT"], matchall=1, 
flat=True)
except portage.exception.InvalidDependString as e:
-   self. qatracker.add_error(
-   "RESTRICT.syntax",
+   self.qatracker.add_error("RESTRICT.syntax",
"%s: RESTRICT: %s" % (ebuild.relative_path, e))
del e
 
@@ -36,6 +38,15 @@ class RestrictChecks(object):
 
if mybadrestrict:
for mybad in mybadrestrict:
-   self.qatracker.add_error(
-   "RESTRICT.invalid",
-   package + "/" + y_ebuild + 
".ebuild: %s" % mybad)
+   
self.qatracker.add_error("RESTRICT.invalid",
+   "%s/%s.ebuild: %s" % (xpkg, 
y_ebuild, mybad))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])
+

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f792bd..8657c73 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -209,8 +208,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.restrictcheck = RestrictChecks(self.qatracker)
-
 
def scan_pkgs(self, can_force):
dynamic_data = {'can_force': can_force}
@@ -295,7 +292,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 

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

2016-01-09 Thread Brian Dolbec
commit: e1ea46d0e76da941fe078e4fe933a9b74ff7d459
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:55:55 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:52 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e1ea46d0

repoman: Create a new Options class plugin

This handles an options.force bypass using the is_forced() from withing the 
plugin system.

 pym/repoman/modules/scan/options/__init__.py | 23 +++
 pym/repoman/modules/scan/options/options.py  | 22 ++
 pym/repoman/scanner.py   | 10 ++
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/pym/repoman/modules/scan/options/__init__.py 
b/pym/repoman/modules/scan/options/__init__.py
new file mode 100644
index 000..8424058
--- /dev/null
+++ b/pym/repoman/modules/scan/options/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Options plug-in module for repoman.
+Performs option related actions on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'options',
+   'description': doc,
+   'provides':{
+   'options-module': {
+   'name': "options",
+   'class': "Options",
+   'description': doc,
+   'functions': ['is_forced'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/options/options.py 
b/pym/repoman/modules/scan/options/options.py
new file mode 100644
index 000..b592884
--- /dev/null
+++ b/pym/repoman/modules/scan/options/options.py
@@ -0,0 +1,22 @@
+
+
+class Options(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+
+   def is_forced(self, **kwargs):
+   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.
+   return {'continue': True}
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.is_forced])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ac77d1f..a047237 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -290,6 +290,8 @@ class Scanner(object):
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
+   # Options.is_forced() is used to bypass further 
checks
+   ('options', 'Options'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -317,14 +319,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   # Syntax Checks
-
-   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 dynamic_data['arches']:
if arch not in self.profiles:



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

2016-01-09 Thread Brian Dolbec
commit: 9413c11a3d156addb642b0758ecd4535e76a26ad
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 04:44:05 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:52 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9413c11a

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +
 pym/repoman/modules/scan/directories/encoding.py | 41 
 pym/repoman/scanner.py   | 21 +---
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'encoding-module': {
+   'name': "encoding",
+   'class': "EncodingCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py 
b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   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.
+   pass
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b00dbd9..ac77d1f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ 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.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -293,7 +289,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
-   ('mtime', 'MtimeChecks'),
+   ('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -322,21 +318,6 @@ class Scanner(object):
continue
 
# Syntax Checks
-   try:
-   # All ebuilds should have utf_8 encoding.
-   f = io.open(
-   _unicode_encode(
-   
dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-   mode='r', 

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

2016-01-09 Thread Brian Dolbec
commit: 3070f601e972e077e1cc0414d1452683f6139858
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:51 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3070f601

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  8 
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/license.py 
b/pym/repoman/checks/ebuilds/variables/license.py
deleted file mode 100644
index bdc859c..000
--- a/pym/repoman/checks/ebuilds/variables/license.py
+++ /dev/null
@@ -1,47 +0,0 @@
-
-'''description.py
-Perform checks on the LICENSE variable.
-'''
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class LicenseChecks(object):
-   '''Perform checks on the LICENSE variable.'''
-
-   def __init__(self, qatracker, liclist, liclist_deprecated):
-   '''
-   @param qatracker: QATracker instance
-   @param liclist: List of licenses.
-   @param liclist: List of deprecated licenses.
-   '''
-   self.qatracker = qatracker
-   self.liclist = liclist
-   self.liclist_deprecated = liclist_deprecated
-
-   def check(
-   self, pkg, package, ebuild, y_ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
-   @param ebuild: Ebuild which we check (object).
-   @param y_ebuild: Ebuild which we check (string).
-   '''
-
-   # Parse the LICENSE variable, remove USE conditions and flatten 
it.
-   licenses = portage.dep.use_reduce(
-   pkg._metadata["LICENSE"], matchall=1, flat=True)
-
-   # Check each entry to ensure that it exists in 
${PORTDIR}/licenses/.
-   for lic in licenses:
-   # Need to check for "||" manually as no portage
-   # function will remove it without removing values.
-   if lic not in self.liclist and lic != "||":
-   self.qatracker.add_error(
-   "LICENSE.invalid",
-   package + "/" + y_ebuild + ".ebuild: 
%s" % lic)
-   elif lic in self.liclist_deprecated:
-   self.qatracker.add_error(
-   "LICENSE.deprecated",
-   "%s: %s" % (ebuild.relative_path, lic))

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 2506521..ed0c59d 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -34,6 +34,14 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'class': "LicenseChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/license.py 
b/pym/repoman/modules/scan/metadata/license.py
new file mode 100644
index 000..b022b20
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -0,0 +1,53 @@
+
+'''license.py
+Perform checks on the LICENSE variable.
+'''
+
+# import our initialized portage instance
+from repoman._portage import portage
+
+
+class LicenseChecks(object):
+   '''Perform checks on the LICENSE variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_metadata: dictionary of various repository items.
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_metadata = kwargs.get('repo_metadata')
+
+   def check(self, **kwargs):
+   '''
+   @param xpkg: Package in which we check (string).
+   @param ebuild: Ebuild which we check (object).
+   @param y_ebuild: Ebuild which we check (string).
+   '''
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   if not kwargs.get('badlicsyntax'):
+   # Parse the LICENSE variable, remove USE conditions and 

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

2016-01-09 Thread Brian Dolbec
commit: c935ccc827a5fae5f39ec79488c03a1922c0f95b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 18:28:58 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:49 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c935ccc8

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ---
 pym/repoman/scanner.py|  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py 
b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
super(KeywordChecks, self).__init__(**kwargs)
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
+   self.repo_metadata = kwargs.get('repo_metadata')
+   self.profiles = kwargs.get('profiles')
self.slot_keywords = {}
 
def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
live_ebuild = kwargs.get('live_ebuild')
if not self.options.straight_to_stable:
self._checkAddedWithStableKeywords(
-   package, ebuild, y_ebuild, keywords, changed)
+   xpkg, ebuild, y_ebuild, ebuild.keywords, 
changed)
 
-   self._checkForDroppedKeywords(
-   pkg, ebuild, ebuild_archs, live_ebuild)
+   self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, 
live_ebuild)
 
-   self._checkForInvalidKeywords(
-   pkg, package, y_ebuild, kwlist, profiles)
+   self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-   self._checkForMaskLikeKeywords(
-   package, y_ebuild, keywords, kwlist)
+   self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-   self.slot_keywords[pkg.slot].update(ebuild_archs)
+   self.slot_keywords[pkg.slot].update(ebuild.archs)
return {'continue': False}
 
-   def _isKeywordStable(self, keyword):
+   @staticmethod
+   def _isKeywordStable(keyword):
return not keyword.startswith("~") and not 
keyword.startswith("-")
 
def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
ebuild.relative_path,
" 
".join(sorted(dropped_keywords
 
-   def _checkForInvalidKeywords(
-   self, pkg, package, y_ebuild, kwlist, profiles):
-   myuse = pkg._metadata["KEYWORDS"].split()
+   def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+   myuse = ebuild.keywords
 
for mykey in myuse:
if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
if not self._isKeywordStable(myskey[:1]):
myskey = myskey[1:]
 
-   if myskey not in kwlist:
+   if myskey not in self.repo_metadata['kwlist']:
+   
self.qatracker.add_error("KEYWORDS.invalid",
+   "%s/%s.ebuild: %s" % (xpkg, 
y_ebuild, mykey))
+   elif myskey not in self.profiles:
self.qatracker.add_error(
"KEYWORDS.invalid",
-   "%s/%s.ebuild: %s" % (
-   package, y_ebuild, 
mykey))
-   elif myskey not in profiles:
-   self.qatracker.add_error(
-   "KEYWORDS.invalid",
-   "%s/%s.ebuild: %s (profile 
invalid)" % (
-   package, y_ebuild, 
mykey))
-
-   def _checkForMaskLikeKeywords(
-   self, package, y_ebuild, keywords, kwlist):
+   "%s/%s.ebuild: %s (profile 
invalid)"
+   % (xpkg, y_ebuild, 
mykey))
 
+   def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
# KEYWORDS="-*" is a stupid replacement for package.mask
# and screws general KEYWORDS semantics
if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
for kw in keywords:
   

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

2016-01-09 Thread Brian Dolbec
commit: ff7cc04d554e330da1f81d5d013780f602698665
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Jan  8 08:46:01 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:50 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff7cc04d

repoman: Create RubyEclassChecks class plugin

 pym/repoman/checks/ebuilds/eclasses/__init__.py|  0
 pym/repoman/modules/scan/eclasses/__init__.py  |  8 
 .../{checks/ebuilds => modules/scan}/eclasses/ruby.py  | 18 ++
 pym/repoman/scanner.py |  9 ++---
 4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/eclasses/__init__.py 
b/pym/repoman/checks/ebuilds/eclasses/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/scan/eclasses/__init__.py 
b/pym/repoman/modules/scan/eclasses/__init__.py
index a821f5c..70a6252 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'ruby-module': {
+   'name': "ruby",
+   'class': "RubyEclassChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py 
b/pym/repoman/modules/scan/eclasses/ruby.py
similarity index 62%
rename from pym/repoman/checks/ebuilds/eclasses/ruby.py
rename to pym/repoman/modules/scan/eclasses/ruby.py
index e8d36ea..4dc5d62 100644
--- a/pym/repoman/checks/ebuilds/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -4,19 +4,23 @@ Performs Ruby eclass checks
 '''
 
 from repoman.qa_data import ruby_deprecated
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class RubyEclassChecks(object):
+class RubyEclassChecks(ScanBase):
'''Performs checks for the usage of Ruby eclasses in ebuilds'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   super(RubyEclassChecks, self).__init__(**kwargs)
+   self.qatracker = kwargs.get('qatracker')
self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
 
-   def check(self, pkg, ebuild):
+   def check(self, **kwargs):
+   pkg = kwargs.get('pkg')
+   ebuild = kwargs.get('ebuild')
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -30,3 +34,9 @@ class RubyEclassChecks(object):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": 
Deprecated ruby target: %s")
% myruby)
+   return {'continue': False}
+
+   @property
+   def runInEbuilds(self):
+   '''Ebuild level scans'''
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 0227a93..e6a17cd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -211,7 +210,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -298,7 +296,7 @@ class Scanner(object):
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
-   ('use_flags', 'USEFlagChecks'),
+   ('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
]:
if mod[0]:

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

2016-01-09 Thread Brian Dolbec
commit: bc1957a35580c12d100b1d7aec02e671bd770e8f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:23:52 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:52 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bc1957a3

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 
 pym/repoman/modules/scan/directories/mtime.py| 24 
 pym/repoman/scanner.py   |  5 +
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'mtime-module': {
+   'name': "mtime",
+   'class': "MtimeChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py 
b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+   def __init__(self, **kwargs):
+   self.vcs_settings = kwargs.get('vcs_settings')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   changed = kwargs.get('changed')
+   pkg = kwargs.get('pkg')
+   if not self.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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
+   ('mtime', 'MtimeChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
continue
 
# Syntax Checks
-   if not self.vcs_settings.vcs_preserves_mtime:
-   if dynamic_data['ebuild'].ebuild_path not in 
self.changed.new_ebuilds and \
-   dynamic_data['ebuild'].ebuild_path not 
in self.changed.ebuilds:
-   dynamic_data['pkg'].mtime = None
try:
# All ebuilds should have utf_8 encoding.
f = io.open(



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

2016-01-09 Thread Brian Dolbec
commit: 0983df3610e6bc0a3ccfcf99369fe105cb1b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:33:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:51 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0983df36

repoman: Move ebuild_archs to the Ebuild class

 pym/repoman/modules/scan/ebuild/ebuild.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py 
b/pym/repoman/modules/scan/ebuild/ebuild.py
index 62c9e52..7362ff7 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -35,6 +35,7 @@ class Ebuild(ScanBase):
self.eapi = None
self.inherited = None
self.keywords = None
+   self.archs = None
 
def _set_paths(self, **kwargs):
repolevel = kwargs.get('repolevel')



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

2016-01-09 Thread Brian Dolbec
commit: 8b9af1c3a77cee700a7c8ea33ffef96718418a19
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:09:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b9af1c3

repoman: Create a new DependUnknown plugin class

 pym/repoman/modules/scan/depend/__init__.py |  8 
 pym/repoman/modules/scan/depend/unknown.py  | 30 +
 pym/repoman/scanner.py  | 10 +-
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..6b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'unknown-module': {
+   'name': "unknown",
+   'class': "DependUnknown",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/unknown.py 
b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
# Options.is_forced() is used to bypass further 
checks
('options', 'Options'), ('profile', 
'ProfileDependsChecks'),
+   ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
-   type_map = {}
-   for mytype, atom in 
dynamic_data['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"
-   % 
(dynamic_data['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 dynamic_data['allvalid']:



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

2016-01-09 Thread Brian Dolbec
commit: 5e273483758272413387c1dadd403a8f1bffdc4a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:37:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Jan 10 03:23:53 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e273483

repoman: Create a metadata UnusedCheck and final pkg checks

Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml

 pym/repoman/modules/scan/metadata/__init__.py |  8 ++
 pym/repoman/modules/scan/metadata/unused.py   | 32 
 pym/repoman/scanner.py| 36 ---
 3 files changed, 67 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+   'unused-metadata': {
+   'name': "unused",
+   'class': "UnusedCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/unused.py 
b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   muselist = kwargs.get('muselist')
+   used_useflags = kwargs.get('used_useflags')
+   # check if there are unused local USE-descriptions in 
metadata.xml
+   # (unless there are any invalids, to avoid noise)
+   if kwargs.get('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 {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (False, [])
+
+   @property
+   def runInFinal(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 89eaa57..50dd259 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
 
 
def _scan_ebuilds(self, ebuildlist, dynamic_data):
-   xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
 
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   # 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(dynamic_data['used_useflags']):
-   self.qatracker.add_error(
-   "metadata.warning",
-   "%s/metadata.xml: unused local 
USE-description: '%s'"
-   % (xpkg, myflag))
+   # Final checks
+   # initialize per pkg plugin final checks here
+   # need to set it up for ==> self.modules_list or some other 
ordered list
+   xpkg_complete = False
+   for mod in [('unused', 'UnusedChecks')]:
+   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 final checks: module:", mod[1])
+   do_it, functions = self.modules[mod[1]].runInFinal
+   # print("do_it", do_it, "functions", functions)
+   if do_it:
+   for func in functions:
+   print("\tRunning function:", func)
+   rdata = func(**dynamic_data)
+   if 

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/

2016-01-05 Thread Brian Dolbec
commit: 6feabf072a82a4703ed88c32d1371e5a2e8a2841
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:08:08 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:25 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6feabf07

repoman: delete no longer used checks/ebuilds/variables sub-pkg

 pym/repoman/checks/ebuilds/variables/__init__.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py 
b/pym/repoman/checks/ebuilds/variables/__init__.py
deleted file mode 100644
index e69de29..000



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

2016-01-05 Thread Brian Dolbec
commit: a272720a9d0df791945c84d4411c9f6d66fa6162
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:09:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:24 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a272720a

repoman: Create a new DependUnknown plugin class

 pym/repoman/modules/scan/depend/__init__.py |  8 
 pym/repoman/modules/scan/depend/unknown.py  | 30 +
 pym/repoman/scanner.py  | 10 +-
 3 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..6b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'unknown-module': {
+   'name': "unknown",
+   'class': "DependUnknown",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/unknown.py 
b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 680d07a..08e53ac 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -291,6 +291,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
# Options.is_forced() is used to bypass further 
checks
('options', 'Options'), ('profile', 
'ProfileDependsChecks'),
+   ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -321,15 +322,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
-   type_map = {}
-   for mytype, atom in 
dynamic_data['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"
-   % 
(dynamic_data['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 dynamic_data['allvalid']:



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

2016-01-05 Thread Brian Dolbec
commit: 0187e2e6559e0d2e66b9c27c11228400024199a6
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:10:48 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:23 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0187e2e6

repoman: Migrate RestrictChecks to a plugin module

 pym/repoman/modules/scan/metadata/__init__.py  |  8 ++
 .../scan/metadata}/restrict.py | 29 +++---
 pym/repoman/scanner.py |  9 +--
 3 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index ed0c59d..6ab44f6 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -42,6 +42,14 @@ module_spec = {
'func_desc': {
},
},
+   'restrict-metadata': {
+   'name': "restrict",
+   'class': "RestrictChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py 
b/pym/repoman/modules/scan/metadata/restrict.py
similarity index 54%
rename from pym/repoman/checks/ebuilds/variables/restrict.py
rename to pym/repoman/modules/scan/metadata/restrict.py
index 215b792..93ca298 100644
--- a/pym/repoman/checks/ebuilds/variables/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict
 class RestrictChecks(object):
'''Perform checks on the RESTRICT variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, package, ebuild, y_ebuild):
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
 
try:
myrestrict = portage.dep.use_reduce(
-   pkg._metadata["RESTRICT"], matchall=1, 
flat=True)
+   ebuild.metadata["RESTRICT"], matchall=1, 
flat=True)
except portage.exception.InvalidDependString as e:
-   self. qatracker.add_error(
-   "RESTRICT.syntax",
+   self.qatracker.add_error("RESTRICT.syntax",
"%s: RESTRICT: %s" % (ebuild.relative_path, e))
del e
 
@@ -36,6 +38,15 @@ class RestrictChecks(object):
 
if mybadrestrict:
for mybad in mybadrestrict:
-   self.qatracker.add_error(
-   "RESTRICT.invalid",
-   package + "/" + y_ebuild + 
".ebuild: %s" % mybad)
+   
self.qatracker.add_error("RESTRICT.invalid",
+   "%s/%s.ebuild: %s" % (xpkg, 
y_ebuild, mybad))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])
+

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ea1869f..457bdcb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -210,10 +209,6 @@ class Scanner(object):
print("Initializing class name:", mod_class.__name__)
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
-   # initialize our checks classes here before the big xpkg loop
-   self.restrictcheck = RestrictChecks(self.qatracker)
-
-
def scan_pkgs(self, can_force):
dynamic_data = {'can_force': can_force}
for xpkg in self.effective_scanlist:
@@ -299,7 +294,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
 

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

2016-01-05 Thread Brian Dolbec
commit: 59a03a85d16e779c0cd6b03d1b5f5505c7054a89
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:55:55 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:24 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=59a03a85

repoman: Create a new options plugin

This handles an options.force bypass using the is_forced() from withing the 
plugin system.

 pym/repoman/modules/scan/options/__init__.py | 23 +++
 pym/repoman/modules/scan/options/options.py  | 22 ++
 pym/repoman/scanner.py   | 10 ++
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/pym/repoman/modules/scan/options/__init__.py 
b/pym/repoman/modules/scan/options/__init__.py
new file mode 100644
index 000..8424058
--- /dev/null
+++ b/pym/repoman/modules/scan/options/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Options plug-in module for repoman.
+Performs option related actions on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'options',
+   'description': doc,
+   'provides':{
+   'options-module': {
+   'name': "options",
+   'class': "Options",
+   'description': doc,
+   'functions': ['is_forced'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/options/options.py 
b/pym/repoman/modules/scan/options/options.py
new file mode 100644
index 000..b592884
--- /dev/null
+++ b/pym/repoman/modules/scan/options/options.py
@@ -0,0 +1,22 @@
+
+
+class Options(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+
+   def is_forced(self, **kwargs):
+   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.
+   return {'continue': True}
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.is_forced])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b6d2441..809b8db 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -292,6 +292,8 @@ class Scanner(object):
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
+   # Options.is_forced() is used to bypass further 
checks
+   ('options', 'Options'), ('profile', 
'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -322,14 +324,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-   # Syntax Checks
-
-   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 dynamic_data['arches']:
if arch not in self.profiles:



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

2016-01-05 Thread Brian Dolbec
commit: 8be4338eb048c36197b207fce836cac818f5dc05
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 19:11:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:22 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8be4338e

repoman: Create a new ArchChecks class plugin

 pym/repoman/modules/scan/arches/__init__.py | 23 +++
 pym/repoman/modules/scan/arches/arches.py   | 64 +
 pym/repoman/scanner.py  | 47 +
 3 files changed, 89 insertions(+), 45 deletions(-)

diff --git a/pym/repoman/modules/scan/arches/__init__.py 
b/pym/repoman/modules/scan/arches/__init__.py
new file mode 100644
index 000..b570dac
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Arches plug-in module for repoman.
+Performs archs checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'arches',
+   'description': doc,
+   'provides':{
+   'archs-module': {
+   'name': "arches",
+   'class': "ArchChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/arches/arches.py 
b/pym/repoman/modules/scan/arches/arches.py
new file mode 100644
index 000..2c32028
--- /dev/null
+++ b/pym/repoman/modules/scan/arches/arches.py
@@ -0,0 +1,64 @@
+# -*- coding:utf-8 -*-
+
+
+class ArchChecks(object):
+
+   def __init__(self, **kwargs):
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.profiles = kwargs.get('profiles')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   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 ebuild.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:
+   # For ebuilds with stable keywords, 
check if the
+   # dependencies are satisfiable for 
unstable
+   # configurations, since use.stable.mask 
is not
+   # applied for unstable configurations 
(see bug
+   # 563546).
+   if keyword == "*":
+   for expanded_arch in 
self.profiles:
+   if expanded_arch == 
"**":
+   continue
+   arches.add(
+   (keyword, 
expanded_arch, (expanded_arch,)))
+   arches.add(
+   (keyword, 
expanded_arch,
+   
(expanded_arch, "~" + expanded_arch)))
+   else:
+   arches.add((keyword, keyword, 
(keyword,)))
+   arches.add((keyword, keyword,
+   (keyword, "~" + 
keyword)))
+   if not arches:
+   # Use an empty profile for checking 
dependencies of
+  

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

2016-01-05 Thread Brian Dolbec
commit: 9fedd97887e6af9e54e02ea6ea10d6673a909dde
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:36:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:21 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fedd978

repoman: Migrate DescriptionChecks to the plugin system

 pym/repoman/modules/scan/metadata/__init__.py|  8 
 .../scan/metadata}/description.py| 20 ++--
 pym/repoman/scanner.py   |  5 +
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+   'description-metadata': {
+   'name': "description",
+   'class': "DescriptionChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/checks/ebuilds/variables/description.py 
b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
 class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
 
-   def __init__(self, qatracker):
+   def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
-   self.qatracker = qatracker
+   self.qatracker = kwargs.get('qatracker')
 
-   def check(self, pkg, ebuild):
+   def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
-   self._checkTooLong(pkg, ebuild)
-
-   def _checkTooLong(self, pkg, ebuild):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), 
max_desc_len))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.checkTooLong])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f56c5c..295d35e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
 from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -214,7 +213,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = 
mod_class(**self.kwargs)
 
# initialize our checks classes here before the big xpkg loop
-   self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, 
liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+   ('description', 'DescriptionChecks'),
]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
print("Initializing class name:", 
mod_class.__name__)
@@ -330,8 +329,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 

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

2016-01-05 Thread Brian Dolbec
commit: b8183b8bd1f106e58080b2871f4b3f6e6aaf67f5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 19:04:36 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:25 2016 +
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 >= 0x300:
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__)
+

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

2016-01-05 Thread Brian Dolbec
commit: cf9dee2a64b425a088979f4c23fb03c50c5dc136
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 07:57:36 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:24 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cf9dee2a

repoman: Move the large depency checks loop to a new plugin 
ProfileDependsChecks class

 pym/repoman/modules/scan/depend/__init__.py |   8 ++
 pym/repoman/modules/scan/depend/profile.py  | 211 
 pym/repoman/repos.py|   1 +
 pym/repoman/scanner.py  | 179 +--
 4 files changed, 226 insertions(+), 173 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+   'profile-module': {
+   'name': "profile",
+   'class': "ProfileDependsChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/depend/profile.py 
b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+   return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+   self.profiles = kwargs.get('profiles')
+   self.options = kwargs.get('options')
+   self.repo_settings = kwargs.get('repo_settings')
+   self.include_arches = kwargs.get('include_arches')
+   self.caches = kwargs.get('caches')
+   self.repoman_incrementals = kwargs.get('repoman_incrementals')
+   self.env = kwargs.get('env')
+   self.have = kwargs.get('have')
+   self.dev_keywords = kwargs.get('dev_keywords')
+
+   def check(self, **kwargs):
+   arches = kwargs.get('arches')
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   baddepsyntax = kwargs.get('baddepsyntax')
+   unknown_pkgs = kwargs.get('unknown_pkgs')
+
+   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.repo_settings.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 

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

2016-01-05 Thread Brian Dolbec
commit: 0acb069f91d0e400f2182c3965462850f7d02da0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 08:37:22 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:25 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0acb069f

repoman: Create an metadata UnusedCheck and final pkg checks

Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml

 pym/repoman/modules/scan/metadata/__init__.py |  8 ++
 pym/repoman/modules/scan/metadata/unused.py   | 32 ++
 pym/repoman/scanner.py| 39 ---
 3 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+   'unused-metadata': {
+   'name': "unused",
+   'class': "UnusedCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/unused.py 
b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   xpkg = kwargs.get('xpkg')
+   muselist = kwargs.get('muselist')
+   used_useflags = kwargs.get('used_useflags')
+   # check if there are unused local USE-descriptions in 
metadata.xml
+   # (unless there are any invalids, to avoid noise)
+   if kwargs.get('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 {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (False, [])
+
+   @property
+   def runInFinal(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 08e53ac..cfc6802 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -271,7 +271,6 @@ class Scanner(object):
 
 
def _scan_ebuilds(self, ebuildlist, dynamic_data):
-   xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
 
@@ -320,13 +319,33 @@ class Scanner(object):
if y_ebuild_continue:
continue
 
-   print(" finished plugin loop, continuing...")
+   print(" 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
+   xpkg_complete = False
+   for mod in [('unused', 'UnusedChecks')]:
+   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 final checks: module:", mod[1])
+   do_it, functions = self.modules[mod[1]].runInFinal
+   # print("do_it", do_it, "functions", functions)
+   if do_it:
+   for func in functions:
+   print("\tRunning function:", func)
+   rdata = func(**dynamic_data)
+   if rdata['continue']:
+   xpkg_complete = True
+   print("\t>>> Continuing")
+   break
+   #print("rdata:", rdata)
+   dynamic_data.update(rdata)
+   #print("dynamic_data", 

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

2016-01-05 Thread Brian Dolbec
commit: f335aff77270fc4d7f09ccd5728b7cc770d5a64a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:01:10 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:22 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f335aff7

repoman: Complete USE flag checks migration to the plugin

 pym/repoman/modules/scan/use/use_flags.py | 20 +++-
 pym/repoman/scanner.py| 11 +++
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/pym/repoman/modules/scan/use/use_flags.py 
b/pym/repoman/modules/scan/use/use_flags.py
index c937001..df83c1b 100644
--- a/pym/repoman/modules/scan/use/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -25,7 +25,7 @@ class USEFlagChecks(object):
self.defaultUseFlags = []
self.usedUseFlags = set()
 
-   def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+   def check(self, **kwargs):
'''Perform the check.
 
@param pkg: Package in which we check (object).
@@ -34,6 +34,11 @@ class USEFlagChecks(object):
@param y_ebuild: Ebuild which we check (string).
@param localUseFlags: Local USE flags of the package
'''
+   pkg = kwargs.get('pkg')
+   package = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   localUseFlags = kwargs.get('muselist')
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -41,10 +46,7 @@ class USEFlagChecks(object):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
-
-   def getUsedUseFlags(self):
-   '''Get the USE flags that this check has seen'''
-   return self.usedUseFlags
+   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags}
 
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +90,11 @@ class USEFlagChecks(object):
"REQUIRED_USE.syntax",
"%s: REQUIRED_USE: %s" % 
(ebuild.relative_path, e))
del e
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 4b0b251..66aa3fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -275,7 +275,7 @@ class Scanner(object):
if self.checks['changelog'] and "ChangeLog" not in 
checkdirlist:
self.qatracker.add_error("changelog.missing", 
xpkg + "/ChangeLog")
 
-   self.muselist = 
frozenset(self.modules['PkgMetadata'].musedict)
+   dynamic_data['muselist'] = 
frozenset(self.modules['PkgMetadata'].musedict)
 
changelog_path = os.path.join(checkdir_relative, 
"ChangeLog")
self.changelog_modified = changelog_path in 
self.changed.changelogs
@@ -300,6 +300,7 @@ class Scanner(object):
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
+   ('use_flags', 'USEFlagChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -341,12 +342,6 @@ class Scanner(object):
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
 
-   self.modules['USEFlagChecks'] = 
MODULE_CONTROLLER.get_class('use_flags')(**self.kwargs)
-   
self.modules['USEFlagChecks'].check(dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild, self.muselist)
-
-   ebuild_used_useflags = 
self.modules['USEFlagChecks'].getUsedUseFlags()
-   used_useflags = 
used_useflags.union(ebuild_used_useflags)
-
self.rubyeclasscheck = 
MODULE_CONTROLLER.get_class('ruby')(**self.kwargs)
 
self.rubyeclasscheck.check(dynamic_data['pkg'], 
dynamic_data['ebuild'])
@@ -560,7 +555,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 

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

2016-01-05 Thread Brian Dolbec
commit: 9b15527a60f93de80afb33a729f4e3fc25691f65
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:55:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:23 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b15527a

repoman: Migrate additional dynamic data setting to the USEFlagsChecks

 pym/repoman/modules/scan/use/use_flags.py | 4 +++-
 pym/repoman/scanner.py| 7 ++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/pym/repoman/modules/scan/use/use_flags.py 
b/pym/repoman/modules/scan/use/use_flags.py
index df83c1b..e7485b1 100644
--- a/pym/repoman/modules/scan/use/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -46,7 +46,9 @@ class USEFlagChecks(object):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
-   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags}
+   used_useflags = 
kwargs.get('used_useflags').union(self.usedUseFlags)
+   return {'continue': False, 'ebuild_UsedUseFlags': 
self.usedUseFlags,
+   'used_useflags': used_useflags}
 
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 2b0a748..5e42faf 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -287,7 +287,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
@@ -331,9 +331,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-
-   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)
@@ -543,7 +540,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'"



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

2016-01-05 Thread Brian Dolbec
commit: aebf5722a1bc262b8bd843348c947d06efa6713c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:56:25 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:21 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=aebf5722

repoman: Migrate more metadata checks to ebuild_metadata.py

 .../modules/scan/metadata/ebuild_metadata.py   | 32 --
 pym/repoman/scanner.py | 19 -
 2 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
 import re
 import sys
 
+from repoman.qa_data import missingvars
+
 if sys.hexversion >= 0x300:
basestring = str
 
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
 
-   def check(self, **kwargs):
+   def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   return {'continue': False}
+
+   def missing(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   for pos, missing_var in enumerate(missingvars):
+   if not ebuild.metadata.get(missing_var):
+   if kwargs.get('catdir') == "virtual" and \
+   missing_var in ("HOMEPAGE", "LICENSE"):
+   continue
+   if kwargs.get('live_ebuild') and missing_var == 
"KEYWORDS":
+   continue
+   myqakey = missingvars[pos] + ".missing"
+   self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+   % (kwargs.get('xpkg'), 
kwargs.get('y_ebuild')))
+   return {'continue': False}
+
+   def old_virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+   return {'continue': False}
 
+   def virtual(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   if kwargs.get('catdir') == "virtual":
+   for var in ("HOMEPAGE", "LICENSE"):
+   if ebuild.metadata.get(var):
+   myqakey = var + ".virtual"
+   self.qatracker.add_error(myqakey, 
ebuild.relative_path)
return {'continue': False}
 
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
 
@property
def runInEbuilds(self):
-   return (True, [self.check])
+   return (True, [self.invalidchar, self.missing, 
self.old_virtual, self.virtual])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ca540a7..20c6460 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -330,25 +330,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-   if dynamic_data['ebuild'].metadata.get("PROVIDE"):
-   self.qatracker.add_error("virtual.oldstyle", 
dynamic_data['ebuild'].relative_path)
-
-   for pos, missing_var in enumerate(missingvars):
-   if not 
dynamic_data['ebuild'].metadata.get(missing_var):
-   if dynamic_data['catdir'] == "virtual" 
and \
-   missing_var in ("HOMEPAGE", 
"LICENSE"):
-   continue
-   if dynamic_data['live_ebuild'] and 
missing_var == "KEYWORDS":
-   continue
-   myqakey = missingvars[pos] + ".missing"
-   self.qatracker.add_error(myqakey, xpkg 
+ "/" + y_ebuild + ".ebuild")
-
-   if dynamic_data['catdir'] == "virtual":
-   for var in ("HOMEPAGE", "LICENSE"):
-   if 
dynamic_data['ebuild'].metadata.get(var):
-   

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

2016-01-05 Thread Brian Dolbec
commit: 44283d1ffb00766110c5d0cf54e213f4a51118bc
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 18:28:58 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:22 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=44283d1f

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 64 +--
 pym/repoman/scanner.py|  7 +--
 2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py 
b/pym/repoman/modules/scan/keywords/keywords.py
index b11732d..867b886 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -14,6 +14,8 @@ class KeywordChecks(object):
'''
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
+   self.repo_metadata = kwargs.get('repo_metadata')
+   self.profiles = kwargs.get('profiles')
self.slot_keywords = {}
 
def prepare(self, **kwargs):
@@ -21,39 +23,38 @@ class KeywordChecks(object):
self.slot_keywords = {}
return {'continue': False}
 
-   def check(
-   self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, 
changed,
-   live_ebuild, kwlist, profiles):
+   def check(self, **kwargs):
'''Perform the check.
 
@param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
+   @param xpkg: Package in which we check (string).
@param ebuild: Ebuild which we check (object).
@param y_ebuild: Ebuild which we check (string).
-   @param keywords: All the keywords (including -...) of the 
ebuild.
@param ebuild_archs: Just the architectures (no prefixes) of 
the ebuild.
@param changed: Changes instance
-   @param slot_keywords: A dictionary of keywords per slot.
@param live_ebuild: A boolean that determines if this is a live 
ebuild.
-   @param kwlist: A list of all global keywords.
-   @param profiles: A list of all profiles.
'''
+   pkg = kwargs.get('pkg')
+   xpkg =kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   changed = kwargs.get('changed')
+   live_ebuild = kwargs.get('live_ebuild')
if not self.options.straight_to_stable:
self._checkAddedWithStableKeywords(
-   package, ebuild, y_ebuild, keywords, changed)
+   xpkg, ebuild, y_ebuild, ebuild.keywords, 
changed)
 
-   self._checkForDroppedKeywords(
-   pkg, ebuild, ebuild_archs, live_ebuild)
+   self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, 
live_ebuild)
 
-   self._checkForInvalidKeywords(
-   pkg, package, y_ebuild, kwlist, profiles)
+   self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-   self._checkForMaskLikeKeywords(
-   package, y_ebuild, keywords, kwlist)
+   self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-   self.slot_keywords[pkg.slot].update(ebuild_archs)
+   self.slot_keywords[pkg.slot].update(ebuild.archs)
+   return {'continue': False}
 
-   def _isKeywordStable(self, keyword):
+   @staticmethod
+   def _isKeywordStable(keyword):
return not keyword.startswith("~") and not 
keyword.startswith("-")
 
def _checkAddedWithStableKeywords(
@@ -82,9 +83,8 @@ class KeywordChecks(object):
ebuild.relative_path,
" 
".join(sorted(dropped_keywords
 
-   def _checkForInvalidKeywords(
-   self, pkg, package, y_ebuild, kwlist, profiles):
-   myuse = pkg._metadata["KEYWORDS"].split()
+   def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+   myuse = ebuild.keywords
 
for mykey in myuse:
if mykey not in ("-*", "*", "~*"):
@@ -93,20 +93,16 @@ class KeywordChecks(object):
if not self._isKeywordStable(myskey[:1]):
myskey = myskey[1:]
 
-   if myskey not in kwlist:
-   self.qatracker.add_error(
-   "KEYWORDS.invalid",
-   "%s/%s.ebuild: %s" % (
-   package, y_ebuild, 

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

2016-01-05 Thread Brian Dolbec
commit: 6661f9725b1fc98fcac45e59d1f41460a5663fe8
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:02:33 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:23 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6661f972

repoman: Complete ruby eclass check migration to the plugin

 pym/repoman/modules/scan/eclasses/ruby.py | 13 -
 pym/repoman/scanner.py|  6 ++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/pym/repoman/modules/scan/eclasses/ruby.py 
b/pym/repoman/modules/scan/eclasses/ruby.py
index 7a145bc..4f1e640 100644
--- a/pym/repoman/modules/scan/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -16,7 +16,9 @@ class RubyEclassChecks(object):
self.qatracker = kwargs.get('qatracker')
self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
 
-   def check(self, pkg, ebuild):
+   def check(self, **kwargs):
+   pkg = kwargs.get('pkg')
+   ebuild = kwargs.get('ebuild')
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -30,3 +32,12 @@ class RubyEclassChecks(object):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": 
Deprecated ruby target: %s")
% myruby)
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 66aa3fd..11f7d93 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -300,7 +300,7 @@ class Scanner(object):
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 
'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
-   ('use_flags', 'USEFlagChecks'),
+   ('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -342,9 +342,7 @@ class Scanner(object):
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
 
-   self.rubyeclasscheck = 
MODULE_CONTROLLER.get_class('ruby')(**self.kwargs)
-
-   self.rubyeclasscheck.check(dynamic_data['pkg'], 
dynamic_data['ebuild'])
+   used_useflags = 
used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
 
# license checks
if not badlicsyntax:



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

2016-01-05 Thread Brian Dolbec
commit: 2c305a1e3fcfd9c0f46962af3a931a03ea2c5032
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:33:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:21 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2c305a1e

repoman: Move ebuild_archs to the Ebuild class

 pym/repoman/modules/scan/ebuild/ebuild.py | 2 ++
 pym/repoman/scanner.py| 9 ++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py 
b/pym/repoman/modules/scan/ebuild/ebuild.py
index b0e4996..d8f3118 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -26,6 +26,7 @@ class Ebuild(object):
self.eapi = None
self.inherited = None
self.keywords = None
+   self.archs = None
 
def _set_paths(self, **kwargs):
repolevel = kwargs.get('repolevel')
@@ -69,6 +70,7 @@ class Ebuild(object):
self.eapi = self.metadata["EAPI"]
self.inherited = self.pkg.inherited
self.keywords = self.metadata["KEYWORDS"].split()
+   self.archs = set(kw.lstrip("~") for kw in self.keywords if not 
kw.startswith("-"))
return {'continue': False}
 
def bad_split_check(self, **kwargs):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 20c6460..1f56c5c 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -332,13 +332,8 @@ class Scanner(object):
 
self.descriptioncheck.check(dynamic_data['pkg'], 
dynamic_data['ebuild'])
 
-
-
-   ebuild_archs = set(
-   kw.lstrip("~") for kw in 
dynamic_data['ebuild'].keywords if not kw.startswith("-"))
-
self.modules['KeywordChecks'].check(
-   dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, 
ebuild_archs, self.changed,
+   dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, 
dynamic_data['ebuild'].archs, self.changed,
dynamic_data['live_ebuild'], 
self.repo_metadata['kwlist'], self.profiles)
 
if self.options.ignore_arches:
@@ -618,7 +613,7 @@ class Scanner(object):
dynamic_data['pkg'], 
stable=dep_settings._parent_stable)
 
if not baddepsyntax:
-   ismasked = not ebuild_archs or \
+   ismasked = not 
dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in 
self.portdb.xmatch("match-visible",
Atom("%s::%s" % 
(dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
if ismasked:



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

2016-01-05 Thread Brian Dolbec
commit: 77ace9803734d2ba6761f17770a41af5bf7eb870
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jan  4 04:44:05 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:24 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=77ace980

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +
 pym/repoman/modules/scan/directories/encoding.py | 41 
 pym/repoman/scanner.py   | 21 +---
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'encoding-module': {
+   'name': "encoding",
+   'class': "EncodingCheck",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py 
b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+   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.
+   pass
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7640dca..b6d2441 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ 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.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -295,7 +291,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
-   ('mtime', 'MtimeChecks'),
+   ('mtime', 'MtimeChecks'), ('encoding', 
'EncodingCheck'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -327,21 +323,6 @@ class Scanner(object):
print(" finished plugin loop, continuing...")
 
# Syntax Checks
-   try:
-   # All ebuilds should have utf_8 encoding.
-   f = io.open(
-   _unicode_encode(
-   
dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-   mode='r', 

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

2016-01-05 Thread Brian Dolbec
commit: 64d73922bcc8e9baba8f561a0aaab9cc3ffe9ec0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 20:38:11 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:22 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=64d73922

repoman: New DependChecks plugin

Migrate code from _scan_ebuilds to the plugin system

 pym/repoman/modules/scan/depend/__init__.py |  23 +
 pym/repoman/modules/scan/depend/depend.py   | 132 
 pym/repoman/scanner.py  | 120 ++---
 3 files changed, 162 insertions(+), 113 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/__init__.py 
b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+   'name': 'depend',
+   'description': doc,
+   'provides':{
+   'depend-module': {
+   'name': "depend",
+   'class': "DependChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
+   }
+}
+

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+   def __init__(self, **kwargs):
+   self.qatracker = kwargs.get('qatracker')
+   self.portdb = kwargs.get('portdb')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   pkg = kwargs.get('pkg')
+
+   unknown_pkgs = set()
+
+   inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+   "java-pkg-opt-2" in ebuild.inherited,
+   inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+   # operator_tokens = set(["||", "(", ")"])
+   type_list, badsyntax = [], []
+   for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", 
"PROVIDE"):
+   mydepstr = ebuild.metadata[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))
+
+   

[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/

2016-01-05 Thread Brian Dolbec
commit: 21cbc58a860b0e850849567c7b561f65cca73f96
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:07:21 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:25 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=21cbc58a

delete no longer used eapi.py file

 pym/repoman/checks/ebuilds/variables/eapi.py | 44 
 1 file changed, 44 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py 
b/pym/repoman/checks/ebuilds/variables/eapi.py
deleted file mode 100644
index 2f8b1cb..000
--- a/pym/repoman/checks/ebuilds/variables/eapi.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-'''eapi.py
-Perform checks on the EAPI variable.
-'''
-
-
-class EAPIChecks(object):
-   '''Perform checks on the EAPI variable.'''
-
-   def __init__(self, qatracker, repo_settings):
-   '''
-   @param qatracker: QATracker instance
-   @param repo_settings: Repository settings
-   '''
-   self.qatracker = qatracker
-   self.repo_settings = repo_settings
-
-   def check(self, pkg, ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param ebuild: Ebuild which we check (object).
-   '''
-   eapi = pkg._metadata["EAPI"]
-
-   if not self._checkBanned(ebuild, eapi):
-   self._checkDeprecated(ebuild, eapi)
-
-   def _checkBanned(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_banned(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.banned", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False
-
-   def _checkDeprecated(self, ebuild, eapi):
-   if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
-   self.qatracker.add_error(
-   "repo.eapi.deprecated", "%s: %s" % 
(ebuild.relative_path, eapi))
-
-   return True
-
-   return False



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

2016-01-05 Thread Brian Dolbec
commit: e644cc33ab94e0465eba5ec8032e7cb070cb5f83
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 18:27:42 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:22 2016 +
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)



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

2016-01-05 Thread Brian Dolbec
commit: 76eba030d484b6ff0c4cf1d9d35e4340f373f60c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:26:45 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:21 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=76eba030

repoman: Complete  ThirdPartyMirrors migration

 .../modules/scan/mirrors/thirdpartymirrors.py  | 23 --
 pym/repoman/scanner.py |  4 +---
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py 
b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
index 533899d..dcc673a 100644
--- a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -8,7 +8,7 @@ class ThirdPartyMirrors(object):
 
def __init__(self, **kwargs):
repo_settings = kwargs.get('repo_settings')
-   self.qa_tracker = kwargs.get('qatracker')
+   self.qatracker = kwargs.get('qatracker')
 
# TODO: Build a regex instead here, for the SRC_URI.mirror 
check.
self.thirdpartymirrors = {}
@@ -19,11 +19,14 @@ class ThirdPartyMirrors(object):
mirror += "/"
self.thirdpartymirrors[mirror] = mirror_alias
 
-   def check(self, myaux, relative_path):
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   if kwargs.get('src_uri_error'):
+   return {'continue': True}
# Check that URIs don't reference a server from 
thirdpartymirrors.
for uri in portage.dep.use_reduce(
-   myaux["SRC_URI"], matchall=True, is_src_uri=True,
-   eapi=myaux["EAPI"], flat=True):
+   ebuild.metadata["SRC_URI"], matchall=True, 
is_src_uri=True,
+   eapi=ebuild.eapi, flat=True):
contains_mirror = False
for mirror, mirror_alias in 
self.thirdpartymirrors.items():
if uri.startswith(mirror):
@@ -36,5 +39,13 @@ class ThirdPartyMirrors(object):
self.qatracker.add_error(
"SRC_URI.mirror",
"%s: '%s' found in thirdpartymirrors, use '%s'" 
% (
-   relative_path, mirror, new_uri))
-   return
+   ebuild.relative_path, mirror, new_uri))
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b5a0fce..ca540a7 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -300,6 +300,7 @@ class Scanner(object):
# need to set it up for ==> self.modules_list or some 
other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 
'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 
'EbuildMetadata'),
+   ('thirdpartymirrors', 'ThirdPartyMirrors'),
]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
print("Initializing class name:", 
mod_class.__name__)
@@ -329,9 +330,6 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-   if not self.modules['FetchChecks'].src_uri_error:
-   
self.modules['ThirdPartyMirrors'].check(dynamic_data['ebuild'].metadata, 
dynamic_data['ebuild'].relative_path)
-
if dynamic_data['ebuild'].metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", 
dynamic_data['ebuild'].relative_path)
 



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

2016-01-05 Thread Brian Dolbec
commit: 1fd217a14abd34e98c9bbee4ea5843b7460a6d4b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 11:31:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:21 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1fd217a1

scanner.py: Migrate another metadata check to ebuild_metadata

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

diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py 
b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 
1))
+   if ebuild.metadata.get("PROVIDE"):
+   self.qatracker.add_error("virtual.oldstyle", 
ebuild.relative_path)
+
return {'continue': False}
 
@property



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

2016-01-05 Thread Brian Dolbec
commit: 304a5064770769aa4d01bd5a5385384dae4ba681
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:23:52 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:24 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=304a5064

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 
 pym/repoman/modules/scan/directories/mtime.py| 24 
 pym/repoman/scanner.py   |  5 +
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py 
b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_kwargs': {
},
},
+   'mtime-module': {
+   'name': "mtime",
+   'class': "MtimeChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_kwargs': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py 
b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+   def __init__(self, **kwargs):
+   self.vcs_settings = kwargs.get('vcs_settings')
+
+   def check(self, **kwargs):
+   ebuild = kwargs.get('ebuild')
+   changed = kwargs.get('changed')
+   pkg = kwargs.get('pkg')
+   if not self.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
+   return {'continue': False}
+
+   @property
+   def runInPkgs(self):
+   return (False, [])
+
+   @property
+   def runInEbuilds(self):
+   return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 457bdcb..7640dca 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -295,6 +295,7 @@ class Scanner(object):
('arches', 'ArchChecks'), ('depend', 
'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 
'RubyEclassChecks'),
('license', 'LicenseChecks'), ('restrict', 
'RestrictChecks'),
+   ('mtime', 'MtimeChecks'),
]:
if mod[0]:
mod_class = 
MODULE_CONTROLLER.get_class(mod[0])
@@ -326,10 +327,6 @@ class Scanner(object):
print(" finished plugin loop, continuing...")
 
# Syntax Checks
-   if not self.vcs_settings.vcs_preserves_mtime:
-   if dynamic_data['ebuild'].ebuild_path not in 
self.changed.new_ebuilds and \
-   dynamic_data['ebuild'].ebuild_path not 
in self.changed.ebuilds:
-   dynamic_data['pkg'].mtime = None
try:
# All ebuilds should have utf_8 encoding.
f = io.open(



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

2016-01-05 Thread Brian Dolbec
commit: f433057364a0799fccb2d56581e497ce6f507d4f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Jan  6 03:08:44 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:25 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f4330573

repoman: Delete more unused subpkgs

 pym/repoman/modules/fix/__init__.py  | 0
 pym/repoman/modules/full/__init__.py | 0
 pym/repoman/modules/manifest/__init__.py | 0
 3 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/repoman/modules/fix/__init__.py 
b/pym/repoman/modules/fix/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/full/__init__.py 
b/pym/repoman/modules/full/__init__.py
deleted file mode 100644
index e69de29..000

diff --git a/pym/repoman/modules/manifest/__init__.py 
b/pym/repoman/modules/manifest/__init__.py
deleted file mode 100644
index e69de29..000



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

2016-01-05 Thread Brian Dolbec
commit: 02706a4e6788795c935d285c9c9c0b00e52acb98
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:23 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=02706a4e

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  8 
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/license.py 
b/pym/repoman/checks/ebuilds/variables/license.py
deleted file mode 100644
index bdc859c..000
--- a/pym/repoman/checks/ebuilds/variables/license.py
+++ /dev/null
@@ -1,47 +0,0 @@
-
-'''description.py
-Perform checks on the LICENSE variable.
-'''
-
-# import our initialized portage instance
-from repoman._portage import portage
-
-
-class LicenseChecks(object):
-   '''Perform checks on the LICENSE variable.'''
-
-   def __init__(self, qatracker, liclist, liclist_deprecated):
-   '''
-   @param qatracker: QATracker instance
-   @param liclist: List of licenses.
-   @param liclist: List of deprecated licenses.
-   '''
-   self.qatracker = qatracker
-   self.liclist = liclist
-   self.liclist_deprecated = liclist_deprecated
-
-   def check(
-   self, pkg, package, ebuild, y_ebuild):
-   '''
-   @param pkg: Package in which we check (object).
-   @param package: Package in which we check (string).
-   @param ebuild: Ebuild which we check (object).
-   @param y_ebuild: Ebuild which we check (string).
-   '''
-
-   # Parse the LICENSE variable, remove USE conditions and flatten 
it.
-   licenses = portage.dep.use_reduce(
-   pkg._metadata["LICENSE"], matchall=1, flat=True)
-
-   # Check each entry to ensure that it exists in 
${PORTDIR}/licenses/.
-   for lic in licenses:
-   # Need to check for "||" manually as no portage
-   # function will remove it without removing values.
-   if lic not in self.liclist and lic != "||":
-   self.qatracker.add_error(
-   "LICENSE.invalid",
-   package + "/" + y_ebuild + ".ebuild: 
%s" % lic)
-   elif lic in self.liclist_deprecated:
-   self.qatracker.add_error(
-   "LICENSE.deprecated",
-   "%s: %s" % (ebuild.relative_path, lic))

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index 2506521..ed0c59d 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -34,6 +34,14 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'class': "LicenseChecks",
+   'description': doc,
+   'functions': ['check'],
+   'func_desc': {
+   },
+   },
}
 }
 

diff --git a/pym/repoman/modules/scan/metadata/license.py 
b/pym/repoman/modules/scan/metadata/license.py
new file mode 100644
index 000..b022b20
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -0,0 +1,53 @@
+
+'''license.py
+Perform checks on the LICENSE variable.
+'''
+
+# import our initialized portage instance
+from repoman._portage import portage
+
+
+class LicenseChecks(object):
+   '''Perform checks on the LICENSE variable.'''
+
+   def __init__(self, **kwargs):
+   '''
+   @param qatracker: QATracker instance
+   @param repo_metadata: dictionary of various repository items.
+   '''
+   self.qatracker = kwargs.get('qatracker')
+   self.repo_metadata = kwargs.get('repo_metadata')
+
+   def check(self, **kwargs):
+   '''
+   @param xpkg: Package in which we check (string).
+   @param ebuild: Ebuild which we check (object).
+   @param y_ebuild: Ebuild which we check (string).
+   '''
+   xpkg = kwargs.get('xpkg')
+   ebuild = kwargs.get('ebuild')
+   y_ebuild = kwargs.get('y_ebuild')
+   if not kwargs.get('badlicsyntax'):
+   # Parse the LICENSE variable, remove USE conditions and 

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

2016-01-05 Thread Brian Dolbec
commit: a490f6e830d263a9ce055c61bd4e794943204e09
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 21:19:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Jan  6 04:08:23 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a490f6e8

repoman: Migrate some additional Dependency code to the plugin

 pym/repoman/modules/scan/depend/depend.py | 13 -
 pym/repoman/scanner.py| 16 +++-
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/pym/repoman/modules/scan/depend/depend.py 
b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
 
 from _emerge.Package import Package
 
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, 
b))
-   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list}
+
+   # data required for some other tests
+   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
+
+   return {'continue': False, 'unknown_pkgs': unknown_pkgs, 
'type_list': type_list,
+   'badlicsyntax': badlicsyntax, 'baddepsyntax': 
baddepsyntax}
 
@property
def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 11f7d93..2b0a748 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -331,21 +331,11 @@ class Scanner(object):
 
print(" finished plugin loop, continuing...")
 
-   baddepsyntax = False
-   badlicsyntax = False
-   badprovsyntax = False
-   # catpkg = catdir + "/" + y_ebuild
-
-   badlicsyntax = len([z for z in 
dynamic_data['type_list'] if z == "LICENSE"])
-   badprovsyntax = len([z for z in 
dynamic_data['type_list'] if z == "PROVIDE"])
-   baddepsyntax = len(dynamic_data['type_list']) != 
badlicsyntax + badprovsyntax
-   badlicsyntax = badlicsyntax > 0
-   badprovsyntax = badprovsyntax > 0
 
used_useflags = 
used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
 
# license checks
-   if not badlicsyntax:
+   if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], 
xpkg, dynamic_data['ebuild'], y_ebuild)
 
self.restrictcheck.check(dynamic_data['pkg'], xpkg, 
dynamic_data['ebuild'], y_ebuild)
@@ -451,7 +441,7 @@ class Scanner(object):
dep_settings.usemask = 
dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], 
stable=dep_settings._parent_stable)
 
-   if not baddepsyntax:
+   if not dynamic_data['baddepsyntax']:
ismasked = not 
dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in 
self.portdb.xmatch("match-visible",
Atom("%s::%s" % 
(dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -541,7 +531,7 @@ class Scanner(object):
% 
(dynamic_data['ebuild'].relative_path, mytype, keyword,

prof, pformat(atoms, indent=6)))
 
-   if not baddepsyntax and dynamic_data['unknown_pkgs']:
+   if not dynamic_data['baddepsyntax'] and 
dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in 
dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, 
set()).add(atom)



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

2015-12-30 Thread Brian Dolbec
commit: 018e8a127455b18593d8c07a28df3eef665a7332
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Dec 30 23:24:22 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec 30 23:24:22 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=018e8a12

initial repoman stage2 vcs plugin system started

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

 pym/repoman/actions.py   |   5 +-
 pym/repoman/main.py  |   9 +-
 pym/repoman/modules/commit/repochecks.py |   5 +-
 pym/repoman/scanner.py   |   9 +-
 pym/repoman/vcs/__init__.py  |  14 +++
 pym/repoman/vcs/modules/__init__.py  |   1 +
 pym/repoman/vcs/modules/bzr/__init__.py  |  23 +
 pym/repoman/vcs/modules/bzr/bzrstatus.py |  36 
 pym/repoman/vcs/modules/cvs/__init__.py  |  23 +
 pym/repoman/vcs/modules/cvs/cvsstatus.py | 102 +
 pym/repoman/vcs/modules/git/__init__.py  |  23 +
 pym/repoman/vcs/modules/git/gitstatus.py |  46 ++
 pym/repoman/vcs/modules/hg/__init__.py   |  23 +
 pym/repoman/vcs/modules/hg/hgstatus.py   |  30 ++
 pym/repoman/vcs/modules/svn/__init__.py  |  23 +
 pym/repoman/vcs/modules/svn/svnstatus.py | 121 
 pym/repoman/vcs/settings.py  |  74 +++
 pym/repoman/vcs/vcs.py   | 152 ---
 pym/repoman/vcs/vcsstatus.py | 106 +
 19 files changed, 556 insertions(+), 269 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index f461703..a17c205 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -30,7 +30,7 @@ from repoman._subprocess import repoman_popen, 
repoman_getstatusoutput
 from repoman.errors import err
 from repoman.gpg import gpgsign, need_signature
 from repoman import utilities
-from repoman.vcs.vcs import git_supports_gpg_sign, vcs_files_to_cps
+from repoman.vcs.vcs import vcs_files_to_cps
 
 bad = create_color_func("BAD")
 
@@ -662,8 +662,7 @@ class Actions(object):
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():
+   if 
self.repo_settings.repo_config.sign_commit and not 
self.vcs_settings.status.supports_gpg_sign():
# Inform user that newer git is 
needed (bug #403323).
logging.error(
"Git >=1.7.9 is 
required for signed commits!")

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 00d48e7..c41e943 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -33,7 +33,7 @@ from repoman.qa_data import (
 from repoman.repos import RepoSettings
 from repoman.scanner import Scanner
 from repoman import utilities
-from repoman.vcs.vcs import VCSSettings
+from repoman.vcs.settings import VCSSettings
 
 if sys.hexversion >= 0x300:
basestring = str
@@ -101,7 +101,7 @@ def repoman_main(argv):
# Perform the main checks
scanner = Scanner(repo_settings, myreporoot, config_root, options,
vcs_settings, mydir, env)
-   qatracker, can_force = scanner.scan_pkgs(can_force)
+   can_force = scanner.scan_pkgs(can_force)
 
commitmessage = None
 
@@ -122,7 +122,7 @@ def repoman_main(argv):
sys.exit(result['fail'])
 
for x in qacats:
-   if x not in qatracker.fails:
+   if x not in vcs_settings.qatracker.fails:
continue
result['warn'] = 1
if x not in qawarnings:
@@ -153,7 +153,8 @@ def repoman_main(argv):
 
format_output = format_outputs.get(
options.output_style, format_outputs['default'])
-   format_output(f, qatracker.fails, result['full'], result['fail'], 
options, qawarnings)
+   format_output(f, vcs_settings.qatracker.fails, result['full'],
+   result['fail'], options, qawarnings)
 
style_file.flush()
del console_writer, f, style_file

diff --git a/pym/repoman/modules/commit/repochecks.py 
b/pym/repoman/modules/commit/repochecks.py
index 163466d..ff7f604 100644
--- a/pym/repoman/modules/commit/repochecks.py
+++ b/pym/repoman/modules/commit/repochecks.py
@@ -5,7 +5,6 @@ from __future__ import print_function, unicode_literals
 from portage.output import red
 
 from repoman.errors import err
-from repoman.vcs.vcs import detect_vcs_conflicts
 
 
 def commit_check(repolevel, reposplit):
@@ -32,4 +31,6 @@ def commit_check(repolevel, reposplit):
 
 def 

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

2015-12-30 Thread Brian Dolbec
commit: 0a58076e2ced55ca8549e2a296d3e69c3a9bbf62
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Dec 29 23:18:38 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Dec 29 23:18:38 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0a58076e

repoman/repos.py: Fix typo

Signed-off-by: Brian Dolbec  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,



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

2015-09-22 Thread Brian Dolbec
commit: cf957998881fd19205c28bcc1568f9dce949545f
Author: Brian Dolbec  gentoo  org>
AuthorDate: Tue Sep 22 13:35:26 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Sep 22 13:35:26 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cf957998

repoman: Add missed print_function, unicode_literals imports to files using 
print()

 pym/repoman/actions.py   | 2 ++
 pym/repoman/gpg.py   | 2 ++
 pym/repoman/modules/commit/repochecks.py | 2 ++
 pym/repoman/profile.py   | 2 ++
 pym/repoman/scanner.py   | 2 ++
 pym/repoman/vcs/vcs.py   | 2 ++
 6 files changed, 12 insertions(+)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 9d97b20..9dda88e 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 import errno
 import io
 import logging

diff --git a/pym/repoman/gpg.py b/pym/repoman/gpg.py
index a6c4c5f..90fe749 100644
--- a/pym/repoman/gpg.py
+++ b/pym/repoman/gpg.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 import errno
 import logging
 import subprocess

diff --git a/pym/repoman/modules/commit/repochecks.py 
b/pym/repoman/modules/commit/repochecks.py
index 2839864..8019e28 100644
--- a/pym/repoman/modules/commit/repochecks.py
+++ b/pym/repoman/modules/commit/repochecks.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 from portage.output import red
 
 from repoman.errors import err

diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py
index 0aedbe8..3634fb9 100644
--- a/pym/repoman/profile.py
+++ b/pym/repoman/profile.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 from portage import normalize_path
 from portage import os
 from portage.output import red

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 44ff33b..ace878a 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 import copy
 import io
 import logging

diff --git a/pym/repoman/vcs/vcs.py b/pym/repoman/vcs/vcs.py
index 180692c..9b77e8e 100644
--- a/pym/repoman/vcs/vcs.py
+++ b/pym/repoman/vcs/vcs.py
@@ -1,4 +1,6 @@
 
+from __future__ import print_function, unicode_literals
+
 import collections
 import logging
 import re



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

2015-09-21 Thread Brian Dolbec
commit: f702bf4c75b03b19e214c6d9f5a376afa647dce5
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Sep 19 03:59:10 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 21 23:42:46 2015 +
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")
+   

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

2015-09-21 Thread Brian Dolbec
commit: 8553e18d54009d5fb804a7a9d65ae0d8f7de2cba
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Sep 19 00:48:05 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 21 23:42:46 2015 +
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 >= 0x300:
-   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(
-   

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

2015-09-21 Thread Brian Dolbec
commit: 56b11d66acf0d0cb92e54f7e43e1b963320df5b2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Sep 17 04:07:02 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 21 23:42:45 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=56b11d66

repoman: Create repoman_main()

Create an initial repoamn_main()
Update bin/repoman script
Clean up unused variables
Move commitmessage from global scope to the function.
Clean up some demarcation lines.

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

 bin/repoman |5 +-
 pym/repoman/main.py | 2728 +--
 2 files changed, 1362 insertions(+), 1371 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 4e18b6c..05d842f 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -30,11 +30,10 @@ pym_path = 
osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
 sys.path.insert(0, pym_path)
 import portage
 portage._internal_caller = True
-#from repoman.main import repoman_main
+from repoman.main import repoman_main
 
 try:
-   #repoman_main(sys.argv[1:])
-   from repoman import main
+   repoman_main(sys.argv[1:])
 except IOError as e:
if e.errno == errno.EACCES:
print("\nRepoman: Need user access")

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 006afc9..e3d0472 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -88,8 +88,6 @@ if sys.hexversion >= 0x300:
 
 util.initialize_logger()
 
-commitmessage = None
-
 bad = create_color_func("BAD")
 
 live_eclasses = portage.const.LIVE_ECLASSES
@@ -102,1487 +100,1481 @@ 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(
-   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)
-
-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
+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)
 
-portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
-if portdir is None:
-   sys.exit(1)
+   if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
+   repoman_settings.get('TERM') == 'dumb' or \
+   not sys.stdout.isatty():
+   nocolor()
 
-myreporoot = os.path.basename(portdir_overlay)
-myreporoot += mydir[len(portdir_overlay):]
-##
+   options, arguments = parse_args(
+   sys.argv, qahelp, repoman_settings.get("REPOMAN_DEFAULT_OPTS", 
""))
 
-vcs_settings = VCSSettings(options, repoman_settings)
+   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
 
-repo_settings = RepoSettings(
-   config_root, portdir, portdir_overlay,
-   repoman_settings, vcs_settings, options, qawarnings)
-
-repoman_settings = repo_settings.repoman_settings
+   portdir, portdir_overlay, mydir = 
utilities.FindPortdir(repoman_settings)
+   if portdir is None:
+   sys.exit(1)
 
-portdb = repo_settings.portdb
-##
+   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,
+ 

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

2015-09-21 Thread Brian Dolbec
commit: 56cd8391579d206245232b0766d7cfe6c6b82dbc
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Sep 19 04:03:54 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 21 23:42:47 2015 +
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:



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

2015-09-21 Thread Brian Dolbec
commit: 3f47be32adcee89a34234d594b04e81089ea85ce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Sep 19 04:25:34 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 21 23:42:47 2015 +
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:
+
+   

<    1   2   3   4   5   6   7   8   9   10   >