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