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 724A158975 for ; Mon, 18 Jan 2016 19:23:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7C9E721C01B; Mon, 18 Jan 2016 19:23:45 +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 EC3C121C01B for ; Mon, 18 Jan 2016 19:23:44 +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 BE001340662 for ; Mon, 18 Jan 2016 19:23:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6C9B71024 for ; Mon, 18 Jan 2016 19:23:41 +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: <1453144803.3df90a153e0f81fa8815d4fdbab4d972a7c4eda9.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, 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/modules/scan/metadata/ pym/repoman/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 3df90a153e0f81fa8815d4fdbab4d972a7c4eda9 X-VCS-Branch: repoman Date: Mon, 18 Jan 2016 19:23:41 +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: 007f004a-4213-44b3-a358-28bd1ae4d576 X-Archives-Hash: 8084bf9e4b5b5a79367578fccf254c0f commit: 3df90a153e0f81fa8815d4fdbab4d972a7c4eda9 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Jan 18 19:20:03 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3df90a15 repoman: Migrate DescriptionChecks to the plugin system pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++++ .../scan/metadata}/description.py | 20 ++++++++++++++------ pym/repoman/scanner.py | 5 +---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py index eba6565..2506521 100644 --- a/pym/repoman/modules/scan/metadata/__init__.py +++ b/pym/repoman/modules/scan/metadata/__init__.py @@ -26,6 +26,14 @@ module_spec = { 'func_desc': { }, }, + 'description-metadata': { + 'name': "description", + 'class': "DescriptionChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, } } diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/modules/scan/metadata/description.py similarity index 66% rename from pym/repoman/checks/ebuilds/variables/description.py rename to pym/repoman/modules/scan/metadata/description.py index a2b1057..3570607 100644 --- a/pym/repoman/checks/ebuilds/variables/description.py +++ b/pym/repoman/modules/scan/metadata/description.py @@ -9,20 +9,19 @@ from repoman.qa_data import max_desc_len class DescriptionChecks(object): '''Perform checks on the DESCRIPTION variable.''' - def __init__(self, qatracker): + def __init__(self, **kwargs): ''' @param qatracker: QATracker instance ''' - self.qatracker = qatracker + self.qatracker = kwargs.get('qatracker') - def check(self, pkg, ebuild): + def checkTooLong(self, **kwargs): ''' @param pkg: Package in which we check (object). @param ebuild: Ebuild which we check (object). ''' - self._checkTooLong(pkg, ebuild) - - def _checkTooLong(self, pkg, ebuild): + ebuild = kwargs.get('ebuild') + pkg = kwargs.get('pkg') # 14 is the length of DESCRIPTION="" if len(pkg._metadata['DESCRIPTION']) > max_desc_len: self.qatracker.add_error( @@ -30,3 +29,12 @@ class DescriptionChecks(object): "%s: DESCRIPTION is %d characters (max %d)" % (ebuild.relative_path, len( pkg._metadata['DESCRIPTION']), max_desc_len)) + return {'continue': False} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.checkTooLong]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 955440e..bb856b8 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -21,7 +21,6 @@ from repoman.checks.ebuilds.checks import run_checks from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.use_flags import USEFlagChecks -from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.license import LicenseChecks from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.modules.commit import repochecks @@ -216,7 +215,6 @@ class Scanner(object): # initialize our checks classes here before the big xpkg loop self.use_flag_checks = USEFlagChecks(self.qatracker, uselist) self.rubyeclasscheck = RubyEclassChecks(self.qatracker) - self.descriptioncheck = DescriptionChecks(self.qatracker) self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated) self.restrictcheck = RestrictChecks(self.qatracker) @@ -301,6 +299,7 @@ class Scanner(object): for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'), ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'), ('thirdpartymirrors', 'ThirdPartyMirrors'), + ('description', 'DescriptionChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -347,8 +346,6 @@ class Scanner(object): myqakey = var + ".virtual" self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path) - self.descriptioncheck.check(dynamic_data['pkg'], dynamic_data['ebuild']) - if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo": self.liveeclasscheck.check( dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])