* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-10 3:25 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:25 UTC (permalink / raw
To: gentoo-commits
commit: 2e358284573f56c6b5b67a736e38852fc55f55a7
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 17:36:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:49 2016 +0000
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 Scanner(object):
myqakey = var + ".virtual"
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
- self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
-
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'])
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-10 3:25 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:25 UTC (permalink / raw
To: gentoo-commits
commit: 1f41972b0b5dc6a61853935dbbbf9f0bd033918b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 10:03:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:48 2016 +0000
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..0000000
--- 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 0000000..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 0000000..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
+
+ @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 e5c185b..a8aa2f3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -25,7 +25,6 @@ from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
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.eapi import EAPIChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
@@ -229,7 +228,6 @@ class Scanner(object):
self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
- self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -312,7 +310,8 @@ 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')]:
+ for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
+ ('eapi', 'EAPIChecks')]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -339,7 +338,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- self.eapicheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
for k, v in dynamic_data['ebuild'].metadata.items():
if not isinstance(v, basestring):
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-10 3:26 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:26 UTC (permalink / raw
To: gentoo-commits
commit: c45eaee3439b05bd90cbaf0000a2b48d3e2bbd03
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 23:10:48 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:51 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=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', 'RubyEclassChecks'),
- ('license', 'LicenseChecks'),
+ ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -323,8 +320,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
-
# Syntax Checks
if not self.vcs_settings.vcs_preserves_mtime:
if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-11 6:31 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-11 6:31 UTC (permalink / raw
To: gentoo-commits
commit: 6bc227162986a9d79e72a79e1cae393c45bb910f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 10:03:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:32 2016 +0000
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..0000000
--- 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 0000000..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 0000000..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
+
+ @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 e5c185b..a8aa2f3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -25,7 +25,6 @@ from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
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.eapi import EAPIChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
@@ -229,7 +228,6 @@ class Scanner(object):
self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
- self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -312,7 +310,8 @@ 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')]:
+ for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
+ ('eapi', 'EAPIChecks')]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -339,7 +338,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- self.eapicheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
for k, v in dynamic_data['ebuild'].metadata.items():
if not isinstance(v, basestring):
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-11 6:31 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-11 6:31 UTC (permalink / raw
To: gentoo-commits
commit: 31fd105a9897fee5a77a893e23062c37195767e4
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 17:36:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:33 2016 +0000
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 Scanner(object):
myqakey = var + ".virtual"
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
- self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
-
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'])
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: 6eb7f0c6c02c08cafcbf661da756b6c5b15dcf5e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 10:03:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:15 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=6eb7f0c6
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..0000000
--- 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 0000000..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 0000000..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
+
+ @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 e5c185b..a8aa2f3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -25,7 +25,6 @@ from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
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.eapi import EAPIChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
@@ -229,7 +228,6 @@ class Scanner(object):
self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
- self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -312,7 +310,8 @@ 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')]:
+ for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
+ ('eapi', 'EAPIChecks')]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -339,7 +338,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- self.eapicheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
for k, v in dynamic_data['ebuild'].metadata.items():
if not isinstance(v, basestring):
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-21 18:30 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 196d6aa6d378c3f2ecd08a45c071c9fc568f2731
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 23:09:27 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 00:35:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=196d6aa6
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..0000000
--- 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 0000000..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 flatten it.
+ licenses = portage.dep.use_reduce(
+ ebuild.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.repo_metadata['liclist'] and lic != "||":
+ self.qatracker.add_error("LICENSE.invalid",
+ "%s/%s.ebuild: %s" % (xpkg, y_ebuild, lic))
+ elif lic in self.repo_metadata['lic_deprecated']:
+ self.qatracker.add_error("LICENSE.deprecated",
+ "%s: %s" % (ebuild.relative_path, lic))
+ 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 d5faded..1f792bd 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.license import LicenseChecks
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
@@ -210,7 +209,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = mod_class(**self.kwargs)
# initialize our checks classes here before the big xpkg loop
- self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -297,6 +295,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
+ ('license', 'LicenseChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -324,10 +323,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # license checks
- 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)
# Syntax Checks
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 705c1e23c2599a9b990df5b5ba5652b5f2a3accb
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 23:09:27 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:13 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=705c1e23
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..0000000
--- 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 0000000..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 flatten it.
+ licenses = portage.dep.use_reduce(
+ ebuild.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.repo_metadata['liclist'] and lic != "||":
+ self.qatracker.add_error("LICENSE.invalid",
+ "%s/%s.ebuild: %s" % (xpkg, y_ebuild, lic))
+ elif lic in self.repo_metadata['lic_deprecated']:
+ self.qatracker.add_error("LICENSE.deprecated",
+ "%s: %s" % (ebuild.relative_path, lic))
+ 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 d5faded..1f792bd 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.license import LicenseChecks
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
@@ -210,7 +209,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = mod_class(**self.kwargs)
# initialize our checks classes here before the big xpkg loop
- self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -297,6 +295,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
+ ('license', 'LicenseChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -324,10 +323,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # license checks
- 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)
# Syntax Checks
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 9ea80b2623c9ffb895ce8ed93d5271765c08ccde
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 17:36:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ea80b26
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 Scanner(object):
myqakey = var + ".virtual"
self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
- self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
-
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'])
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 48681d6afce147d3cf579e350250f60bd03199e7
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 23:10:48 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:37 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=48681d6a
repoman: Migrate RestrictChecks to a plugin module
pym/repoman/modules/scan/metadata/__init__.py | 9 +++++++
.../scan/metadata}/restrict.py | 29 +++++++++++++++-------
pym/repoman/scanner.py | 9 +------
3 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index c8f3609..4f376e1 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -46,6 +46,15 @@ module_spec = {
'func_desc': {
},
},
+ 'restrict-metadata': {
+ 'name': "restrict",
+ 'sourcefile': "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 27cd31d..c8fc245 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
@@ -211,10 +210,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:
@@ -298,7 +293,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
- ('license', 'LicenseChecks'),
+ ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -326,8 +321,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
-
# Syntax Checks
if not self.vcs_settings.vcs_preserves_mtime:
if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-03-12 18:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 18:30 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2016-03-12 18:10 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-10 3:25 Brian Dolbec
2016-01-10 3:25 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox