Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
Date: Wed, 01 Oct 2014 23:02:47
Message-Id: 1412204294.b1b87fbf2648bd1030ecac0375be622d0a181336.dol-sen@gentoo
1 commit: b1b87fbf2648bd1030ecac0375be622d0a181336
2 Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 6 14:50:26 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Wed Oct 1 22:58:14 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b1b87fbf
7
8 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/
9
10 ---
11 .../checks/ebuilds/variables/description.py | 32 ++++++++++++++++++++++
12 pym/repoman/main.py | 13 ++++-----
13 2 files changed, 38 insertions(+), 7 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..a2b1057
18 --- /dev/null
19 +++ b/pym/repoman/checks/ebuilds/variables/description.py
20 @@ -0,0 +1,32 @@
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._checkTooLong(pkg, ebuild)
44 +
45 + def _checkTooLong(self, pkg, ebuild):
46 + # 14 is the length of DESCRIPTION=""
47 + if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
48 + self.qatracker.add_error(
49 + 'DESCRIPTION.toolong',
50 + "%s: DESCRIPTION is %d characters (max %d)" %
51 + (ebuild.relative_path, len(
52 + pkg._metadata['DESCRIPTION']), max_desc_len))
53
54 diff --git a/pym/repoman/main.py b/pym/repoman/main.py
55 index c6f38df..ed3cf88 100755
56 --- a/pym/repoman/main.py
57 +++ b/pym/repoman/main.py
58 @@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
59 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
60 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
61 from repoman.checks.ebuilds.use_flags import USEFlagChecks
62 +from repoman.checks.ebuilds.variables.description import DescriptionChecks
63 from repoman.checks.ebuilds.variables.eapi import EAPIChecks
64 from repoman.ebuild import Ebuild
65 from repoman.errors import err
66 @@ -65,7 +66,7 @@ from repoman.modules.commit import repochecks
67 from repoman.profile import check_profiles, dev_keywords, setup_profile
68 from repoman.qa_data import (
69 format_qa_output, format_qa_output_column, qahelp,
70 - qawarnings, qacats, max_desc_len, missingvars,
71 + qawarnings, qacats, missingvars,
72 suspect_virtual, suspect_rdepend, valid_restrict)
73 from repoman.qa_tracker import QATracker
74 from repoman.repos import RepoSettings, repo_metadata
75 @@ -294,6 +295,7 @@ keywordcheck = KeywordChecks(qatracker)
76 liveeclasscheck = LiveEclassChecks(qatracker)
77 rubyeclasscheck = RubyEclassChecks(qatracker)
78 eapicheck = EAPIChecks(qatracker, repo_settings)
79 +descriptioncheck = DescriptionChecks(qatracker)
80 ######################
81
82 for xpkg in effective_scanlist:
83 @@ -433,12 +435,9 @@ for xpkg in effective_scanlist:
84 myqakey = var + ".virtual"
85 qatracker.add_error(myqakey, ebuild.relative_path)
86
87 - # 14 is the length of DESCRIPTION=""
88 - if len(myaux['DESCRIPTION']) > max_desc_len:
89 - qatracker.add_error(
90 - 'DESCRIPTION.toolong',
91 - "%s: DESCRIPTION is %d characters (max %d)" %
92 - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
93 + #######################
94 + descriptioncheck.check(pkg, ebuild)
95 + #######################
96
97 keywords = myaux["KEYWORDS"].split()