1 |
commit: 42e0de9ed35a8f933e482656b38d118325f2e5d3 |
2 |
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 6 15:23:33 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Oct 1 22:58:15 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=42e0de9e |
7 |
|
8 |
repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ |
9 |
|
10 |
--- |
11 |
pym/repoman/checks/ebuilds/variables/restrict.py | 41 ++++++++++++++++++++++++ |
12 |
pym/repoman/main.py | 25 ++++----------- |
13 |
2 files changed, 47 insertions(+), 19 deletions(-) |
14 |
|
15 |
diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py |
16 |
new file mode 100644 |
17 |
index 0000000..215b792 |
18 |
--- /dev/null |
19 |
+++ b/pym/repoman/checks/ebuilds/variables/restrict.py |
20 |
@@ -0,0 +1,41 @@ |
21 |
+ |
22 |
+'''restrict.py |
23 |
+Perform checks on the RESTRICT variable. |
24 |
+''' |
25 |
+ |
26 |
+# import our initialized portage instance |
27 |
+from repoman._portage import portage |
28 |
+ |
29 |
+from repoman.qa_data import valid_restrict |
30 |
+ |
31 |
+ |
32 |
+class RestrictChecks(object): |
33 |
+ '''Perform checks on the RESTRICT variable.''' |
34 |
+ |
35 |
+ def __init__(self, qatracker): |
36 |
+ ''' |
37 |
+ @param qatracker: QATracker instance |
38 |
+ ''' |
39 |
+ self.qatracker = qatracker |
40 |
+ |
41 |
+ def check(self, pkg, package, ebuild, y_ebuild): |
42 |
+ myrestrict = None |
43 |
+ |
44 |
+ try: |
45 |
+ myrestrict = portage.dep.use_reduce( |
46 |
+ pkg._metadata["RESTRICT"], matchall=1, flat=True) |
47 |
+ except portage.exception.InvalidDependString as e: |
48 |
+ self. qatracker.add_error( |
49 |
+ "RESTRICT.syntax", |
50 |
+ "%s: RESTRICT: %s" % (ebuild.relative_path, e)) |
51 |
+ del e |
52 |
+ |
53 |
+ if myrestrict: |
54 |
+ myrestrict = set(myrestrict) |
55 |
+ mybadrestrict = myrestrict.difference(valid_restrict) |
56 |
+ |
57 |
+ if mybadrestrict: |
58 |
+ for mybad in mybadrestrict: |
59 |
+ self.qatracker.add_error( |
60 |
+ "RESTRICT.invalid", |
61 |
+ package + "/" + y_ebuild + ".ebuild: %s" % mybad) |
62 |
|
63 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
64 |
index 722de79..b3e93bf 100755 |
65 |
--- a/pym/repoman/main.py |
66 |
+++ b/pym/repoman/main.py |
67 |
@@ -61,6 +61,7 @@ from repoman.checks.ebuilds.use_flags import USEFlagChecks |
68 |
from repoman.checks.ebuilds.variables.description import DescriptionChecks |
69 |
from repoman.checks.ebuilds.variables.eapi import EAPIChecks |
70 |
from repoman.checks.ebuilds.variables.license import LicenseChecks |
71 |
+from repoman.checks.ebuilds.variables.restrict import RestrictChecks |
72 |
from repoman.ebuild import Ebuild |
73 |
from repoman.errors import err |
74 |
from repoman.modules.commit import repochecks |
75 |
@@ -68,7 +69,7 @@ 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, missingvars, |
79 |
- suspect_virtual, suspect_rdepend, valid_restrict) |
80 |
+ suspect_virtual, suspect_rdepend) |
81 |
from repoman.qa_tracker import QATracker |
82 |
from repoman.repos import RepoSettings, repo_metadata |
83 |
from repoman.scan import Changes, scan |
84 |
@@ -298,6 +299,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) |
85 |
eapicheck = EAPIChecks(qatracker, repo_settings) |
86 |
descriptioncheck = DescriptionChecks(qatracker) |
87 |
licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) |
88 |
+restrictcheck = RestrictChecks(qatracker) |
89 |
###################### |
90 |
|
91 |
for xpkg in effective_scanlist: |
92 |
@@ -617,24 +619,9 @@ for xpkg in effective_scanlist: |
93 |
licensecheck.check(pkg, xpkg, ebuild, y_ebuild) |
94 |
################# |
95 |
|
96 |
- # restrict checks |
97 |
- myrestrict = None |
98 |
- try: |
99 |
- myrestrict = portage.dep.use_reduce( |
100 |
- myaux["RESTRICT"], matchall=1, flat=True) |
101 |
- except portage.exception.InvalidDependString as e: |
102 |
- qatracker.add_error( |
103 |
- "RESTRICT.syntax", |
104 |
- "%s: RESTRICT: %s" % (ebuild.relative_path, e)) |
105 |
- del e |
106 |
- if myrestrict: |
107 |
- myrestrict = set(myrestrict) |
108 |
- mybadrestrict = myrestrict.difference(valid_restrict) |
109 |
- if mybadrestrict: |
110 |
- for mybad in mybadrestrict: |
111 |
- qatracker.add_error( |
112 |
- "RESTRICT.invalid", |
113 |
- xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad) |
114 |
+ ################# |
115 |
+ restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) |
116 |
+ ################# |
117 |
|
118 |
# Syntax Checks |