1 |
commit: 4cd224554dd4d6f31cdc1cd610473e71a9d3b76f |
2 |
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 6 14:40:39 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=4cd22455 |
7 |
|
8 |
repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py |
9 |
|
10 |
--- |
11 |
pym/repoman/checks/ebuilds/variables/__init__.py | 0 |
12 |
pym/repoman/checks/ebuilds/variables/eapi.py | 44 ++++++++++++++++++++++++ |
13 |
pym/repoman/main.py | 12 +++---- |
14 |
3 files changed, 49 insertions(+), 7 deletions(-) |
15 |
|
16 |
diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py |
17 |
new file mode 100644 |
18 |
index 0000000..e69de29 |
19 |
|
20 |
diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py |
21 |
new file mode 100644 |
22 |
index 0000000..2f8b1cb |
23 |
--- /dev/null |
24 |
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py |
25 |
@@ -0,0 +1,44 @@ |
26 |
+ |
27 |
+'''eapi.py |
28 |
+Perform checks on the EAPI variable. |
29 |
+''' |
30 |
+ |
31 |
+ |
32 |
+class EAPIChecks(object): |
33 |
+ '''Perform checks on the EAPI variable.''' |
34 |
+ |
35 |
+ def __init__(self, qatracker, repo_settings): |
36 |
+ ''' |
37 |
+ @param qatracker: QATracker instance |
38 |
+ @param repo_settings: Repository settings |
39 |
+ ''' |
40 |
+ self.qatracker = qatracker |
41 |
+ self.repo_settings = repo_settings |
42 |
+ |
43 |
+ def check(self, pkg, ebuild): |
44 |
+ ''' |
45 |
+ @param pkg: Package in which we check (object). |
46 |
+ @param ebuild: Ebuild which we check (object). |
47 |
+ ''' |
48 |
+ eapi = pkg._metadata["EAPI"] |
49 |
+ |
50 |
+ if not self._checkBanned(ebuild, eapi): |
51 |
+ self._checkDeprecated(ebuild, eapi) |
52 |
+ |
53 |
+ def _checkBanned(self, ebuild, eapi): |
54 |
+ if self.repo_settings.repo_config.eapi_is_banned(eapi): |
55 |
+ self.qatracker.add_error( |
56 |
+ "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) |
57 |
+ |
58 |
+ return True |
59 |
+ |
60 |
+ return False |
61 |
+ |
62 |
+ def _checkDeprecated(self, ebuild, eapi): |
63 |
+ if self.repo_settings.repo_config.eapi_is_deprecated(eapi): |
64 |
+ self.qatracker.add_error( |
65 |
+ "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) |
66 |
+ |
67 |
+ return True |
68 |
+ |
69 |
+ return False |
70 |
|
71 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
72 |
index ecdecfa..c6f38df 100755 |
73 |
--- a/pym/repoman/main.py |
74 |
+++ b/pym/repoman/main.py |
75 |
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests |
76 |
from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid |
77 |
from repoman.checks.ebuilds.pkgmetadata import PkgMetadata |
78 |
from repoman.checks.ebuilds.use_flags import USEFlagChecks |
79 |
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks |
80 |
from repoman.ebuild import Ebuild |
81 |
from repoman.errors import err |
82 |
from repoman.modules.commit import repochecks |
83 |
@@ -292,6 +293,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) |
84 |
keywordcheck = KeywordChecks(qatracker) |
85 |
liveeclasscheck = LiveEclassChecks(qatracker) |
86 |
rubyeclasscheck = RubyEclassChecks(qatracker) |
87 |
+eapicheck = EAPIChecks(qatracker, repo_settings) |
88 |
###################### |
89 |
|
90 |
for xpkg in effective_scanlist: |
91 |
@@ -393,13 +395,9 @@ for xpkg in effective_scanlist: |
92 |
inherited = pkg.inherited |
93 |
live_ebuild = live_eclasses.intersection(inherited) |
94 |
|
95 |
- if repo_settings.repo_config.eapi_is_banned(eapi): |
96 |
- qatracker.add_error( |
97 |
- "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) |
98 |
- |
99 |
- elif repo_settings.repo_config.eapi_is_deprecated(eapi): |
100 |
- qatracker.add_error( |
101 |
- "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) |
102 |
+ ####################### |
103 |
+ eapicheck.check(pkg, ebuild) |
104 |
+ ####################### |
105 |
|
106 |
for k, v in myaux.items(): |
107 |
if not isinstance(v, basestring): |