* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/, ...
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 38712a290941b001a8f14e9c068c604d291142d4
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: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=38712a29
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/modules/scan/metadata/, ...
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: ac5c53283cc17ba5cabc21d65db5ab86c3f95f70
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: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac5c5328
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/modules/scan/metadata/, ...
@ 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: 15c10f7edd9677e9f44eb60d4f17eaf2d3379e13
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: Thu Jan 21 00:35:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=15c10f7e
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/modules/scan/metadata/, ...
@ 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: d9c380a02b62fa979f799e6436095f4c81f7b981
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: Thu Jan 21 00:35:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d9c380a0
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/modules/scan/metadata/, ...
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 72165d8e08e9b32312db1d7437c4ab15549d91f4
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: Sat Jan 23 01:25:16 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=72165d8e
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 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/modules/scan/metadata/, ...
@ 2016-01-30 6:58 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-30 6:58 UTC (permalink / raw
To: gentoo-commits
commit: 30dc26f0a6ed55b5b2c9449464e1e524b7188da7
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: Sat Jan 30 06:33:42 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=30dc26f0
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 28142ae..27c1be9 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 = MODULE_CONTROLLER.get_class(mod[0])
@@ -350,8 +349,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/modules/scan/metadata/, ...
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 2276e88232518f103aaab5484bb65dde2354e288
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: Sat Jan 30 07:50:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2276e882
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..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 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 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 c8539cb..55f3d56 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
@@ -213,7 +212,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)
@@ -300,6 +298,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])
@@ -327,10 +326,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/modules/scan/metadata/, ...
@ 2016-03-07 21:53 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
To: gentoo-commits
commit: aa2cb7a3259c776a2434282065aea5f339346bd8
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: Mon Mar 7 21:20:54 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa2cb7a3
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..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 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 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 9b42696..8d83cac 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
@@ -213,7 +212,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)
@@ -300,6 +298,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])
@@ -327,10 +326,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/modules/scan/metadata/, ...
@ 2016-03-07 21:53 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
To: gentoo-commits
commit: d3caf31f0bdf92dd87d313ca552f1269c26682e8
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: Mon Mar 7 21:20:55 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d3caf31f
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 8d83cac..92e2abd 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
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/, ...
@ 2016-04-21 16:54 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-04-21 16:54 UTC (permalink / raw
To: gentoo-commits
commit: d97a0ffb07536f475cec4b33151446a5da9a83c1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 15 18:40:06 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 16:49:29 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d97a0ffb
repoman: Create a new boolean Fuse type
Create a Fuse type which implememts a boolean as a one time fuse.
The Fuse is initialized True, then is pop()'d to become False.
Once the Fuse is blown, it can not be reset to True.
Convert the use of the dynamic_data variable 'allvalid' to a Fuse instance.
pym/repoman/fuse.py | 68 +++++++++++++++++++++++++++++
pym/repoman/modules/scan/ebuild/ebuild.py | 7 ++-
pym/repoman/modules/scan/ebuild/isebuild.py | 13 +++---
pym/repoman/modules/scan/metadata/unused.py | 2 +-
pym/repoman/scanner.py | 2 +
5 files changed, 83 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/fuse.py b/pym/repoman/fuse.py
new file mode 100644
index 0000000..ac864fd
--- /dev/null
+++ b/pym/repoman/fuse.py
@@ -0,0 +1,68 @@
+
+'''
+fuse.py
+
+A tiny one-time-fuse class that uses a boolean to mimic the property of
+an electrical fuse. IT's good (True) until it is popped (bad, False).
+It is not resetable.
+'''
+
+
+class Fuse(object):
+ '''A One time fuse style boolean instance'''
+
+ __slots__ = ('_state')
+
+ def __init__(self):
+ self._state = True
+
+ def pop(self):
+ '''Blow's the fuse state (makes it False)'''
+ self._state = False
+
+ def __repr__(self):
+ '''x.__repr__() <==> repr(x)'''
+ return repr(self._state>0)
+
+ def __str__(self):
+ '''x.__str__() <==> str(x)'''
+ return ['False', 'True'][self._state]
+
+ def __bool__(self):
+ '''self != 0'''
+ return self._state != 0
+
+ def __nonzero__(self):
+ '''self != 0'''
+ return self._state != 0
+
+ def __abs__(self):
+ '''x.__abs__() <==> abs(x)'''
+ return [0, 1] [self._state]
+
+ def __int__(self):
+ '''int(self)'''
+ return [0, 1][self._state]
+
+ def __eq__(self, value):
+ '''Return self==value.'''
+ return self._state == value
+
+ def __ne__(self, value):
+ '''Return self!=value.'''
+ return self._state != value
+
+ def __ge__(self, value):
+ '''Return self>=value.'''
+ return self._state >= value
+
+ def __gt__(self, value):
+ return self._state > value
+
+ def __le__(self, value):
+ '''Return self<=value.'''
+ return self._state <= value
+
+ def __lt__(self, value):
+ '''Return self<value.'''
+ return self._state < value
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
index e9a2cdd..540411f 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -127,13 +127,16 @@ class Ebuild(ScanBase):
def pkg_invalid(self, **kwargs):
'''Sets some pkg info and checks for invalid packages
- @returns: dictionary, including {pkg object, allvalid}
+ @param validity_fuse: Fuse instance
+ @returns: dictionary, including {pkg object}
'''
+ fuse = kwargs.get('validity_fuse')
if self.pkg.invalid:
for k, msgs in self.pkg.invalid.items():
for msg in msgs:
self.qatracker.add_error(k, "%s: %s" % (self.relative_path, msg))
- return {'continue': True, 'allvalid': False, 'pkg': self.pkg}
+ fuse.pop()
+ return {'continue': True, 'pkg': self.pkg}
return {'continue': False, 'pkg': self.pkg}
@property
diff --git a/pym/repoman/modules/scan/ebuild/isebuild.py b/pym/repoman/modules/scan/ebuild/isebuild.py
index 1dffc6a..474a874 100644
--- a/pym/repoman/modules/scan/ebuild/isebuild.py
+++ b/pym/repoman/modules/scan/ebuild/isebuild.py
@@ -35,15 +35,16 @@ class IsEbuild(ScanBase):
@param checkdirlist: list of files in the current package directory
@param checkdir: current package directory path
@param xpkg: current package directory being checked
- @returns: dictionary, including {pkgs, allvalid, can_force}
+ @param validity_fuse: Fuse instance
+ @returns: dictionary, including {pkgs, can_force}
'''
checkdirlist = kwargs.get('checkdirlist')
checkdir = kwargs.get('checkdir')
xpkg = kwargs.get('xpkg')
+ fuse = kwargs.get('validity_fuse')
self.continue_ = False
ebuildlist = []
pkgs = {}
- allvalid = True
for y in checkdirlist:
file_is_ebuild = y.endswith(".ebuild")
file_should_be_non_executable = y in no_exec or file_is_ebuild
@@ -62,15 +63,15 @@ class IsEbuild(ScanBase):
try:
myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
except KeyError:
- allvalid = False
+ fuse.pop()
self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
continue
except IOError:
- allvalid = False
+ fuse.pop()
self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
continue
if not portage.eapi_is_supported(myaux["EAPI"]):
- allvalid = False
+ fuse.pop()
self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
continue
pkgs[pf] = Package(
@@ -85,7 +86,7 @@ class IsEbuild(ScanBase):
# positives confuse users.
self.continue_ = True
- return {'continue': self.continue_, 'pkgs': pkgs, 'allvalid': allvalid,
+ return {'continue': self.continue_, 'pkgs': pkgs,
'can_force': not self.continue_}
@property
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
index 2ca7466..9ff7e56 100644
--- a/pym/repoman/modules/scan/metadata/unused.py
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -13,7 +13,7 @@ class UnusedCheck(ScanBase):
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'):
+ if kwargs.get('validity_fuse'):
for myflag in muselist.difference(used_useflags):
self.qatracker.add_error(
"metadata.warning",
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 86e389a..9c6f5ac 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -9,6 +9,7 @@ import portage
from portage import normalize_path
from portage import os
from portage.output import green
+from repoman.fuse import Fuse
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -232,6 +233,7 @@ class Scanner(object):
'repolevel': self.repolevel,
'catdir': catdir,
'pkgdir': pkgdir,
+ 'validity_fuse': Fuse()
}
# need to set it up for ==> self.modules or some other ordered list
for mod in ['Manifests', 'IsEbuild', 'KeywordChecks', 'FileChecks',
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-04-21 16:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-23 1:42 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/, Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2016-04-21 16:54 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox