Gentoo Archives: gentoo-commits

From: Tom Wijsman <tomwij@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
Date: Fri, 06 Jun 2014 14:51:32
Message-Id: 1402066226.315cb3236f57ff7e60a2e77a35f3deb3878de39b.tomwij@gentoo
1 commit: 315cb3236f57ff7e60a2e77a35f3deb3878de39b
2 Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 6 14:50:26 2014 +0000
4 Commit: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 6 14:50:26 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=315cb323
7
8 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/
9
10 ---
11 .../checks/ebuilds/variables/description.py | 40 ++++++++++++++++++++++
12 pym/repoman/main.py | 19 ++++------
13 2 files changed, 46 insertions(+), 13 deletions(-)
14
15 diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py
16 new file mode 100644
17 index 0000000..fba8f97
18 --- /dev/null
19 +++ b/pym/repoman/checks/ebuilds/variables/description.py
20 @@ -0,0 +1,40 @@
21 +
22 +'''description.py
23 +Perform checks on the DESCRIPTION variable.
24 +'''
25 +
26 +from repoman.qa_data import max_desc_len
27 +
28 +
29 +class DescriptionChecks(object):
30 + '''Perform checks on the DESCRIPTION variable.'''
31 +
32 + def __init__(self, qatracker):
33 + '''
34 + @param qatracker: QATracker instance
35 + '''
36 + self.qatracker = qatracker
37 +
38 + def check(self, pkg, ebuild):
39 + '''
40 + @param pkg: Package in which we check (object).
41 + @param ebuild: Ebuild which we check (object).
42 + '''
43 + self._checkPunctuation(pkg, ebuild)
44 + self._checkTooLong(pkg, ebuild)
45 +
46 + def _checkPunctuation(self, pkg, ebuild):
47 + if pkg._metadata['DESCRIPTION'][-1:] in ['.']:
48 + self.qatracker.add_error(
49 + 'DESCRIPTION.punctuation',
50 + "%s: DESCRIPTION ends with a '%s' character" %
51 + (ebuild.relative_path, pkg._metadata['DESCRIPTION'][-1:]))
52 +
53 + def _checkTooLong(self, pkg, ebuild):
54 + # 14 is the length of DESCRIPTION=""
55 + if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
56 + self.qatracker.add_error(
57 + 'DESCRIPTION.toolong',
58 + "%s: DESCRIPTION is %d characters (max %d)" %
59 + (ebuild.relative_path, len(
60 + pkg._metadata['DESCRIPTION']), max_desc_len))
61
62 diff --git a/pym/repoman/main.py b/pym/repoman/main.py
63 index 92a9f51..83dfd07 100755
64 --- a/pym/repoman/main.py
65 +++ b/pym/repoman/main.py
66 @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.manifests import Manifests
67 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
68 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
69 from repoman.checks.ebuilds.use_flags import USEFlagChecks
70 +from repoman.checks.ebuilds.variables.description import DescriptionChecks
71 from repoman.checks.ebuilds.variables.eapi import EAPIChecks
72 from repoman.ebuild import Ebuild
73 from repoman.errors import err
74 @@ -58,7 +59,7 @@ from repoman.modules.commit import repochecks
75 from repoman.profile import check_profiles, dev_keywords, setup_profile
76 from repoman.qa_data import (
77 format_qa_output, format_qa_output_column, qahelp,
78 - qawarnings, qacats, max_desc_len, missingvars,
79 + qawarnings, qacats, missingvars,
80 suspect_virtual, suspect_rdepend, valid_restrict)
81 from repoman.qa_tracker import QATracker
82 from repoman.repos import RepoSettings, repo_metadata
83 @@ -287,6 +288,7 @@ keywordcheck = KeywordChecks(qatracker)
84 liveeclasscheck = LiveEclassChecks(qatracker)
85 rubyeclasscheck = RubyEclassChecks(qatracker)
86 eapicheck = EAPIChecks(qatracker, repo_settings)
87 +descriptioncheck = DescriptionChecks(qatracker)
88 ######################
89
90 for xpkg in effective_scanlist:
91 @@ -426,18 +428,9 @@ for xpkg in effective_scanlist:
92 myqakey = var + ".virtual"
93 qatracker.add_error(myqakey, ebuild.relative_path)
94
95 - if myaux['DESCRIPTION'][-1:] in ['.']:
96 - qatracker.add_error(
97 - 'DESCRIPTION.punctuation',
98 - "%s: DESCRIPTION ends with a '%s' character" %
99 - (ebuild.relative_path, myaux['DESCRIPTION'][-1:]))
100 -
101 - # 14 is the length of DESCRIPTION=""
102 - if len(myaux['DESCRIPTION']) > max_desc_len:
103 - qatracker.add_error(
104 - 'DESCRIPTION.toolong',
105 - "%s: DESCRIPTION is %d characters (max %d)" %
106 - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
107 + #######################
108 + descriptioncheck.check(pkg, ebuild)
109 + #######################
110
111 keywords = myaux["KEYWORDS"].split()