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 05D7A58973 for ; Sun, 31 Jan 2016 20:03:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 83EA621C074; Sun, 31 Jan 2016 20:03:34 +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 1E9B721C074 for ; Sun, 31 Jan 2016 20:03:34 +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 08E28340C19 for ; Sun, 31 Jan 2016 20:03:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BFD151021 for ; Sun, 31 Jan 2016 20:03:30 +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: <1454185506.3d9d113df9eae165c6b1ecaeda0601708ad8a8df.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/modules/scan/metadata/, ... 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/modules/scan/metadata/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 3d9d113df9eae165c6b1ecaeda0601708ad8a8df X-VCS-Branch: repoman Date: Sun, 31 Jan 2016 20:03:30 +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: 67e92d1f-51fe-47f2-b965-0bb613c03df3 X-Archives-Hash: f3b18ed9510d6ffcfccce02b62e37be2 commit: 3d9d113df9eae165c6b1ecaeda0601708ad8a8df Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 17:36:26 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Jan 30 20:25:06 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d9d113d 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 6321f0b..f4c21d0 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'])