From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BEBF858973 for ; Wed, 27 Jan 2016 23:15:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1F67521C026; Wed, 27 Jan 2016 23:15:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7A53321C026 for ; Wed, 27 Jan 2016 23:15:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 171F3340931 for ; Wed, 27 Jan 2016 23:15:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D4CBE10BE for ; Wed, 27 Jan 2016 23:15:32 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1453934661.7fd7f5ac90f7f6cea917f8c617c47866bf0efcee.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/, ... X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/variables/description.py pym/repoman/modules/scan/metadata/__init__.py pym/repoman/modules/scan/metadata/description.py pym/repoman/scanner.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/variables/ pym/repoman/modules/scan/metadata/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 7fd7f5ac90f7f6cea917f8c617c47866bf0efcee X-VCS-Branch: repoman Date: Wed, 27 Jan 2016 23:15:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e42dd1d5-132f-4db6-b79e-f99ae376079e X-Archives-Hash: 72750c75baf345edc7c9551e43e2a333 commit: 7fd7f5ac90f7f6cea917f8c617c47866bf0efcee Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Jan 27 22:44:21 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7fd7f5ac repoman: Migrate DescriptionChecks to the plugin system pym/repoman/modules/scan/metadata/__init__.py | 9 +++++++++ .../scan/metadata}/description.py | 20 ++++++++++++++------ pym/repoman/scanner.py | 5 +---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index bacedf5..83aac7f 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -28,6 +28,15 @@ module_spec = { 'func_desc': { }, }, + 'description-metadata': { + 'name': "description", + 'sourcefile': "description", + 'class': "DescriptionChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/modules/scan/metadata/description.py similarity index 66% rename from pym/repoman/checks/ebuilds/variables/description.py rename to pym/repoman/modules/scan/metadata/description.py index a2b1057..3570607 100644 --- a/pym/repoman/checks/ebuilds/variables/description.py +++ b/pym/repoman/modules/scan/metadata/description.py @@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len class DescriptionChecks(object): '''Perform checks on the DESCRIPTION variable.''' - def __init__(self, qatracker): + def __init__(self, **kwargs): ''' @param qatracker: QATracker instance ''' - self.qatracker = qatracker + self.qatracker = kwargs.get('qatracker') - def check(self, pkg, ebuild): + def checkTooLong(self, **kwargs): ''' @param pkg: Package in which we check (object). @param ebuild: Ebuild which we check (object). ''' - self._checkTooLong(pkg, ebuild) - - def _checkTooLong(self, pkg, ebuild): + ebuild = kwargs.get('ebuild') + pkg = kwargs.get('pkg') # 14 is the length of DESCRIPTION="" if len(pkg._metadata['DESCRIPTION']) > max_desc_len: self.qatracker.add_error( @@ -30,3 +29,12 @@ class DescriptionChecks(object): "%s: DESCRIPTION is %d characters (max %d)" % (ebuild.relative_path, len( pkg._metadata['DESCRIPTION']), max_desc_len)) + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.checkTooLong]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 29edcd8..b9e80ff 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.use_flags import USEFlagChecks -from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.license import LicenseChecks from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.modules.commit import repochecks @@ -219,7 +218,6 @@ class Scanner(object): # initialize our checks classes here before the big xpkg loop self.use_flag_checks = USEFlagChecks(self.qatracker, uselist) self.rubyeclasscheck = RubyEclassChecks(self.qatracker) - self.descriptioncheck = DescriptionChecks(self.qatracker) self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated) self.restrictcheck = RestrictChecks(self.qatracker) @@ -304,6 +302,7 @@ class Scanner(object): for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'), ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'), ('thirdpartymirrors', 'ThirdPartyMirrors'), + ('description', 'DescriptionChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -350,8 +349,6 @@ class Scanner(object): myqakey = var + ".virtual" self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path) - self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild']) - if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo": self.liveeclasscheck.check( dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])