1 |
commit: f662a734a28a9c6a13233693fd08498d371054e0 |
2 |
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 6 14:50:26 2014 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 21 23:42:44 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f662a734 |
7 |
|
8 |
repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ |
9 |
|
10 |
.../checks/ebuilds/variables/description.py | 32 ++++++++++++++++++++++ |
11 |
pym/repoman/main.py | 13 ++++----- |
12 |
2 files changed, 38 insertions(+), 7 deletions(-) |
13 |
|
14 |
diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py |
15 |
new file mode 100644 |
16 |
index 0000000..a2b1057 |
17 |
--- /dev/null |
18 |
+++ b/pym/repoman/checks/ebuilds/variables/description.py |
19 |
@@ -0,0 +1,32 @@ |
20 |
+ |
21 |
+'''description.py |
22 |
+Perform checks on the DESCRIPTION variable. |
23 |
+''' |
24 |
+ |
25 |
+from repoman.qa_data import max_desc_len |
26 |
+ |
27 |
+ |
28 |
+class DescriptionChecks(object): |
29 |
+ '''Perform checks on the DESCRIPTION variable.''' |
30 |
+ |
31 |
+ def __init__(self, qatracker): |
32 |
+ ''' |
33 |
+ @param qatracker: QATracker instance |
34 |
+ ''' |
35 |
+ self.qatracker = qatracker |
36 |
+ |
37 |
+ def check(self, pkg, ebuild): |
38 |
+ ''' |
39 |
+ @param pkg: Package in which we check (object). |
40 |
+ @param ebuild: Ebuild which we check (object). |
41 |
+ ''' |
42 |
+ self._checkTooLong(pkg, ebuild) |
43 |
+ |
44 |
+ def _checkTooLong(self, pkg, ebuild): |
45 |
+ # 14 is the length of DESCRIPTION="" |
46 |
+ if len(pkg._metadata['DESCRIPTION']) > max_desc_len: |
47 |
+ self.qatracker.add_error( |
48 |
+ 'DESCRIPTION.toolong', |
49 |
+ "%s: DESCRIPTION is %d characters (max %d)" % |
50 |
+ (ebuild.relative_path, len( |
51 |
+ pkg._metadata['DESCRIPTION']), max_desc_len)) |
52 |
|
53 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
54 |
index 42600cd..7b36852 100755 |
55 |
--- a/pym/repoman/main.py |
56 |
+++ b/pym/repoman/main.py |
57 |
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot |
58 |
from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid |
59 |
from repoman.checks.ebuilds.pkgmetadata import PkgMetadata |
60 |
from repoman.checks.ebuilds.use_flags import USEFlagChecks |
61 |
+from repoman.checks.ebuilds.variables.description import DescriptionChecks |
62 |
from repoman.checks.ebuilds.variables.eapi import EAPIChecks |
63 |
from repoman.ebuild import Ebuild |
64 |
from repoman.errors import err |
65 |
@@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks |
66 |
from repoman.profile import check_profiles, dev_keywords, setup_profile |
67 |
from repoman.qa_data import ( |
68 |
format_qa_output, format_qa_output_column, qahelp, |
69 |
- qawarnings, qacats, max_desc_len, missingvars, |
70 |
+ qawarnings, qacats, missingvars, |
71 |
suspect_virtual, suspect_rdepend, valid_restrict) |
72 |
from repoman.qa_tracker import QATracker |
73 |
from repoman.repos import RepoSettings, repo_metadata |
74 |
@@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options) |
75 |
liveeclasscheck = LiveEclassChecks(qatracker) |
76 |
rubyeclasscheck = RubyEclassChecks(qatracker) |
77 |
eapicheck = EAPIChecks(qatracker, repo_settings) |
78 |
+descriptioncheck = DescriptionChecks(qatracker) |
79 |
###################### |
80 |
|
81 |
for xpkg in effective_scanlist: |
82 |
@@ -436,12 +438,9 @@ for xpkg in effective_scanlist: |
83 |
myqakey = var + ".virtual" |
84 |
qatracker.add_error(myqakey, ebuild.relative_path) |
85 |
|
86 |
- # 14 is the length of DESCRIPTION="" |
87 |
- if len(myaux['DESCRIPTION']) > max_desc_len: |
88 |
- qatracker.add_error( |
89 |
- 'DESCRIPTION.toolong', |
90 |
- "%s: DESCRIPTION is %d characters (max %d)" % |
91 |
- (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) |
92 |
+ ####################### |
93 |
+ descriptioncheck.check(pkg, ebuild) |
94 |
+ ####################### |
95 |
|
96 |
keywords = myaux["KEYWORDS"].split() |