1 |
commit: 836cc3ffc55376348315577958e7212fefa38a2a |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 25 16:50:59 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 25 16:58:53 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=836cc3ff |
7 |
|
8 |
ProfileDependsChecks: encapsulate DependChecks and LicenseChecks |
9 |
|
10 |
pym/repoman/modules/scan/depend/__init__.py | 38 +----- |
11 |
pym/repoman/modules/scan/depend/_depend_checks.py | 150 ++++++++++++++++++++ |
12 |
pym/repoman/modules/scan/depend/depend.py | 158 ---------------------- |
13 |
pym/repoman/modules/scan/depend/profile.py | 17 ++- |
14 |
pym/repoman/modules/scan/metadata/__init__.py | 17 --- |
15 |
pym/repoman/modules/scan/metadata/license.py | 54 -------- |
16 |
pym/repoman/scanner.py | 4 +- |
17 |
7 files changed, 167 insertions(+), 271 deletions(-) |
18 |
|
19 |
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py |
20 |
index 01bd116..6d12286 100644 |
21 |
--- a/pym/repoman/modules/scan/depend/__init__.py |
22 |
+++ b/pym/repoman/modules/scan/depend/__init__.py |
23 |
@@ -10,24 +10,6 @@ module_spec = { |
24 |
'name': 'depend', |
25 |
'description': doc, |
26 |
'provides':{ |
27 |
- 'depend-module': { |
28 |
- 'name': "depend", |
29 |
- 'sourcefile': "depend", |
30 |
- 'class': "DependChecks", |
31 |
- 'description': doc, |
32 |
- 'functions': ['check'], |
33 |
- 'func_desc': { |
34 |
- }, |
35 |
- 'mod_kwargs': ['qatracker', 'portdb' |
36 |
- ], |
37 |
- 'func_kwargs': { |
38 |
- 'baddepsyntax': ('Future', False), |
39 |
- 'badlicsyntax': ('Future', False), |
40 |
- 'ebuild': (None, None), |
41 |
- 'pkg': (None, None), |
42 |
- 'unknown_pkgs': ('Future', 'UNSET'), |
43 |
- }, |
44 |
- }, |
45 |
'profile-module': { |
46 |
'name': "profile", |
47 |
'sourcefile': "profile", |
48 |
@@ -37,30 +19,12 @@ module_spec = { |
49 |
'func_desc': { |
50 |
}, |
51 |
'mod_kwargs': ['qatracker', 'portdb', 'profiles', 'options', |
52 |
- 'repo_settings', 'include_arches', 'caches', |
53 |
+ 'repo_metadata', 'repo_settings', 'include_arches', 'caches', |
54 |
'repoman_incrementals', 'env', 'have', 'dev_keywords' |
55 |
], |
56 |
'func_kwargs': { |
57 |
- 'baddepsyntax': (None, None), |
58 |
'ebuild': (None, None), |
59 |
'pkg': (None, None), |
60 |
- 'unknown_pkgs': (None, None), |
61 |
- }, |
62 |
- }, |
63 |
- 'unknown-module': { |
64 |
- 'name': "unknown", |
65 |
- 'sourcefile': "unknown", |
66 |
- 'class': "DependUnknown", |
67 |
- 'description': doc, |
68 |
- 'functions': ['check'], |
69 |
- 'func_desc': { |
70 |
- }, |
71 |
- 'mod_kwargs': ['qatracker', |
72 |
- ], |
73 |
- 'func_kwargs': { |
74 |
- 'baddepsyntax': (None, None), |
75 |
- 'ebuild': (None, None), |
76 |
- 'unknown_pkgs': ('Future', 'UNSET'), |
77 |
}, |
78 |
}, |
79 |
} |
80 |
|
81 |
diff --git a/pym/repoman/modules/scan/depend/_depend_checks.py b/pym/repoman/modules/scan/depend/_depend_checks.py |
82 |
new file mode 100644 |
83 |
index 0000000..4e1d216 |
84 |
--- /dev/null |
85 |
+++ b/pym/repoman/modules/scan/depend/_depend_checks.py |
86 |
@@ -0,0 +1,150 @@ |
87 |
+# -*- coding:utf-8 -*- |
88 |
+ |
89 |
+ |
90 |
+from _emerge.Package import Package |
91 |
+ |
92 |
+from repoman.check_missingslot import check_missingslot |
93 |
+# import our initialized portage instance |
94 |
+from repoman._portage import portage |
95 |
+from repoman.qa_data import suspect_virtual, suspect_rdepend |
96 |
+ |
97 |
+ |
98 |
+def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata): |
99 |
+ '''Checks the ebuild dependencies for errors |
100 |
+ |
101 |
+ @param pkg: Package in which we check (object). |
102 |
+ @param ebuild: Ebuild which we check (object). |
103 |
+ @param portdb: portdb instance |
104 |
+ @param qatracker: QATracker instance |
105 |
+ @param repo_metadata: dictionary of various repository items. |
106 |
+ @returns: (unknown_pkgs, badlicsyntax) |
107 |
+ ''' |
108 |
+ |
109 |
+ unknown_pkgs = set() |
110 |
+ |
111 |
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \ |
112 |
+ "java-pkg-opt-2" in ebuild.inherited, |
113 |
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited |
114 |
+ # operator_tokens = set(["||", "(", ")"]) |
115 |
+ type_list, badsyntax = [], [] |
116 |
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"): |
117 |
+ mydepstr = ebuild.metadata[mytype] |
118 |
+ |
119 |
+ buildtime = mytype in Package._buildtime_keys |
120 |
+ runtime = mytype in Package._runtime_keys |
121 |
+ token_class = None |
122 |
+ if mytype.endswith("DEPEND"): |
123 |
+ token_class = portage.dep.Atom |
124 |
+ |
125 |
+ try: |
126 |
+ atoms = portage.dep.use_reduce( |
127 |
+ mydepstr, matchall=1, flat=True, |
128 |
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class) |
129 |
+ except portage.exception.InvalidDependString as e: |
130 |
+ atoms = None |
131 |
+ badsyntax.append(str(e)) |
132 |
+ |
133 |
+ if atoms and mytype.endswith("DEPEND"): |
134 |
+ if runtime and \ |
135 |
+ "test?" in mydepstr.split(): |
136 |
+ qatracker.add_error( |
137 |
+ mytype + '.suspect', |
138 |
+ "%s: 'test?' USE conditional in %s" % |
139 |
+ (ebuild.relative_path, mytype)) |
140 |
+ |
141 |
+ for atom in atoms: |
142 |
+ if atom == "||": |
143 |
+ continue |
144 |
+ |
145 |
+ is_blocker = atom.blocker |
146 |
+ |
147 |
+ # Skip dependency.unknown for blockers, so that we |
148 |
+ # don't encourage people to remove necessary blockers, |
149 |
+ # as discussed in bug 382407. We use atom.without_use |
150 |
+ # due to bug 525376. |
151 |
+ if not is_blocker and \ |
152 |
+ not portdb.xmatch("match-all", atom.without_use) and \ |
153 |
+ not atom.cp.startswith("virtual/"): |
154 |
+ unknown_pkgs.add((mytype, atom.unevaluated_atom)) |
155 |
+ |
156 |
+ if pkg.category != "virtual": |
157 |
+ if not is_blocker and \ |
158 |
+ atom.cp in suspect_virtual: |
159 |
+ qatracker.add_error( |
160 |
+ 'virtual.suspect', ebuild.relative_path + |
161 |
+ ": %s: consider using '%s' instead of '%s'" % |
162 |
+ (mytype, suspect_virtual[atom.cp], atom)) |
163 |
+ if not is_blocker and \ |
164 |
+ atom.cp.startswith("perl-core/"): |
165 |
+ qatracker.add_error('dependency.perlcore', |
166 |
+ ebuild.relative_path + |
167 |
+ ": %s: please use '%s' instead of '%s'" % |
168 |
+ (mytype, |
169 |
+ atom.replace("perl-core/","virtual/perl-"), |
170 |
+ atom)) |
171 |
+ |
172 |
+ if buildtime and \ |
173 |
+ not is_blocker and \ |
174 |
+ not inherited_java_eclass and \ |
175 |
+ atom.cp == "virtual/jdk": |
176 |
+ qatracker.add_error( |
177 |
+ 'java.eclassesnotused', ebuild.relative_path) |
178 |
+ elif buildtime and \ |
179 |
+ not is_blocker and \ |
180 |
+ not inherited_wxwidgets_eclass and \ |
181 |
+ atom.cp == "x11-libs/wxGTK": |
182 |
+ qatracker.add_error( |
183 |
+ 'wxwidgets.eclassnotused', |
184 |
+ "%s: %ss on x11-libs/wxGTK without inheriting" |
185 |
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype)) |
186 |
+ elif runtime: |
187 |
+ if not is_blocker and \ |
188 |
+ atom.cp in suspect_rdepend: |
189 |
+ qatracker.add_error( |
190 |
+ mytype + '.suspect', |
191 |
+ ebuild.relative_path + ": '%s'" % atom) |
192 |
+ |
193 |
+ if atom.operator == "~" and \ |
194 |
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0": |
195 |
+ qacat = 'dependency.badtilde' |
196 |
+ qatracker.add_error( |
197 |
+ qacat, "%s: %s uses the ~ operator" |
198 |
+ " with a non-zero revision: '%s'" % |
199 |
+ (ebuild.relative_path, mytype, atom)) |
200 |
+ |
201 |
+ check_missingslot(atom, mytype, ebuild.eapi, portdb, qatracker, |
202 |
+ ebuild.relative_path, ebuild.metadata) |
203 |
+ |
204 |
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list))) |
205 |
+ |
206 |
+ for m, b in zip(type_list, badsyntax): |
207 |
+ if m.endswith("DEPEND"): |
208 |
+ qacat = "dependency.syntax" |
209 |
+ else: |
210 |
+ qacat = m + ".syntax" |
211 |
+ qatracker.add_error( |
212 |
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b)) |
213 |
+ |
214 |
+ # data required for some other tests |
215 |
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"]) |
216 |
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"]) |
217 |
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax |
218 |
+ badlicsyntax = badlicsyntax > 0 |
219 |
+ #badprovsyntax = badprovsyntax > 0 |
220 |
+ |
221 |
+ # Parse the LICENSE variable, remove USE conditions and flatten it. |
222 |
+ licenses = portage.dep.use_reduce( |
223 |
+ ebuild.metadata["LICENSE"], matchall=1, flat=True) |
224 |
+ |
225 |
+ # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. |
226 |
+ for lic in licenses: |
227 |
+ # Need to check for "||" manually as no portage |
228 |
+ # function will remove it without removing values. |
229 |
+ if lic not in repo_metadata['liclist'] and lic != "||": |
230 |
+ qatracker.add_error("LICENSE.invalid", |
231 |
+ "%s: %s" % (ebuild.relative_path, lic)) |
232 |
+ elif lic in repo_metadata['lic_deprecated']: |
233 |
+ qatracker.add_error("LICENSE.deprecated", |
234 |
+ "%s: %s" % (ebuild.relative_path, lic)) |
235 |
+ |
236 |
+ return unknown_pkgs, baddepsyntax |
237 |
|
238 |
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py |
239 |
deleted file mode 100644 |
240 |
index 44a21e9..0000000 |
241 |
--- a/pym/repoman/modules/scan/depend/depend.py |
242 |
+++ /dev/null |
243 |
@@ -1,158 +0,0 @@ |
244 |
-# -*- coding:utf-8 -*- |
245 |
- |
246 |
- |
247 |
-from _emerge.Package import Package |
248 |
- |
249 |
-from repoman.check_missingslot import check_missingslot |
250 |
-# import our initialized portage instance |
251 |
-from repoman._portage import portage |
252 |
-from repoman.modules.scan.scanbase import ScanBase |
253 |
-from repoman.qa_data import suspect_virtual, suspect_rdepend |
254 |
- |
255 |
- |
256 |
-class DependChecks(ScanBase): |
257 |
- '''Perform dependency checks''' |
258 |
- |
259 |
- def __init__(self, **kwargs): |
260 |
- ''' |
261 |
- @param portdb: portdb instance |
262 |
- @param qatracker: QATracker instance |
263 |
- ''' |
264 |
- self.qatracker = kwargs.get('qatracker') |
265 |
- self.portdb = kwargs.get('portdb') |
266 |
- |
267 |
- def check(self, **kwargs): |
268 |
- '''Checks the ebuild dependencies for errors |
269 |
- |
270 |
- @param pkg: Package in which we check (object). |
271 |
- @param ebuild: Ebuild which we check (object). |
272 |
- @returns: boolean |
273 |
- ''' |
274 |
- ebuild = kwargs.get('ebuild').get() |
275 |
- pkg = kwargs.get('pkg').get() |
276 |
- |
277 |
- unknown_pkgs = set() |
278 |
- |
279 |
- inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \ |
280 |
- "java-pkg-opt-2" in ebuild.inherited, |
281 |
- inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited |
282 |
- # operator_tokens = set(["||", "(", ")"]) |
283 |
- type_list, badsyntax = [], [] |
284 |
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"): |
285 |
- mydepstr = ebuild.metadata[mytype] |
286 |
- |
287 |
- buildtime = mytype in Package._buildtime_keys |
288 |
- runtime = mytype in Package._runtime_keys |
289 |
- token_class = None |
290 |
- if mytype.endswith("DEPEND"): |
291 |
- token_class = portage.dep.Atom |
292 |
- |
293 |
- try: |
294 |
- atoms = portage.dep.use_reduce( |
295 |
- mydepstr, matchall=1, flat=True, |
296 |
- is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class) |
297 |
- except portage.exception.InvalidDependString as e: |
298 |
- atoms = None |
299 |
- badsyntax.append(str(e)) |
300 |
- |
301 |
- if atoms and mytype.endswith("DEPEND"): |
302 |
- if runtime and \ |
303 |
- "test?" in mydepstr.split(): |
304 |
- self.qatracker.add_error( |
305 |
- mytype + '.suspect', |
306 |
- "%s: 'test?' USE conditional in %s" % |
307 |
- (ebuild.relative_path, mytype)) |
308 |
- |
309 |
- for atom in atoms: |
310 |
- if atom == "||": |
311 |
- continue |
312 |
- |
313 |
- is_blocker = atom.blocker |
314 |
- |
315 |
- # Skip dependency.unknown for blockers, so that we |
316 |
- # don't encourage people to remove necessary blockers, |
317 |
- # as discussed in bug 382407. We use atom.without_use |
318 |
- # due to bug 525376. |
319 |
- if not is_blocker and \ |
320 |
- not self.portdb.xmatch("match-all", atom.without_use) and \ |
321 |
- not atom.cp.startswith("virtual/"): |
322 |
- unknown_pkgs.add((mytype, atom.unevaluated_atom)) |
323 |
- |
324 |
- if kwargs.get('catdir') != "virtual": |
325 |
- if not is_blocker and \ |
326 |
- atom.cp in suspect_virtual: |
327 |
- self.qatracker.add_error( |
328 |
- 'virtual.suspect', ebuild.relative_path + |
329 |
- ": %s: consider using '%s' instead of '%s'" % |
330 |
- (mytype, suspect_virtual[atom.cp], atom)) |
331 |
- if not is_blocker and \ |
332 |
- atom.cp.startswith("perl-core/"): |
333 |
- self.qatracker.add_error('dependency.perlcore', |
334 |
- ebuild.relative_path + |
335 |
- ": %s: please use '%s' instead of '%s'" % |
336 |
- (mytype, |
337 |
- atom.replace("perl-core/","virtual/perl-"), |
338 |
- atom)) |
339 |
- |
340 |
- if buildtime and \ |
341 |
- not is_blocker and \ |
342 |
- not inherited_java_eclass and \ |
343 |
- atom.cp == "virtual/jdk": |
344 |
- self.qatracker.add_error( |
345 |
- 'java.eclassesnotused', ebuild.relative_path) |
346 |
- elif buildtime and \ |
347 |
- not is_blocker and \ |
348 |
- not inherited_wxwidgets_eclass and \ |
349 |
- atom.cp == "x11-libs/wxGTK": |
350 |
- self.qatracker.add_error( |
351 |
- 'wxwidgets.eclassnotused', |
352 |
- "%s: %ss on x11-libs/wxGTK without inheriting" |
353 |
- " wxwidgets.eclass" % (ebuild.relative_path, mytype)) |
354 |
- elif runtime: |
355 |
- if not is_blocker and \ |
356 |
- atom.cp in suspect_rdepend: |
357 |
- self.qatracker.add_error( |
358 |
- mytype + '.suspect', |
359 |
- ebuild.relative_path + ": '%s'" % atom) |
360 |
- |
361 |
- if atom.operator == "~" and \ |
362 |
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0": |
363 |
- qacat = 'dependency.badtilde' |
364 |
- self.qatracker.add_error( |
365 |
- qacat, "%s: %s uses the ~ operator" |
366 |
- " with a non-zero revision: '%s'" % |
367 |
- (ebuild.relative_path, mytype, atom)) |
368 |
- |
369 |
- check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker, |
370 |
- ebuild.relative_path, ebuild.metadata) |
371 |
- |
372 |
- type_list.extend([mytype] * (len(badsyntax) - len(type_list))) |
373 |
- |
374 |
- for m, b in zip(type_list, badsyntax): |
375 |
- if m.endswith("DEPEND"): |
376 |
- qacat = "dependency.syntax" |
377 |
- else: |
378 |
- qacat = m + ".syntax" |
379 |
- self.qatracker.add_error( |
380 |
- qacat, "%s: %s: %s" % (ebuild.relative_path, m, b)) |
381 |
- |
382 |
- # data required for some other tests |
383 |
- badlicsyntax = len([z for z in type_list if z == "LICENSE"]) |
384 |
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"]) |
385 |
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax |
386 |
- badlicsyntax = badlicsyntax > 0 |
387 |
- #badprovsyntax = badprovsyntax > 0 |
388 |
- |
389 |
- # update the dynamic data |
390 |
- dyn_unknown = kwargs.get('unknown_pkgs') |
391 |
- dyn_unknown.set(unknown_pkgs) |
392 |
- dyn_badlicsyntax = kwargs.get('badlicsyntax') |
393 |
- dyn_badlicsyntax.set(badlicsyntax, ignore_InvalidState=True) |
394 |
- dyn_baddepsyntax = kwargs.get('baddepsyntax') |
395 |
- dyn_baddepsyntax.set(baddepsyntax, ignore_InvalidState=True) |
396 |
- return False |
397 |
- |
398 |
- @property |
399 |
- def runInEbuilds(self): |
400 |
- '''Ebuild level scans''' |
401 |
- return (True, [self.check]) |
402 |
|
403 |
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py |
404 |
index 0388374..5b32f66 100644 |
405 |
--- a/pym/repoman/modules/scan/depend/profile.py |
406 |
+++ b/pym/repoman/modules/scan/depend/profile.py |
407 |
@@ -9,6 +9,7 @@ from _emerge.Package import Package |
408 |
# import our initialized portage instance |
409 |
from repoman._portage import portage |
410 |
from repoman.modules.scan.scanbase import ScanBase |
411 |
+from repoman.modules.scan.depend._depend_checks import _depend_checks |
412 |
from repoman.modules.scan.depend._gen_arches import _gen_arches |
413 |
from portage.dep import Atom |
414 |
|
415 |
@@ -34,6 +35,7 @@ class ProfileDependsChecks(ScanBase): |
416 |
@param env: the environment |
417 |
@param have: dictionary instance |
418 |
@param dev_keywords: developer profile keywords |
419 |
+ @param repo_metadata: dictionary of various repository items. |
420 |
''' |
421 |
self.qatracker = kwargs.get('qatracker') |
422 |
self.portdb = kwargs.get('portdb') |
423 |
@@ -46,6 +48,7 @@ class ProfileDependsChecks(ScanBase): |
424 |
self.env = kwargs.get('env') |
425 |
self.have = kwargs.get('have') |
426 |
self.dev_keywords = kwargs.get('dev_keywords') |
427 |
+ self.repo_metadata = kwargs.get('repo_metadata') |
428 |
|
429 |
def check(self, **kwargs): |
430 |
'''Perform profile dependant dependancy checks |
431 |
@@ -59,8 +62,8 @@ class ProfileDependsChecks(ScanBase): |
432 |
''' |
433 |
ebuild = kwargs.get('ebuild').get() |
434 |
pkg = kwargs.get('pkg').get() |
435 |
- baddepsyntax = kwargs.get('baddepsyntax').get() |
436 |
- unknown_pkgs = kwargs.get('unknown_pkgs').get() |
437 |
+ unknown_pkgs, baddepsyntax = _depend_checks( |
438 |
+ ebuild, pkg, self.portdb, self.qatracker, self.repo_metadata) |
439 |
|
440 |
relevant_profiles = [] |
441 |
for keyword, arch, groups in _gen_arches(ebuild, self.options, |
442 |
@@ -226,6 +229,16 @@ class ProfileDependsChecks(ScanBase): |
443 |
"%s: %s: %s(%s)\n%s" |
444 |
% (ebuild.relative_path, mytype, keyword, |
445 |
prof, pformat(atoms, indent=6))) |
446 |
+ |
447 |
+ if not baddepsyntax and unknown_pkgs: |
448 |
+ type_map = {} |
449 |
+ for mytype, atom in unknown_pkgs: |
450 |
+ type_map.setdefault(mytype, set()).add(atom) |
451 |
+ for mytype, atoms in type_map.items(): |
452 |
+ self.qatracker.add_error( |
453 |
+ "dependency.unknown", "%s: %s: %s" |
454 |
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms)))) |
455 |
+ |
456 |
return False |
457 |
|
458 |
@property |
459 |
|
460 |
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py |
461 |
index 1a6c0ed..c297676 100644 |
462 |
--- a/pym/repoman/modules/scan/metadata/__init__.py |
463 |
+++ b/pym/repoman/modules/scan/metadata/__init__.py |
464 |
@@ -61,23 +61,6 @@ module_spec = { |
465 |
'pkg': ('Future', 'UNSET'), |
466 |
}, |
467 |
}, |
468 |
- 'license-metadata': { |
469 |
- 'name': "license", |
470 |
- 'sourcefile': "license", |
471 |
- 'class': "LicenseChecks", |
472 |
- 'description': doc, |
473 |
- 'functions': ['check'], |
474 |
- 'func_desc': { |
475 |
- }, |
476 |
- 'mod_kwargs': ['qatracker', 'repo_metadata', |
477 |
- ], |
478 |
- 'func_kwargs': { |
479 |
- 'badlicsyntax': (None, None), |
480 |
- 'ebuild': (None, None), |
481 |
- 'xpkg': (None, None), |
482 |
- 'y_ebuild': (None, None), |
483 |
- }, |
484 |
- }, |
485 |
'restrict-metadata': { |
486 |
'name': "restrict", |
487 |
'sourcefile': "restrict", |
488 |
|
489 |
diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py |
490 |
deleted file mode 100644 |
491 |
index 4a67c70..0000000 |
492 |
--- a/pym/repoman/modules/scan/metadata/license.py |
493 |
+++ /dev/null |
494 |
@@ -1,54 +0,0 @@ |
495 |
- |
496 |
-'''license.py |
497 |
-Perform checks on the LICENSE variable. |
498 |
-''' |
499 |
- |
500 |
-# import our initialized portage instance |
501 |
-from repoman._portage import portage |
502 |
-from repoman.modules.scan.scanbase import ScanBase |
503 |
- |
504 |
- |
505 |
-class LicenseChecks(ScanBase): |
506 |
- '''Perform checks on the LICENSE variable.''' |
507 |
- |
508 |
- def __init__(self, **kwargs): |
509 |
- ''' |
510 |
- @param qatracker: QATracker instance |
511 |
- @param repo_metadata: dictionary of various repository items. |
512 |
- ''' |
513 |
- self.qatracker = kwargs.get('qatracker') |
514 |
- self.repo_metadata = kwargs.get('repo_metadata') |
515 |
- |
516 |
- def check(self, **kwargs): |
517 |
- ''' |
518 |
- @param xpkg: Package in which we check (string). |
519 |
- @param ebuild: Ebuild which we check (object). |
520 |
- @param y_ebuild: Ebuild which we check (string). |
521 |
- ''' |
522 |
- xpkg = kwargs.get('xpkg') |
523 |
- ebuild = kwargs.get('ebuild').get() |
524 |
- y_ebuild = kwargs.get('y_ebuild') |
525 |
- if not kwargs.get('badlicsyntax').get(): |
526 |
- # Parse the LICENSE variable, remove USE conditions and flatten it. |
527 |
- licenses = portage.dep.use_reduce( |
528 |
- ebuild.metadata["LICENSE"], matchall=1, flat=True) |
529 |
- |
530 |
- # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. |
531 |
- for lic in licenses: |
532 |
- # Need to check for "||" manually as no portage |
533 |
- # function will remove it without removing values. |
534 |
- if lic not in self.repo_metadata['liclist'] and lic != "||": |
535 |
- self.qatracker.add_error("LICENSE.invalid", |
536 |
- "%s/%s.ebuild: %s" % (xpkg, y_ebuild, lic)) |
537 |
- elif lic in self.repo_metadata['lic_deprecated']: |
538 |
- self.qatracker.add_error("LICENSE.deprecated", |
539 |
- "%s: %s" % (ebuild.relative_path, lic)) |
540 |
- return False |
541 |
- |
542 |
- @property |
543 |
- def runInPkgs(self): |
544 |
- return (False, []) |
545 |
- |
546 |
- @property |
547 |
- def runInEbuilds(self): |
548 |
- return (True, [self.check]) |
549 |
|
550 |
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py |
551 |
index 2224fa3..f6dcc1b 100644 |
552 |
--- a/pym/repoman/scanner.py |
553 |
+++ b/pym/repoman/scanner.py |
554 |
@@ -380,13 +380,11 @@ class Scanner(object): |
555 |
('thirdpartymirrors', 'ThirdPartyMirrors'), |
556 |
('description', 'DescriptionChecks'), |
557 |
('keywords', 'KeywordChecks'), |
558 |
- ('depend', 'DependChecks'), |
559 |
('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'), |
560 |
- ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'), |
561 |
+ ('restrict', 'RestrictChecks'), |
562 |
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'), |
563 |
# Options.is_forced() is used to bypass further checks |
564 |
('options', 'Options'), ('profile', 'ProfileDependsChecks'), |
565 |
- ('unknown', 'DependUnknown'), |
566 |
]: |
567 |
if mod[0] and mod[1] not in self.modules: |
568 |
mod_class = MODULE_CONTROLLER.get_class(mod[0]) |