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 21CE41387FD for ; Fri, 6 Jun 2014 14:51:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8CD87E0B72; Fri, 6 Jun 2014 14:51:31 +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 11A60E0B72 for ; Fri, 6 Jun 2014 14:51:31 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DE16A33F908 for ; Fri, 6 Jun 2014 14:51:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id D7EE2181A9 for ; Fri, 6 Jun 2014 14:51:27 +0000 (UTC) From: "Tom Wijsman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Tom Wijsman" Message-ID: <1402066226.315cb3236f57ff7e60a2e77a35f3deb3878de39b.tomwij@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/variables/description.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: tomwij X-VCS-Committer-Name: Tom Wijsman X-VCS-Revision: 315cb3236f57ff7e60a2e77a35f3deb3878de39b X-VCS-Branch: repoman Date: Fri, 6 Jun 2014 14:51:27 +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: 8fa2b397-e947-4fe4-8475-80b2df44f3ce X-Archives-Hash: 7c45eb18c901d1f29d0fab6050669375 commit: 315cb3236f57ff7e60a2e77a35f3deb3878de39b Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:50:26 2014 +0000 Commit: Tom Wijsman gentoo org> CommitDate: Fri Jun 6 14:50:26 2014 +0000 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 0000000..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()