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

2016-01-31 Thread Brian Dolbec
commit: 3405ed487c2d9788ff575f3d20e25fb8d7f086aa
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jan 30 20:25:22 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3405ed48

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  9 +
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 63 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 83aac7f..c8f3609 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -37,6 +37,15 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'sourcefile': "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 

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

2016-01-31 Thread Brian Dolbec
commit: 3d9d113df9eae165c6b1ecaeda0601708ad8a8df
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 17:36:26 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jan 30 20:25:06 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d9d113d

repoman: Migrate DescriptionChecks to the plugin system

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

diff --git a/pym/repoman/modules/scan/metadata/__init__.py 
b/pym/repoman/modules/scan/metadata/__init__.py
index bacedf5..83aac7f 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -28,6 +28,15 @@ module_spec = {
'func_desc': {
},
},
+   'description-metadata': {
+   'name': "description",
+   'sourcefile': "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 6321f0b..f4c21d0 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
@@ -219,7 +218,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)
 
@@ -304,6 +302,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 = 

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

2016-01-22 Thread Brian Dolbec
commit: 4515c25be6359b7fa76b1b56df46b823c52cfd63
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jan 23 01:31:15 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4515c25b

repoman: Migrate license checks to a plugin module

 pym/repoman/checks/ebuilds/variables/license.py | 47 --
 pym/repoman/modules/scan/metadata/__init__.py   |  9 +
 pym/repoman/modules/scan/metadata/license.py| 53 +
 pym/repoman/scanner.py  |  7 +---
 4 files changed, 63 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 83aac7f..c8f3609 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -37,6 +37,15 @@ module_spec = {
'func_desc': {
},
},
+   'license-metadata': {
+   'name': "license",
+   'sourcefile': "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 

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

2016-01-11 Thread Brian Dolbec
commit: 534ef968d08e289e4c5d349aaa8e26b8e312b748
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:09:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jan 11 08:00:18 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=534ef968

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/checks/ebuilds/variables/, pym/repoman/modules/scan/metadata/, ...

2016-01-11 Thread Brian Dolbec
commit: f43380002e5bdc4c3f14f03eabaaaf12251a671c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Jan  3 23:10:48 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Jan 11 08:00:18 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f4338000

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/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/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