* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-06 4:21 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-06 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 9fedd97887e6af9e54e02ea6ea10d6673a909dde
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: Wed Jan 6 04:08:21 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fedd978
repoman: Migrate DescriptionChecks to the plugin system
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++++
.../scan/metadata}/description.py | 20 ++++++++++++++------
pym/repoman/scanner.py | 5 +----
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index eba6565..2506521 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'description-metadata': {
+ 'name': "description",
+ 'class': "DescriptionChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/modules/scan/metadata/description.py
similarity index 66%
rename from pym/repoman/checks/ebuilds/variables/description.py
rename to pym/repoman/modules/scan/metadata/description.py
index a2b1057..3570607 100644
--- a/pym/repoman/checks/ebuilds/variables/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len
class DescriptionChecks(object):
'''Perform checks on the DESCRIPTION variable.'''
- def __init__(self, qatracker):
+ def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
- self.qatracker = qatracker
+ self.qatracker = kwargs.get('qatracker')
- def check(self, pkg, ebuild):
+ def checkTooLong(self, **kwargs):
'''
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
- self._checkTooLong(pkg, ebuild)
-
- def _checkTooLong(self, pkg, ebuild):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,3 +29,12 @@ class DescriptionChecks(object):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), max_desc_len))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.checkTooLong])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f56c5c..295d35e 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.check_missingslot import check_missingslot
-from repoman.checks.ebuilds.variables.description import DescriptionChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
@@ -214,7 +213,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = mod_class(**self.kwargs)
# initialize our checks classes here before the big xpkg loop
- self.descriptioncheck = DescriptionChecks(self.qatracker)
self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
self.restrictcheck = RestrictChecks(self.qatracker)
@@ -301,6 +299,7 @@ class Scanner(object):
for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
+ ('description', 'DescriptionChecks'),
]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
print("Initializing class name:", mod_class.__name__)
@@ -330,8 +329,6 @@ class Scanner(object):
print("**** finished plugin loop, continuing...")
- self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
-
self.modules['KeywordChecks'].check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, dynamic_data['ebuild'].archs, self.changed,
dynamic_data['live_ebuild'], self.repo_metadata['kwlist'], self.profiles)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-06 4:21 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-06 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 0187e2e6559e0d2e66b9c27c11228400024199a6
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: Wed Jan 6 04:08:23 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0187e2e6
repoman: Migrate RestrictChecks to a plugin module
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
.../scan/metadata}/restrict.py | 29 +++++++++++++++-------
pym/repoman/scanner.py | 9 +------
3 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index ed0c59d..6ab44f6 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -42,6 +42,14 @@ module_spec = {
'func_desc': {
},
},
+ 'restrict-metadata': {
+ 'name': "restrict",
+ 'class': "RestrictChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py
similarity index 54%
rename from pym/repoman/checks/ebuilds/variables/restrict.py
rename to pym/repoman/modules/scan/metadata/restrict.py
index 215b792..93ca298 100644
--- a/pym/repoman/checks/ebuilds/variables/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict
class RestrictChecks(object):
'''Perform checks on the RESTRICT variable.'''
- def __init__(self, qatracker):
+ def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
- self.qatracker = qatracker
+ self.qatracker = kwargs.get('qatracker')
- def check(self, pkg, package, ebuild, y_ebuild):
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ ebuild = kwargs.get('ebuild')
+ y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
try:
myrestrict = portage.dep.use_reduce(
- pkg._metadata["RESTRICT"], matchall=1, flat=True)
+ ebuild.metadata["RESTRICT"], matchall=1, flat=True)
except portage.exception.InvalidDependString as e:
- self. qatracker.add_error(
- "RESTRICT.syntax",
+ self.qatracker.add_error("RESTRICT.syntax",
"%s: RESTRICT: %s" % (ebuild.relative_path, e))
del e
@@ -36,6 +38,15 @@ class RestrictChecks(object):
if mybadrestrict:
for mybad in mybadrestrict:
- self.qatracker.add_error(
- "RESTRICT.invalid",
- package + "/" + y_ebuild + ".ebuild: %s" % mybad)
+ self.qatracker.add_error("RESTRICT.invalid",
+ "%s/%s.ebuild: %s" % (xpkg, y_ebuild, mybad))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
+
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index ea1869f..457bdcb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -210,10 +209,6 @@ class Scanner(object):
print("Initializing class name:", mod_class.__name__)
self.modules[mod_class.__name__] = mod_class(**self.kwargs)
- # initialize our checks classes here before the big xpkg loop
- self.restrictcheck = RestrictChecks(self.qatracker)
-
-
def scan_pkgs(self, can_force):
dynamic_data = {'can_force': can_force}
for xpkg in self.effective_scanlist:
@@ -299,7 +294,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
('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])
@@ -330,8 +325,6 @@ class Scanner(object):
print("**** finished plugin loop, continuing...")
- 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] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 76e5b13788076339bbf816ba876602cf5fbf64d9
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: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=76e5b137
repoman: Migrate license checks to a plugin module
pym/repoman/checks/ebuilds/variables/license.py | 47 ----------------------
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++
pym/repoman/modules/scan/metadata/license.py | 53 +++++++++++++++++++++++++
pym/repoman/scanner.py | 7 +---
4 files changed, 62 insertions(+), 53 deletions(-)
diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py
deleted file mode 100644
index bdc859c..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] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 50b8e2d62f8e6312706e51f55e72720637a31d74
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 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=50b8e2d6
repoman: Migrate RestrictChecks to a plugin module
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
.../scan/metadata}/restrict.py | 29 +++++++++++++++-------
pym/repoman/scanner.py | 7 +-----
3 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index ed0c59d..6ab44f6 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -42,6 +42,14 @@ module_spec = {
'func_desc': {
},
},
+ 'restrict-metadata': {
+ 'name': "restrict",
+ 'class': "RestrictChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py
similarity index 54%
rename from pym/repoman/checks/ebuilds/variables/restrict.py
rename to pym/repoman/modules/scan/metadata/restrict.py
index 215b792..93ca298 100644
--- a/pym/repoman/checks/ebuilds/variables/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict
class RestrictChecks(object):
'''Perform checks on the RESTRICT variable.'''
- def __init__(self, qatracker):
+ def __init__(self, **kwargs):
'''
@param qatracker: QATracker instance
'''
- self.qatracker = qatracker
+ self.qatracker = kwargs.get('qatracker')
- def check(self, pkg, package, ebuild, y_ebuild):
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ ebuild = kwargs.get('ebuild')
+ y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
try:
myrestrict = portage.dep.use_reduce(
- pkg._metadata["RESTRICT"], matchall=1, flat=True)
+ ebuild.metadata["RESTRICT"], matchall=1, flat=True)
except portage.exception.InvalidDependString as e:
- self. qatracker.add_error(
- "RESTRICT.syntax",
+ self.qatracker.add_error("RESTRICT.syntax",
"%s: RESTRICT: %s" % (ebuild.relative_path, e))
del e
@@ -36,6 +38,15 @@ class RestrictChecks(object):
if mybadrestrict:
for mybad in mybadrestrict:
- self.qatracker.add_error(
- "RESTRICT.invalid",
- package + "/" + y_ebuild + ".ebuild: %s" % mybad)
+ self.qatracker.add_error("RESTRICT.invalid",
+ "%s/%s.ebuild: %s" % (xpkg, y_ebuild, mybad))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
+
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1f792bd..8657c73 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -209,8 +208,6 @@ class Scanner(object):
self.modules[mod_class.__name__] = mod_class(**self.kwargs)
# initialize our checks classes here before the big xpkg loop
- self.restrictcheck = RestrictChecks(self.qatracker)
-
def scan_pkgs(self, can_force):
dynamic_data = {'can_force': can_force}
@@ -295,7 +292,7 @@ class Scanner(object):
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
('arches', 'ArchChecks'), ('depend', 'DependChecks'),
('use_flags', 'USEFlagChecks'), ('ruby', '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] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 40b9ed5989fd3793ef23a6a23b529362e8327c8d
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 07:50:17 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40b9ed59
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] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 0172019530d7a71d04f4ded5cda8008edbaab739
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 Jan 30 07:50:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=01720195
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 55f3d56..dcb955c 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] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/checks/ebuilds/variables/, ...
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 9e70c49fc67178c884765ec86ae2c07d44c9fd6f
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 Mar 12 17:57:37 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e70c49f
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 04dc86e..27cd31d 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] 7+ messages in thread
end of thread, other threads:[~2016-03-12 18:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06 4:21 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, 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-30 8:00 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-06 4:21 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox