[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 48681d6afce147d3cf579e350250f60bd03199e7 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 23:10:48 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Mar 12 17:57:37 2016 + 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'),
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 705c1e23c2599a9b990df5b5ba5652b5f2a3accb Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 23:09:27 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Fri Jan 22 18:44:13 2016 + 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..000 --- a/pym/repoman/checks/ebuilds/variables/license.py +++ /dev/null @@ -1,47 +0,0 @@ - -'''description.py -Perform checks on the LICENSE variable. -''' - -# import our initialized portage instance -from repoman._portage import portage - - -class LicenseChecks(object): - '''Perform checks on the LICENSE variable.''' - - def __init__(self, qatracker, liclist, liclist_deprecated): - ''' - @param qatracker: QATracker instance - @param liclist: List of licenses. - @param liclist: List of deprecated licenses. - ''' - self.qatracker = qatracker - self.liclist = liclist - self.liclist_deprecated = liclist_deprecated - - def check( - self, pkg, package, ebuild, y_ebuild): - ''' - @param pkg: Package in which we check (object). - @param package: Package in which we check (string). - @param ebuild: Ebuild which we check (object). - @param y_ebuild: Ebuild which we check (string). - ''' - - # Parse the LICENSE variable, remove USE conditions and flatten it. - licenses = portage.dep.use_reduce( - pkg._metadata["LICENSE"], matchall=1, flat=True) - - # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in self.liclist and lic != "||": - self.qatracker.add_error( - "LICENSE.invalid", - package + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in self.liclist_deprecated: - self.qatracker.add_error( - "LICENSE.deprecated", - "%s: %s" % (ebuild.relative_path, lic)) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index 2506521..ed0c59d 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -34,6 +34,14 @@ module_spec = { 'func_desc': { }, }, + 'license-metadata': { + 'name': "license", + 'class': "LicenseChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py new file mode 100644 index 000..b022b20 --- /dev/null +++ b/pym/repoman/modules/scan/metadata/license.py @@ -0,0 +1,53 @@ + +'''license.py +Perform checks on the LICENSE variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + + +class LicenseChecks(object): + '''Perform checks on the LICENSE variable.''' + + def __init__(self, **kwargs): + ''' + @param qatracker: QATracker instance + @param repo_metadata: dictionary of various repository items. + ''' + self.qatracker = kwargs.get('qatracker') + self.repo_metadata = kwargs.get('repo_metadata') + + def check(self, **kwargs): + ''' + @param xpkg: Package in which we check (string). + @param ebuild: Ebuild which we check (object). + @param y_ebuild: Ebuild which we check (string). + ''' + xpkg = kwargs.get('xpkg') + ebuild = kwargs.get('ebuild') + y_ebuild = kwargs.get('y_ebuild') + if not kwargs.get('badlicsyntax'): + # Parse the LICENSE variable, remove USE conditions and
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 9ea80b2623c9ffb895ce8ed93d5271765c08ccde Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Fri Jan 22 18:44:10 2016 + 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
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 196d6aa6d378c3f2ecd08a45c071c9fc568f2731 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 23:09:27 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Thu Jan 21 00:35:22 2016 + 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..000 --- a/pym/repoman/checks/ebuilds/variables/license.py +++ /dev/null @@ -1,47 +0,0 @@ - -'''description.py -Perform checks on the LICENSE variable. -''' - -# import our initialized portage instance -from repoman._portage import portage - - -class LicenseChecks(object): - '''Perform checks on the LICENSE variable.''' - - def __init__(self, qatracker, liclist, liclist_deprecated): - ''' - @param qatracker: QATracker instance - @param liclist: List of licenses. - @param liclist: List of deprecated licenses. - ''' - self.qatracker = qatracker - self.liclist = liclist - self.liclist_deprecated = liclist_deprecated - - def check( - self, pkg, package, ebuild, y_ebuild): - ''' - @param pkg: Package in which we check (object). - @param package: Package in which we check (string). - @param ebuild: Ebuild which we check (object). - @param y_ebuild: Ebuild which we check (string). - ''' - - # Parse the LICENSE variable, remove USE conditions and flatten it. - licenses = portage.dep.use_reduce( - pkg._metadata["LICENSE"], matchall=1, flat=True) - - # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in self.liclist and lic != "||": - self.qatracker.add_error( - "LICENSE.invalid", - package + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in self.liclist_deprecated: - self.qatracker.add_error( - "LICENSE.deprecated", - "%s: %s" % (ebuild.relative_path, lic)) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index 2506521..ed0c59d 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -34,6 +34,14 @@ module_spec = { 'func_desc': { }, }, + 'license-metadata': { + 'name': "license", + 'class': "LicenseChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py new file mode 100644 index 000..b022b20 --- /dev/null +++ b/pym/repoman/modules/scan/metadata/license.py @@ -0,0 +1,53 @@ + +'''license.py +Perform checks on the LICENSE variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + + +class LicenseChecks(object): + '''Perform checks on the LICENSE variable.''' + + def __init__(self, **kwargs): + ''' + @param qatracker: QATracker instance + @param repo_metadata: dictionary of various repository items. + ''' + self.qatracker = kwargs.get('qatracker') + self.repo_metadata = kwargs.get('repo_metadata') + + def check(self, **kwargs): + ''' + @param xpkg: Package in which we check (string). + @param ebuild: Ebuild which we check (object). + @param y_ebuild: Ebuild which we check (string). + ''' + xpkg = kwargs.get('xpkg') + ebuild = kwargs.get('ebuild') + y_ebuild = kwargs.get('y_ebuild') + if not kwargs.get('badlicsyntax'): + # Parse the LICENSE variable, remove USE conditions and
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 6eb7f0c6c02c08cafcbf661da756b6c5b15dcf5e Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 10:03:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Mon Jan 11 08:00:15 2016 + 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..000 --- a/pym/repoman/checks/ebuilds/variables/eapi.py +++ /dev/null @@ -1,44 +0,0 @@ - -'''eapi.py -Perform checks on the EAPI variable. -''' - - -class EAPIChecks(object): - '''Perform checks on the EAPI variable.''' - - def __init__(self, qatracker, repo_settings): - ''' - @param qatracker: QATracker instance - @param repo_settings: Repository settings - ''' - self.qatracker = qatracker - self.repo_settings = repo_settings - - def check(self, pkg, ebuild): - ''' - @param pkg: Package in which we check (object). - @param ebuild: Ebuild which we check (object). - ''' - eapi = pkg._metadata["EAPI"] - - if not self._checkBanned(ebuild, eapi): - self._checkDeprecated(ebuild, eapi) - - def _checkBanned(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_banned(eapi): - self.qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False - - def _checkDeprecated(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_deprecated(eapi): - self.qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False diff --git a/pym/repoman/modules/scan/eapi/__init__.py b/pym/repoman/modules/scan/eapi/__init__.py new file mode 100644 index 000..de586a8 --- /dev/null +++ b/pym/repoman/modules/scan/eapi/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Eapi plug-in module for repoman. +Performs an IsEbuild check on ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'eapi', + 'description': doc, + 'provides':{ + 'live-module': { + 'name': "eapi", + 'class': "EAPIChecks", + 'description': doc, + 'functions': ['check'], + 'func_kwargs': { + }, + }, + } +} + diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py new file mode 100644 index 000..1190b1a --- /dev/null +++ b/pym/repoman/modules/scan/eapi/eapi.py @@ -0,0 +1,49 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, **kwargs): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = kwargs.get('qatracker') + self.repo_settings = kwargs.get('repo_settings') + + def check(self, **kwargs): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + ebuild = kwargs.get('ebuild') + + if not self._checkBanned(ebuild): + self._checkDeprecated(ebuild) + return {'continue': False} + + def _checkBanned(self, ebuild): + if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + + def _checkDeprecated(self, ebuild): + if self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 31fd105a9897fee5a77a893e23062c37195767e4 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jan 10 22:59:33 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=31fd105a repoman: Migrate DescriptionChecks to the plugin system pym/repoman/modules/scan/metadata/__init__.py| 8 .../scan/metadata}/description.py| 20 ++-- pym/repoman/scanner.py | 5 + 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index eba6565..2506521 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -26,6 +26,14 @@ module_spec = { 'func_desc': { }, }, + 'description-metadata': { + 'name': "description", + 'class': "DescriptionChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/modules/scan/metadata/description.py similarity index 66% rename from pym/repoman/checks/ebuilds/variables/description.py rename to pym/repoman/modules/scan/metadata/description.py index a2b1057..3570607 100644 --- a/pym/repoman/checks/ebuilds/variables/description.py +++ b/pym/repoman/modules/scan/metadata/description.py @@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len class DescriptionChecks(object): '''Perform checks on the DESCRIPTION variable.''' - def __init__(self, qatracker): + def __init__(self, **kwargs): ''' @param qatracker: QATracker instance ''' - self.qatracker = qatracker + self.qatracker = kwargs.get('qatracker') - def check(self, pkg, ebuild): + def checkTooLong(self, **kwargs): ''' @param pkg: Package in which we check (object). @param ebuild: Ebuild which we check (object). ''' - self._checkTooLong(pkg, ebuild) - - def _checkTooLong(self, pkg, ebuild): + ebuild = kwargs.get('ebuild') + pkg = kwargs.get('pkg') # 14 is the length of DESCRIPTION="" if len(pkg._metadata['DESCRIPTION']) > max_desc_len: self.qatracker.add_error( @@ -30,3 +29,12 @@ class DescriptionChecks(object): "%s: DESCRIPTION is %d characters (max %d)" % (ebuild.relative_path, len( pkg._metadata['DESCRIPTION']), max_desc_len)) + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.checkTooLong]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 955440e..bb856b8 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.use_flags import USEFlagChecks -from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.license import LicenseChecks from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.modules.commit import repochecks @@ -216,7 +215,6 @@ class Scanner(object): # initialize our checks classes here before the big xpkg loop self.use_flag_checks = USEFlagChecks(self.qatracker, uselist) self.rubyeclasscheck = RubyEclassChecks(self.qatracker) - self.descriptioncheck = DescriptionChecks(self.qatracker) self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated) self.restrictcheck = RestrictChecks(self.qatracker) @@ -301,6 +299,7 @@ class Scanner(object): for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'), ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'), ('thirdpartymirrors', 'ThirdPartyMirrors'), + ('description', 'DescriptionChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -347,8 +346,6 @@ class
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 6bc227162986a9d79e72a79e1cae393c45bb910f Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 10:03:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jan 10 22:59:32 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6bc22716 repoman: Migrate eapi.py to the plugin module pym/repoman/checks/ebuilds/variables/eapi.py | 44 - pym/repoman/modules/scan/eapi/__init__.py| 23 + pym/repoman/modules/scan/eapi/eapi.py| 49 pym/repoman/scanner.py | 6 ++-- 4 files changed, 74 insertions(+), 48 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py deleted file mode 100644 index 2f8b1cb..000 --- a/pym/repoman/checks/ebuilds/variables/eapi.py +++ /dev/null @@ -1,44 +0,0 @@ - -'''eapi.py -Perform checks on the EAPI variable. -''' - - -class EAPIChecks(object): - '''Perform checks on the EAPI variable.''' - - def __init__(self, qatracker, repo_settings): - ''' - @param qatracker: QATracker instance - @param repo_settings: Repository settings - ''' - self.qatracker = qatracker - self.repo_settings = repo_settings - - def check(self, pkg, ebuild): - ''' - @param pkg: Package in which we check (object). - @param ebuild: Ebuild which we check (object). - ''' - eapi = pkg._metadata["EAPI"] - - if not self._checkBanned(ebuild, eapi): - self._checkDeprecated(ebuild, eapi) - - def _checkBanned(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_banned(eapi): - self.qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False - - def _checkDeprecated(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_deprecated(eapi): - self.qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False diff --git a/pym/repoman/modules/scan/eapi/__init__.py b/pym/repoman/modules/scan/eapi/__init__.py new file mode 100644 index 000..de586a8 --- /dev/null +++ b/pym/repoman/modules/scan/eapi/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Eapi plug-in module for repoman. +Performs an IsEbuild check on ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'eapi', + 'description': doc, + 'provides':{ + 'live-module': { + 'name': "eapi", + 'class': "EAPIChecks", + 'description': doc, + 'functions': ['check'], + 'func_kwargs': { + }, + }, + } +} + diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py new file mode 100644 index 000..1190b1a --- /dev/null +++ b/pym/repoman/modules/scan/eapi/eapi.py @@ -0,0 +1,49 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, **kwargs): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = kwargs.get('qatracker') + self.repo_settings = kwargs.get('repo_settings') + + def check(self, **kwargs): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + ebuild = kwargs.get('ebuild') + + if not self._checkBanned(ebuild): + self._checkDeprecated(ebuild) + return {'continue': False} + + def _checkBanned(self, ebuild): + if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + + def _checkDeprecated(self, ebuild): + if self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 2e358284573f56c6b5b67a736e38852fc55f55a7 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jan 10 03:23:49 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e358284 repoman: Migrate DescriptionChecks to the plugin system pym/repoman/modules/scan/metadata/__init__.py| 8 .../scan/metadata}/description.py| 20 ++-- pym/repoman/scanner.py | 5 + 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index eba6565..2506521 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -26,6 +26,14 @@ module_spec = { 'func_desc': { }, }, + 'description-metadata': { + 'name': "description", + 'class': "DescriptionChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/modules/scan/metadata/description.py similarity index 66% rename from pym/repoman/checks/ebuilds/variables/description.py rename to pym/repoman/modules/scan/metadata/description.py index a2b1057..3570607 100644 --- a/pym/repoman/checks/ebuilds/variables/description.py +++ b/pym/repoman/modules/scan/metadata/description.py @@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len class DescriptionChecks(object): '''Perform checks on the DESCRIPTION variable.''' - def __init__(self, qatracker): + def __init__(self, **kwargs): ''' @param qatracker: QATracker instance ''' - self.qatracker = qatracker + self.qatracker = kwargs.get('qatracker') - def check(self, pkg, ebuild): + def checkTooLong(self, **kwargs): ''' @param pkg: Package in which we check (object). @param ebuild: Ebuild which we check (object). ''' - self._checkTooLong(pkg, ebuild) - - def _checkTooLong(self, pkg, ebuild): + ebuild = kwargs.get('ebuild') + pkg = kwargs.get('pkg') # 14 is the length of DESCRIPTION="" if len(pkg._metadata['DESCRIPTION']) > max_desc_len: self.qatracker.add_error( @@ -30,3 +29,12 @@ class DescriptionChecks(object): "%s: DESCRIPTION is %d characters (max %d)" % (ebuild.relative_path, len( pkg._metadata['DESCRIPTION']), max_desc_len)) + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.checkTooLong]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 955440e..bb856b8 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.use_flags import USEFlagChecks -from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.license import LicenseChecks from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.modules.commit import repochecks @@ -216,7 +215,6 @@ class Scanner(object): # initialize our checks classes here before the big xpkg loop self.use_flag_checks = USEFlagChecks(self.qatracker, uselist) self.rubyeclasscheck = RubyEclassChecks(self.qatracker) - self.descriptioncheck = DescriptionChecks(self.qatracker) self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated) self.restrictcheck = RestrictChecks(self.qatracker) @@ -301,6 +299,7 @@ class Scanner(object): for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'), ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'), ('thirdpartymirrors', 'ThirdPartyMirrors'), + ('description', 'DescriptionChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -347,8 +346,6 @@ class
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: 1f41972b0b5dc6a61853935dbbbf9f0bd033918b Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 10:03:26 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jan 10 03:23:48 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1f41972b repoman: Migrate eapi.py to the plugin module pym/repoman/checks/ebuilds/variables/eapi.py | 44 - pym/repoman/modules/scan/eapi/__init__.py| 23 + pym/repoman/modules/scan/eapi/eapi.py| 49 pym/repoman/scanner.py | 6 ++-- 4 files changed, 74 insertions(+), 48 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py deleted file mode 100644 index 2f8b1cb..000 --- a/pym/repoman/checks/ebuilds/variables/eapi.py +++ /dev/null @@ -1,44 +0,0 @@ - -'''eapi.py -Perform checks on the EAPI variable. -''' - - -class EAPIChecks(object): - '''Perform checks on the EAPI variable.''' - - def __init__(self, qatracker, repo_settings): - ''' - @param qatracker: QATracker instance - @param repo_settings: Repository settings - ''' - self.qatracker = qatracker - self.repo_settings = repo_settings - - def check(self, pkg, ebuild): - ''' - @param pkg: Package in which we check (object). - @param ebuild: Ebuild which we check (object). - ''' - eapi = pkg._metadata["EAPI"] - - if not self._checkBanned(ebuild, eapi): - self._checkDeprecated(ebuild, eapi) - - def _checkBanned(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_banned(eapi): - self.qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False - - def _checkDeprecated(self, ebuild, eapi): - if self.repo_settings.repo_config.eapi_is_deprecated(eapi): - self.qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) - - return True - - return False diff --git a/pym/repoman/modules/scan/eapi/__init__.py b/pym/repoman/modules/scan/eapi/__init__.py new file mode 100644 index 000..de586a8 --- /dev/null +++ b/pym/repoman/modules/scan/eapi/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Eapi plug-in module for repoman. +Performs an IsEbuild check on ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'eapi', + 'description': doc, + 'provides':{ + 'live-module': { + 'name': "eapi", + 'class': "EAPIChecks", + 'description': doc, + 'functions': ['check'], + 'func_kwargs': { + }, + }, + } +} + diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py new file mode 100644 index 000..1190b1a --- /dev/null +++ b/pym/repoman/modules/scan/eapi/eapi.py @@ -0,0 +1,49 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, **kwargs): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = kwargs.get('qatracker') + self.repo_settings = kwargs.get('repo_settings') + + def check(self, **kwargs): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + ebuild = kwargs.get('ebuild') + + if not self._checkBanned(ebuild): + self._checkDeprecated(ebuild) + return {'continue': False} + + def _checkBanned(self, ebuild): + if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + + def _checkDeprecated(self, ebuild): + if self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi): + self.qatracker.add_error( + "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, ebuild.eapi)) + return True + return False + +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/, ...
commit: c45eaee3439b05bd90cbafa2b48d3e2bbd03 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 23:10:48 2016 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Jan 10 03:23:51 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c45eaee3 repoman: Migrate RestrictChecks to a plugin module pym/repoman/modules/scan/metadata/__init__.py | 8 ++ .../scan/metadata}/restrict.py | 29 +++--- pym/repoman/scanner.py | 7 +- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index ed0c59d..6ab44f6 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -42,6 +42,14 @@ module_spec = { 'func_desc': { }, }, + 'restrict-metadata': { + 'name': "restrict", + 'class': "RestrictChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py similarity index 54% rename from pym/repoman/checks/ebuilds/variables/restrict.py rename to pym/repoman/modules/scan/metadata/restrict.py index 215b792..93ca298 100644 --- a/pym/repoman/checks/ebuilds/variables/restrict.py +++ b/pym/repoman/modules/scan/metadata/restrict.py @@ -12,21 +12,23 @@ from repoman.qa_data import valid_restrict class RestrictChecks(object): '''Perform checks on the RESTRICT variable.''' - def __init__(self, qatracker): + def __init__(self, **kwargs): ''' @param qatracker: QATracker instance ''' - self.qatracker = qatracker + self.qatracker = kwargs.get('qatracker') - def check(self, pkg, package, ebuild, y_ebuild): + def check(self, **kwargs): + xpkg = kwargs.get('xpkg') + ebuild = kwargs.get('ebuild') + y_ebuild = kwargs.get('y_ebuild') myrestrict = None try: myrestrict = portage.dep.use_reduce( - pkg._metadata["RESTRICT"], matchall=1, flat=True) + ebuild.metadata["RESTRICT"], matchall=1, flat=True) except portage.exception.InvalidDependString as e: - self. qatracker.add_error( - "RESTRICT.syntax", + self.qatracker.add_error("RESTRICT.syntax", "%s: RESTRICT: %s" % (ebuild.relative_path, e)) del e @@ -36,6 +38,15 @@ class RestrictChecks(object): if mybadrestrict: for mybad in mybadrestrict: - self.qatracker.add_error( - "RESTRICT.invalid", - package + "/" + y_ebuild + ".ebuild: %s" % mybad) + self.qatracker.add_error("RESTRICT.invalid", + "%s/%s.ebuild: %s" % (xpkg, y_ebuild, mybad)) + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.check]) + diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 1f792bd..8657c73 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -18,7 +18,6 @@ from portage import _unicode_encode from portage.dep import Atom from portage.output import green from repoman.checks.ebuilds.checks import run_checks -from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_profile_keywords, setup_profile from repoman.repos import repo_metadata @@ -209,8 +208,6 @@ class Scanner(object): self.modules[mod_class.__name__] = mod_class(**self.kwargs) # initialize our checks classes here before the big xpkg loop - self.restrictcheck = RestrictChecks(self.qatracker) - def scan_pkgs(self, can_force): dynamic_data = {'can_force': can_force} @@ -295,7 +292,7 @@ class Scanner(object): ('description', 'DescriptionChecks'), (None, 'KeywordChecks'), ('arches', 'ArchChecks'), ('depend', 'DependChecks'), ('use_flags', 'USEFlagChecks'), ('ruby',
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: f662a734a28a9c6a13233693fd08498d371054e0 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Mon Sep 21 23:42:44 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f662a734 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION="" + if len(pkg._metadata['DESCRIPTION']) > max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + "%s: DESCRIPTION is %d characters (max %d)" % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 42600cd..7b36852 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + ".virtual" qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION="" - if len(myaux['DESCRIPTION']) > max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - "%s: DESCRIPTION is %d characters (max %d)" % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux["KEYWORDS"].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: f1407272871994cd83a18398b566566a61d4f9d0 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Mon Sep 21 23:42:44 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f1407272 repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index 7b36852..08d79eb 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -63,6 +63,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -299,6 +300,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -617,22 +619,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux["LICENSE"], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != "||": - qatracker.add_error( - "LICENSE.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - "LICENSE.deprecated", -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: f4714cbbb90bd40fcbcec933529a3b3936611af9 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Sep 20 01:54:08 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f4714cbb repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index 7b36852..08d79eb 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -63,6 +63,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -299,6 +300,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -617,22 +619,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux["LICENSE"], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != "||": - qatracker.add_error( - "LICENSE.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - "LICENSE.deprecated", -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: ea818918314a1480b380ad8905693290d8c69385 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Sep 20 01:54:07 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ea818918 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION="" + if len(pkg._metadata['DESCRIPTION']) > max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + "%s: DESCRIPTION is %d characters (max %d)" % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 42600cd..7b36852 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + ".virtual" qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION="" - if len(myaux['DESCRIPTION']) > max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - "%s: DESCRIPTION is %d characters (max %d)" % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux["KEYWORDS"].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 2fe4697d7fdf7a201582c1c9ac0b01a682b5016b Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Sep 20 01:54:08 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2fe4697d repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata["RESTRICT"], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + "RESTRICT.syntax", + "%s: RESTRICT: %s" % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + "RESTRICT.invalid", + package + "/" + y_ebuild + ".ebuild: %s" % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 08d79eb..8497833 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -64,6 +64,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -71,7 +72,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -301,6 +302,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -623,24 +625,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux["RESTRICT"], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - "RESTRICT.syntax", - "%s: RESTRICT: %s" % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - "RESTRICT.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + #
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 0b5e6ce8553a1a754a045d24817496ef2bff41c4 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sun Sep 20 01:54:07 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0b5e6ce8 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''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/main.py b/pym/repoman/main.py index 1e23387..42600cd 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: fe03af9e968e1a5dc256950214553e49dbf24674 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Thu Sep 17 04:41:27 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe03af9e repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata["RESTRICT"], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + "RESTRICT.syntax", + "%s: RESTRICT: %s" % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + "RESTRICT.invalid", + package + "/" + y_ebuild + ".ebuild: %s" % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 08d79eb..8497833 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -64,6 +64,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -71,7 +72,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -301,6 +302,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -623,24 +625,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux["RESTRICT"], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - "RESTRICT.syntax", - "%s: RESTRICT: %s" % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - "RESTRICT.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + #
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: ef4cdee293e2a559ff2e88e578576a642b17edcc Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Thu Sep 17 03:06:48 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef4cdee2 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION="" + if len(pkg._metadata['DESCRIPTION']) > max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + "%s: DESCRIPTION is %d characters (max %d)" % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 6bfd1be..f692b63 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + ".virtual" qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION="" - if len(myaux['DESCRIPTION']) > max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - "%s: DESCRIPTION is %d characters (max %d)" % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux["KEYWORDS"].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 1012eb2535f9afdbcceee0ebfb67d85e4c2035dd Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Thu Sep 17 04:41:27 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1012eb25 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION="" + if len(pkg._metadata['DESCRIPTION']) > max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + "%s: DESCRIPTION is %d characters (max %d)" % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 42600cd..7b36852 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + ".virtual" qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION="" - if len(myaux['DESCRIPTION']) > max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - "%s: DESCRIPTION is %d characters (max %d)" % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux["KEYWORDS"].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 38c86e616154eae5505781efbc5cb4f380029e24 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 5 21:27:00 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=38c86e61 repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata["RESTRICT"], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + "RESTRICT.syntax", + "%s: RESTRICT: %s" % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + "RESTRICT.invalid", + package + "/" + y_ebuild + ".ebuild: %s" % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 5fe7515..e98520b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -64,6 +64,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -71,7 +72,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -301,6 +302,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -623,24 +625,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux["RESTRICT"], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - "RESTRICT.syntax", - "%s: RESTRICT: %s" % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - "RESTRICT.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + #
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 1346f715f98160c96204b063a18720c17dae62af Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 5 21:47:38 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1346f715 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''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/main.py b/pym/repoman/main.py index bacc25f..6bfd1be 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 7b2e3e7d0c05321af552fb57eed04b4aaee61f72 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 5 21:27:00 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7b2e3e7d repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''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/main.py b/pym/repoman/main.py index 2523544..70d2255 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: c258dfab547502e2213256ff1346ff1f1c4f52a5 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 5 21:27:00 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c258dfab repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index 125b390..5fe7515 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -63,6 +63,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -299,6 +300,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -617,22 +619,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux["LICENSE"], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != "||": - qatracker.add_error( - "LICENSE.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - "LICENSE.deprecated", -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: c0711495b0612f5eac76a5ef2be229d2240bef34 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec dolsen AT gentoo DOT org CommitDate: Tue Aug 11 23:52:56 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c0711495 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 70d2255..125b390 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: f93a28a906c018201bdcff6288d4d882d51e4dc4 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Brian Dolbec dolsen AT gentoo DOT org CommitDate: Tue Aug 11 23:52:56 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f93a28a9 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''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/main.py b/pym/repoman/main.py index 2523544..70d2255 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 46b3cf797ed96068c00b48d0e41d8cdda22929d9 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Michał Górny mgorny AT gentoo DOT org CommitDate: Mon Aug 10 14:45:20 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=46b3cf79 repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 5fe7515..e98520b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -64,6 +64,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -71,7 +72,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -301,6 +302,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -623,24 +625,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + #
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: fa5761e5f36de72ddadb3dbc69019ac7e13bb678 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Michał Górny mgorny AT gentoo DOT org CommitDate: Mon Aug 10 14:45:20 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa5761e5 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 70d2255..125b390 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: ea5a560f0652aec6ea724a6b43dc436fecd74d06 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec dolsen AT gentoo DOT org CommitDate: Tue Jul 21 05:47:31 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ea5a560f repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index c75f7e8..7ed07c7 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -63,6 +63,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -299,6 +300,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -617,22 +619,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux[LICENSE], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for || manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != ||: - qatracker.add_error( - LICENSE.invalid, - xpkg + / + y_ebuild + .ebuild: %s % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - LICENSE.deprecated, - %s: %s %
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 67687b6540955db5a70607dcb1a122850af2dd1f Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec dolsen AT gentoo DOT org CommitDate: Tue Jul 21 05:47:30 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=67687b65 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index deb3202..c75f7e8 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -436,12 +438,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: cd1922895bb714dbe9eae33668d6382a7e8ac485 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec dolsen AT gentoo DOT org CommitDate: Tue Jul 21 05:47:31 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cd192289 repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 7ed07c7..f34d8a7 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -64,6 +64,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -71,7 +72,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -301,6 +302,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -623,24 +625,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + #
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 02ba205d4e1f2adebd184491c579e0f8d1a04a80 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Nov 17 00:53:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=02ba205d repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index ed3cf88..722de79 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -60,6 +60,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -296,6 +297,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -611,22 +613,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux[LICENSE], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for || manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != ||: - qatracker.add_error( - LICENSE.invalid, - xpkg + / + y_ebuild + .ebuild: %s % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - LICENSE.deprecated, -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: b1b87fbf2648bd1030ecac0375be622d0a181336 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 22:58:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b1b87fbf repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ --- .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c6f38df..ed3cf88 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -65,7 +66,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -294,6 +295,7 @@ keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -433,12 +435,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: c9e4859648c65b1b220814917b0d96287fae4634 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 22:58:14 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c9e48596 repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index ed3cf88..722de79 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -60,6 +60,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -296,6 +297,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -611,22 +613,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux[LICENSE], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for || manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != ||: - qatracker.add_error( - LICENSE.invalid, - xpkg + / + y_ebuild + .ebuild: %s % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - LICENSE.deprecated, -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: a7c9f77f9ab9321fe9beda0bbf7716f2b206405b Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a7c9f77f repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 722de79..b3e93bf 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -68,7 +69,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -298,6 +299,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -617,24 +619,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 89ad2061c0af9ea711d4eae396d0d06356a780bc Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 14:40:39 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=89ad2061 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py --- pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''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/main.py b/pym/repoman/main.py index c5d5276..92a9f51 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -285,6 +286,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -386,13 +388,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 315cb3236f57ff7e60a2e77a35f3deb3878de39b Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 14:50:26 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=315cb323 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ --- .../checks/ebuilds/variables/description.py| 40 ++ pym/repoman/main.py| 19 -- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..fba8f97 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,40 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkPunctuation(pkg, ebuild) + self._checkTooLong(pkg, ebuild) + + def _checkPunctuation(self, pkg, ebuild): + if pkg._metadata['DESCRIPTION'][-1:] in ['.']: + self.qatracker.add_error( + 'DESCRIPTION.punctuation', + %s: DESCRIPTION ends with a '%s' character % + (ebuild.relative_path, pkg._metadata['DESCRIPTION'][-1:])) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 92a9f51..83dfd07 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err @@ -58,7 +59,7 @@ from repoman.modules.commit import repochecks from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -287,6 +288,7 @@ keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -426,18 +428,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - if myaux['DESCRIPTION'][-1:] in ['.']: - qatracker.add_error( - 'DESCRIPTION.punctuation', - %s: DESCRIPTION ends with a '%s' character % - (ebuild.relative_path, myaux['DESCRIPTION'][-1:])) - - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 60fbda473665c8b4d5adf00323923538adc6357e Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 15:09:43 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60fbda47 repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''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/main.py b/pym/repoman/main.py index 83dfd07..6667d6b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -53,6 +53,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -289,6 +290,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -597,22 +599,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux[LICENSE], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for || manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != ||: - qatracker.add_error( - LICENSE.invalid, - xpkg + / + y_ebuild + .ebuild: %s % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - LICENSE.deprecated, -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 6d4cf83b8927d887f2d751251e504fee4d452b38 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 15:23:33 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6d4cf83b repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 6667d6b..f56426b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -54,6 +54,7 @@ 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -61,7 +62,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -291,6 +292,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -603,24 +605,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) +