1 |
commit: d51cbc5ea2f66803d073d9faed2ba79f9fe78472 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 29 02:36:13 2012 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Fri Jun 29 02:36:13 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d51cbc5e |
7 |
|
8 |
move enalyse/base.py to gentoolkit for general module use. |
9 |
|
10 |
--- |
11 |
pym/gentoolkit/enalyze/analyze.py | 786 ++++++++++---------- |
12 |
pym/gentoolkit/enalyze/rebuild.py | 650 ++++++++-------- |
13 |
pym/gentoolkit/{enalyze/base.py => module_base.py} | 0 |
14 |
3 files changed, 718 insertions(+), 718 deletions(-) |
15 |
|
16 |
diff --git a/pym/gentoolkit/enalyze/analyze.py b/pym/gentoolkit/enalyze/analyze.py |
17 |
index 180865d..33d1651 100644 |
18 |
--- a/pym/gentoolkit/enalyze/analyze.py |
19 |
+++ b/pym/gentoolkit/enalyze/analyze.py |
20 |
@@ -14,7 +14,7 @@ import sys |
21 |
|
22 |
import gentoolkit |
23 |
from gentoolkit.dbapi import PORTDB, VARDB |
24 |
-from gentoolkit.enalyze.base import ModuleBase |
25 |
+from gentoolkit.module_base import ModuleBase |
26 |
from gentoolkit import pprinter as pp |
27 |
from gentoolkit.flag import get_installed_use, get_flags |
28 |
from gentoolkit.enalyze.lib import FlagAnalyzer, KeywordAnalyser |
29 |
@@ -26,423 +26,423 @@ import portage |
30 |
|
31 |
|
32 |
def gather_flags_info( |
33 |
- cpvs=None, |
34 |
- system_flags=None, |
35 |
- include_unset=False, |
36 |
- target="USE", |
37 |
- use_portage=False, |
38 |
- # override-able for testing |
39 |
- _get_flags=get_flags, |
40 |
- _get_used=get_installed_use |
41 |
- ): |
42 |
- """Analyze the installed pkgs USE flags for frequency of use |
43 |
+ cpvs=None, |
44 |
+ system_flags=None, |
45 |
+ include_unset=False, |
46 |
+ target="USE", |
47 |
+ use_portage=False, |
48 |
+ # override-able for testing |
49 |
+ _get_flags=get_flags, |
50 |
+ _get_used=get_installed_use |
51 |
+ ): |
52 |
+ """Analyze the installed pkgs USE flags for frequency of use |
53 |
|
54 |
- @type cpvs: list |
55 |
- @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
56 |
- defaults to entire installed pkg db |
57 |
- @type: system_flags: list |
58 |
- @param system_flags: the current default USE flags as defined |
59 |
- by portage.settings["USE"].split() |
60 |
- @type include_unset: bool |
61 |
- @param include_unset: controls the inclusion of unset USE flags in the report. |
62 |
- @type target: string |
63 |
- @param target: the environment variable being analyzed |
64 |
- one of ["USE", "PKGUSE"] |
65 |
- @type _get_flags: function |
66 |
- @param _get_flags: ovride-able for testing, |
67 |
- defaults to gentoolkit.enalyze.lib.get_flags |
68 |
- @param _get_used: ovride-able for testing, |
69 |
- defaults to gentoolkit.enalyze.lib.get_installed_use |
70 |
- @rtype dict. {flag:{"+":[cat/pkg-ver,...], "-":[cat/pkg-ver,...], "unset":[]} |
71 |
- """ |
72 |
- if cpvs is None: |
73 |
- cpvs = VARDB.cpv_all() |
74 |
- # pass them in to override for tests |
75 |
- flags = FlagAnalyzer(system_flags, |
76 |
- filter_defaults=False, |
77 |
- target=target, |
78 |
- _get_flags=_get_flags, |
79 |
- _get_used=get_installed_use |
80 |
- ) |
81 |
- flag_users = {} |
82 |
- for cpv in cpvs: |
83 |
- if cpv.startswith("virtual"): |
84 |
- continue |
85 |
- if use_portage: |
86 |
- plus, minus, unset = flags.analyse_cpv(cpv) |
87 |
- else: |
88 |
- pkg = Package(cpv) |
89 |
- plus, minus, unset = flags.analyse_pkg(pkg) |
90 |
- for flag in plus: |
91 |
- if flag in flag_users: |
92 |
- flag_users[flag]["+"].append(cpv) |
93 |
- else: |
94 |
- flag_users[flag] = {"+": [cpv], "-": []} |
95 |
- for flag in minus: |
96 |
- if flag in flag_users: |
97 |
- flag_users[flag]["-"].append(cpv) |
98 |
- else: |
99 |
- flag_users[flag] = {"+":[], "-": [cpv]} |
100 |
- if include_unset: |
101 |
- for flag in unset: |
102 |
- if flag in flag_users: |
103 |
- if "unset" in flag_users[flag]: |
104 |
- flag_users[flag]["unset"].append(cpv) |
105 |
- else: |
106 |
- flag_users[flag]["unset"] = [cpv] |
107 |
- else: |
108 |
- flag_users[flag] = {"+": [], "-": [], "unset": [cpv]} |
109 |
- return flag_users |
110 |
+ @type cpvs: list |
111 |
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
112 |
+ defaults to entire installed pkg db |
113 |
+ @type: system_flags: list |
114 |
+ @param system_flags: the current default USE flags as defined |
115 |
+ by portage.settings["USE"].split() |
116 |
+ @type include_unset: bool |
117 |
+ @param include_unset: controls the inclusion of unset USE flags in the report. |
118 |
+ @type target: string |
119 |
+ @param target: the environment variable being analyzed |
120 |
+ one of ["USE", "PKGUSE"] |
121 |
+ @type _get_flags: function |
122 |
+ @param _get_flags: ovride-able for testing, |
123 |
+ defaults to gentoolkit.enalyze.lib.get_flags |
124 |
+ @param _get_used: ovride-able for testing, |
125 |
+ defaults to gentoolkit.enalyze.lib.get_installed_use |
126 |
+ @rtype dict. {flag:{"+":[cat/pkg-ver,...], "-":[cat/pkg-ver,...], "unset":[]} |
127 |
+ """ |
128 |
+ if cpvs is None: |
129 |
+ cpvs = VARDB.cpv_all() |
130 |
+ # pass them in to override for tests |
131 |
+ flags = FlagAnalyzer(system_flags, |
132 |
+ filter_defaults=False, |
133 |
+ target=target, |
134 |
+ _get_flags=_get_flags, |
135 |
+ _get_used=get_installed_use |
136 |
+ ) |
137 |
+ flag_users = {} |
138 |
+ for cpv in cpvs: |
139 |
+ if cpv.startswith("virtual"): |
140 |
+ continue |
141 |
+ if use_portage: |
142 |
+ plus, minus, unset = flags.analyse_cpv(cpv) |
143 |
+ else: |
144 |
+ pkg = Package(cpv) |
145 |
+ plus, minus, unset = flags.analyse_pkg(pkg) |
146 |
+ for flag in plus: |
147 |
+ if flag in flag_users: |
148 |
+ flag_users[flag]["+"].append(cpv) |
149 |
+ else: |
150 |
+ flag_users[flag] = {"+": [cpv], "-": []} |
151 |
+ for flag in minus: |
152 |
+ if flag in flag_users: |
153 |
+ flag_users[flag]["-"].append(cpv) |
154 |
+ else: |
155 |
+ flag_users[flag] = {"+":[], "-": [cpv]} |
156 |
+ if include_unset: |
157 |
+ for flag in unset: |
158 |
+ if flag in flag_users: |
159 |
+ if "unset" in flag_users[flag]: |
160 |
+ flag_users[flag]["unset"].append(cpv) |
161 |
+ else: |
162 |
+ flag_users[flag]["unset"] = [cpv] |
163 |
+ else: |
164 |
+ flag_users[flag] = {"+": [], "-": [], "unset": [cpv]} |
165 |
+ return flag_users |
166 |
|
167 |
|
168 |
def gather_keywords_info( |
169 |
- cpvs=None, |
170 |
- system_keywords=None, |
171 |
- use_portage=False, |
172 |
- # override-able for testing |
173 |
- keywords=portage.settings["ACCEPT_KEYWORDS"], |
174 |
- analyser = None |
175 |
- ): |
176 |
- """Analyze the installed pkgs 'keywords' for frequency of use |
177 |
+ cpvs=None, |
178 |
+ system_keywords=None, |
179 |
+ use_portage=False, |
180 |
+ # override-able for testing |
181 |
+ keywords=portage.settings["ACCEPT_KEYWORDS"], |
182 |
+ analyser = None |
183 |
+ ): |
184 |
+ """Analyze the installed pkgs 'keywords' for frequency of use |
185 |
|
186 |
- @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
187 |
- defaults to entire installed pkg db |
188 |
- @param system_keywords: list of the system keywords |
189 |
- @param keywords: user defined list of keywords to check and report on |
190 |
- or reports on all relevant keywords found to have been used. |
191 |
- @param _get_kwds: overridable function for testing |
192 |
- @param _get_used: overridable function for testing |
193 |
- @rtype dict. {keyword:{"stable":[cat/pkg-ver,...], "testing":[cat/pkg-ver,...]} |
194 |
- """ |
195 |
- if cpvs is None: |
196 |
- cpvs = VARDB.cpv_all() |
197 |
- keyword_users = {} |
198 |
- for cpv in cpvs: |
199 |
- if cpv.startswith("virtual"): |
200 |
- continue |
201 |
- if use_portage: |
202 |
- keyword = analyser.get_inst_keyword_cpv(cpv) |
203 |
- else: |
204 |
- pkg = Package(cpv) |
205 |
- keyword = analyser.get_inst_keyword_pkg(pkg) |
206 |
- #print "returned keyword =", cpv, keyword, keyword[0] |
207 |
- key = keyword[0] |
208 |
- if key in ["~", "-"]: |
209 |
- _kwd = keyword[1:] |
210 |
- if _kwd in keyword_users: |
211 |
- if key in ["~"]: |
212 |
- keyword_users[_kwd]["testing"].append(cpv) |
213 |
- elif key in ["-"]: |
214 |
- #print "adding cpv to missing:", cpv |
215 |
- keyword_users[_kwd]["missing"].append(cpv) |
216 |
- else: |
217 |
- if key in ["~"]: |
218 |
- keyword_users[_kwd] = {"stable": [], |
219 |
- "testing": [cpv], "missing": []} |
220 |
- elif key in ["-"]: |
221 |
- keyword_users[_kwd] = {"stable": [], |
222 |
- "testing": [], "missing": [cpv]} |
223 |
- else: |
224 |
- keyword_users[_kwd] = {"stable": [cpv], |
225 |
- "testing": [], "missing": []} |
226 |
- elif keyword in keyword_users: |
227 |
- keyword_users[keyword]["stable"].append(cpv) |
228 |
- else: |
229 |
- keyword_users[keyword] = { |
230 |
- "stable": [cpv], |
231 |
- "testing": [], |
232 |
- "missing": [] |
233 |
- } |
234 |
- return keyword_users |
235 |
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
236 |
+ defaults to entire installed pkg db |
237 |
+ @param system_keywords: list of the system keywords |
238 |
+ @param keywords: user defined list of keywords to check and report on |
239 |
+ or reports on all relevant keywords found to have been used. |
240 |
+ @param _get_kwds: overridable function for testing |
241 |
+ @param _get_used: overridable function for testing |
242 |
+ @rtype dict. {keyword:{"stable":[cat/pkg-ver,...], "testing":[cat/pkg-ver,...]} |
243 |
+ """ |
244 |
+ if cpvs is None: |
245 |
+ cpvs = VARDB.cpv_all() |
246 |
+ keyword_users = {} |
247 |
+ for cpv in cpvs: |
248 |
+ if cpv.startswith("virtual"): |
249 |
+ continue |
250 |
+ if use_portage: |
251 |
+ keyword = analyser.get_inst_keyword_cpv(cpv) |
252 |
+ else: |
253 |
+ pkg = Package(cpv) |
254 |
+ keyword = analyser.get_inst_keyword_pkg(pkg) |
255 |
+ #print "returned keyword =", cpv, keyword, keyword[0] |
256 |
+ key = keyword[0] |
257 |
+ if key in ["~", "-"]: |
258 |
+ _kwd = keyword[1:] |
259 |
+ if _kwd in keyword_users: |
260 |
+ if key in ["~"]: |
261 |
+ keyword_users[_kwd]["testing"].append(cpv) |
262 |
+ elif key in ["-"]: |
263 |
+ #print "adding cpv to missing:", cpv |
264 |
+ keyword_users[_kwd]["missing"].append(cpv) |
265 |
+ else: |
266 |
+ if key in ["~"]: |
267 |
+ keyword_users[_kwd] = {"stable": [], |
268 |
+ "testing": [cpv], "missing": []} |
269 |
+ elif key in ["-"]: |
270 |
+ keyword_users[_kwd] = {"stable": [], |
271 |
+ "testing": [], "missing": [cpv]} |
272 |
+ else: |
273 |
+ keyword_users[_kwd] = {"stable": [cpv], |
274 |
+ "testing": [], "missing": []} |
275 |
+ elif keyword in keyword_users: |
276 |
+ keyword_users[keyword]["stable"].append(cpv) |
277 |
+ else: |
278 |
+ keyword_users[keyword] = { |
279 |
+ "stable": [cpv], |
280 |
+ "testing": [], |
281 |
+ "missing": [] |
282 |
+ } |
283 |
+ return keyword_users |
284 |
|
285 |
|
286 |
class Analyse(ModuleBase): |
287 |
- """Installed db analysis tool to query the installed databse |
288 |
- and produce/output stats for USE flags or keywords/mask. |
289 |
- The 'rebuild' action output is in the form suitable for file type output |
290 |
- to create a new package.use, package.keywords, package.unmask |
291 |
- type files in the event of needing to rebuild the |
292 |
- /etc/portage/* user configs |
293 |
- """ |
294 |
- def __init__(self): |
295 |
- ModuleBase.__init__(self) |
296 |
- self.module_name = "enalyze" |
297 |
- self.options = { |
298 |
- "flags": False, |
299 |
- "keywords": False, |
300 |
- "packages": False, |
301 |
- "unset": False, |
302 |
- "verbose": False, |
303 |
- "quiet": False, |
304 |
- 'prefix': False, |
305 |
- 'portage': True |
306 |
- } |
307 |
- self.module_opts = { |
308 |
- "-f": ("flags", "boolean", True), |
309 |
- "--flags": ("flags", "boolean", True), |
310 |
- "-k": ("keywords", "boolean", True), |
311 |
- "--keywords": ("keywords", "boolean", True), |
312 |
- "-u": ("unset", "boolean", True), |
313 |
- "--unset": ("unset", "boolean", True), |
314 |
- "-v": ("verbose", "boolean", True), |
315 |
- "--verbose": ("verbose", "boolean", True), |
316 |
- "-p": ("prefix", "boolean", True), |
317 |
- "--prefix": ("prefix", "boolean", True), |
318 |
- "-G": ("portage", "boolean", False), |
319 |
- "--portage": ("portage", "boolean", False), |
320 |
- } |
321 |
- self.formatted_options = [ |
322 |
- (" -h, --help", "Outputs this useage message"), |
323 |
- (" -a, --analyze", |
324 |
- "Action, sets the module to gather data and output the"), |
325 |
- ("", "formatted stats/information to the screen"), |
326 |
- (" -u, --unset", |
327 |
- "Additionally include any unset USE flags and the packages"), |
328 |
- ("", "that could use them"), |
329 |
- (" -v, --verbose", |
330 |
- "Used in the analyze action to output more detailed information"), |
331 |
- (" -p, --prefix", |
332 |
- "Used for testing purposes only, runs report using " + |
333 |
- "a prefix keyword and 'prefix' USE flag"), |
334 |
- #(" -G, --portage", |
335 |
- #"Use portage directly instead of gentoolkit's Package " + |
336 |
- #"object for some operations. Usually a little faster."), |
337 |
- ] |
338 |
- self.formatted_args = [ |
339 |
- (" use", |
340 |
- "Causes the action to analyze the installed packages USE flags"), |
341 |
- (" pkguse", |
342 |
- "Causes the action to analyze the installed packages PKGUSE flags"), |
343 |
- (" ", |
344 |
- "These are flags that have been set in /etc/portage/package.use"), |
345 |
- (" keywords", |
346 |
- "Causes the action to analyze the installed packages keywords"), |
347 |
- (" packages", |
348 |
- "Causes the action to analyze the installed packages and the"), |
349 |
- (" ", |
350 |
- "USE flags they were installed with"), |
351 |
- ] |
352 |
- self.short_opts = "huvpG" |
353 |
- self.long_opts = ("help", "unset", "verbose", "prefix") #, "portage") |
354 |
- self.need_queries = True |
355 |
- self.arg_spec = "Target" |
356 |
- self.arg_options = ['use', 'pkguse','keywords', 'packages'] |
357 |
- self.arg_option = False |
358 |
- self.warning = ( |
359 |
- " CAUTION", |
360 |
- "This is beta software and some features/options are incomplete,", |
361 |
- "some features may change in future releases includig its name.", |
362 |
- "Feedback will be appreciated, http://bugs.gentoo.org") |
363 |
+ """Installed db analysis tool to query the installed databse |
364 |
+ and produce/output stats for USE flags or keywords/mask. |
365 |
+ The 'rebuild' action output is in the form suitable for file type output |
366 |
+ to create a new package.use, package.keywords, package.unmask |
367 |
+ type files in the event of needing to rebuild the |
368 |
+ /etc/portage/* user configs |
369 |
+ """ |
370 |
+ def __init__(self): |
371 |
+ ModuleBase.__init__(self) |
372 |
+ self.module_name = "enalyze" |
373 |
+ self.options = { |
374 |
+ "flags": False, |
375 |
+ "keywords": False, |
376 |
+ "packages": False, |
377 |
+ "unset": False, |
378 |
+ "verbose": False, |
379 |
+ "quiet": False, |
380 |
+ 'prefix': False, |
381 |
+ 'portage': True |
382 |
+ } |
383 |
+ self.module_opts = { |
384 |
+ "-f": ("flags", "boolean", True), |
385 |
+ "--flags": ("flags", "boolean", True), |
386 |
+ "-k": ("keywords", "boolean", True), |
387 |
+ "--keywords": ("keywords", "boolean", True), |
388 |
+ "-u": ("unset", "boolean", True), |
389 |
+ "--unset": ("unset", "boolean", True), |
390 |
+ "-v": ("verbose", "boolean", True), |
391 |
+ "--verbose": ("verbose", "boolean", True), |
392 |
+ "-p": ("prefix", "boolean", True), |
393 |
+ "--prefix": ("prefix", "boolean", True), |
394 |
+ "-G": ("portage", "boolean", False), |
395 |
+ "--portage": ("portage", "boolean", False), |
396 |
+ } |
397 |
+ self.formatted_options = [ |
398 |
+ (" -h, --help", "Outputs this useage message"), |
399 |
+ (" -a, --analyze", |
400 |
+ "Action, sets the module to gather data and output the"), |
401 |
+ ("", "formatted stats/information to the screen"), |
402 |
+ (" -u, --unset", |
403 |
+ "Additionally include any unset USE flags and the packages"), |
404 |
+ ("", "that could use them"), |
405 |
+ (" -v, --verbose", |
406 |
+ "Used in the analyze action to output more detailed information"), |
407 |
+ (" -p, --prefix", |
408 |
+ "Used for testing purposes only, runs report using " + |
409 |
+ "a prefix keyword and 'prefix' USE flag"), |
410 |
+ #(" -G, --portage", |
411 |
+ #"Use portage directly instead of gentoolkit's Package " + |
412 |
+ #"object for some operations. Usually a little faster."), |
413 |
+ ] |
414 |
+ self.formatted_args = [ |
415 |
+ (" use", |
416 |
+ "Causes the action to analyze the installed packages USE flags"), |
417 |
+ (" pkguse", |
418 |
+ "Causes the action to analyze the installed packages PKGUSE flags"), |
419 |
+ (" ", |
420 |
+ "These are flags that have been set in /etc/portage/package.use"), |
421 |
+ (" keywords", |
422 |
+ "Causes the action to analyze the installed packages keywords"), |
423 |
+ (" packages", |
424 |
+ "Causes the action to analyze the installed packages and the"), |
425 |
+ (" ", |
426 |
+ "USE flags they were installed with"), |
427 |
+ ] |
428 |
+ self.short_opts = "huvpG" |
429 |
+ self.long_opts = ("help", "unset", "verbose", "prefix") #, "portage") |
430 |
+ self.need_queries = True |
431 |
+ self.arg_spec = "Target" |
432 |
+ self.arg_options = ['use', 'pkguse','keywords', 'packages'] |
433 |
+ self.arg_option = False |
434 |
+ self.warning = ( |
435 |
+ " CAUTION", |
436 |
+ "This is beta software and some features/options are incomplete,", |
437 |
+ "some features may change in future releases includig its name.", |
438 |
+ "Feedback will be appreciated, http://bugs.gentoo.org") |
439 |
|
440 |
|
441 |
- def run(self, input_args, quiet=False): |
442 |
- """runs the module |
443 |
+ def run(self, input_args, quiet=False): |
444 |
+ """runs the module |
445 |
|
446 |
- @param input_args: input arguments to be parsed |
447 |
- """ |
448 |
- query = self.main_setup(input_args) |
449 |
- query = self.validate_query(query) |
450 |
- self.set_quiet(quiet) |
451 |
- if query in ["use", "pkguse"]: |
452 |
- self.analyse_flags(query) |
453 |
- elif query in ["keywords"]: |
454 |
- self.analyse_keywords() |
455 |
- elif query in ["packages"]: |
456 |
- self.analyse_packages() |
457 |
+ @param input_args: input arguments to be parsed |
458 |
+ """ |
459 |
+ query = self.main_setup(input_args) |
460 |
+ query = self.validate_query(query) |
461 |
+ self.set_quiet(quiet) |
462 |
+ if query in ["use", "pkguse"]: |
463 |
+ self.analyse_flags(query) |
464 |
+ elif query in ["keywords"]: |
465 |
+ self.analyse_keywords() |
466 |
+ elif query in ["packages"]: |
467 |
+ self.analyse_packages() |
468 |
|
469 |
- def analyse_flags(self, target): |
470 |
- """This will scan the installed packages db and analyze the |
471 |
- USE flags used for installation and produce a report on how |
472 |
- they were used. |
473 |
+ def analyse_flags(self, target): |
474 |
+ """This will scan the installed packages db and analyze the |
475 |
+ USE flags used for installation and produce a report on how |
476 |
+ they were used. |
477 |
|
478 |
- @type target: string |
479 |
- @param target: the target to be analyzed, one of ["use", "pkguse"] |
480 |
- """ |
481 |
- system_use = portage.settings["USE"].split() |
482 |
- self.printer = AnalysisPrinter( |
483 |
- "use", |
484 |
- self.options["verbose"], |
485 |
- system_use) |
486 |
- if self.options["verbose"]: |
487 |
- cpvs = VARDB.cpv_all() |
488 |
- #cpvs = get_installed_cpvs() |
489 |
- #print "Total number of installed ebuilds =", len(cpvs) |
490 |
- flag_users = gather_flags_info(cpvs, system_use, |
491 |
- self.options["unset"], target=target.upper(), |
492 |
- use_portage=self.options['portage']) |
493 |
- else: |
494 |
- cpvs = get_installed_cpvs() |
495 |
- flag_users = gather_flags_info(cpvs, system_flags=system_use, |
496 |
- include_unset=self.options["unset"], target=target.upper(), |
497 |
- use_portage=self.options['portage']) |
498 |
- #print flag_users |
499 |
- flag_keys = sorted(flag_users) |
500 |
- if self.options["verbose"]: |
501 |
- print(" Flag System #pkgs cat/pkg-ver") |
502 |
- blankline = nl |
503 |
- elif not self.options['quiet']: |
504 |
- print(" Flag System #pkgs") |
505 |
- blankline = lambda: None |
506 |
- for flag in flag_keys: |
507 |
- flag_pos = flag_users[flag]["+"] |
508 |
- if len(flag_pos): |
509 |
- self.printer(flag, "+", flag_pos) |
510 |
- #blankline() |
511 |
- flag_neg = flag_users[flag]["-"] |
512 |
- if len(flag_neg): |
513 |
- self.printer(flag, "-", flag_neg) |
514 |
- #blankline() |
515 |
- if "unset" in flag_users[flag] and flag_users[flag]["unset"]: |
516 |
- flag_unset = flag_users[flag]["unset"] |
517 |
- self.printer(flag, "unset", flag_unset) |
518 |
- #blankline() |
519 |
- if not self.options['quiet']: |
520 |
- print("===================================================") |
521 |
- print("Total number of flags in report =", |
522 |
- pp.output.red(str(len(flag_keys)))) |
523 |
- if self.options["verbose"]: |
524 |
- print("Total number of installed ebuilds =", |
525 |
- pp.output.red(str(len([x for x in cpvs])))) |
526 |
- print() |
527 |
+ @type target: string |
528 |
+ @param target: the target to be analyzed, one of ["use", "pkguse"] |
529 |
+ """ |
530 |
+ system_use = portage.settings["USE"].split() |
531 |
+ self.printer = AnalysisPrinter( |
532 |
+ "use", |
533 |
+ self.options["verbose"], |
534 |
+ system_use) |
535 |
+ if self.options["verbose"]: |
536 |
+ cpvs = VARDB.cpv_all() |
537 |
+ #cpvs = get_installed_cpvs() |
538 |
+ #print "Total number of installed ebuilds =", len(cpvs) |
539 |
+ flag_users = gather_flags_info(cpvs, system_use, |
540 |
+ self.options["unset"], target=target.upper(), |
541 |
+ use_portage=self.options['portage']) |
542 |
+ else: |
543 |
+ cpvs = get_installed_cpvs() |
544 |
+ flag_users = gather_flags_info(cpvs, system_flags=system_use, |
545 |
+ include_unset=self.options["unset"], target=target.upper(), |
546 |
+ use_portage=self.options['portage']) |
547 |
+ #print flag_users |
548 |
+ flag_keys = sorted(flag_users) |
549 |
+ if self.options["verbose"]: |
550 |
+ print(" Flag System #pkgs cat/pkg-ver") |
551 |
+ blankline = nl |
552 |
+ elif not self.options['quiet']: |
553 |
+ print(" Flag System #pkgs") |
554 |
+ blankline = lambda: None |
555 |
+ for flag in flag_keys: |
556 |
+ flag_pos = flag_users[flag]["+"] |
557 |
+ if len(flag_pos): |
558 |
+ self.printer(flag, "+", flag_pos) |
559 |
+ #blankline() |
560 |
+ flag_neg = flag_users[flag]["-"] |
561 |
+ if len(flag_neg): |
562 |
+ self.printer(flag, "-", flag_neg) |
563 |
+ #blankline() |
564 |
+ if "unset" in flag_users[flag] and flag_users[flag]["unset"]: |
565 |
+ flag_unset = flag_users[flag]["unset"] |
566 |
+ self.printer(flag, "unset", flag_unset) |
567 |
+ #blankline() |
568 |
+ if not self.options['quiet']: |
569 |
+ print("===================================================") |
570 |
+ print("Total number of flags in report =", |
571 |
+ pp.output.red(str(len(flag_keys)))) |
572 |
+ if self.options["verbose"]: |
573 |
+ print("Total number of installed ebuilds =", |
574 |
+ pp.output.red(str(len([x for x in cpvs])))) |
575 |
+ print() |
576 |
|
577 |
|
578 |
- def analyse_keywords(self, keywords=None): |
579 |
- """This will scan the installed packages db and analyze the |
580 |
- keywords used for installation and produce a report on them. |
581 |
- """ |
582 |
- print() |
583 |
- system_keywords = portage.settings["ACCEPT_KEYWORDS"] |
584 |
- arch = portage.settings["ARCH"] |
585 |
- if self.options["prefix"]: |
586 |
- # build a new keyword for testing |
587 |
- system_keywords = "~" + arch + "-linux" |
588 |
- if self.options["verbose"] or self.options["prefix"]: |
589 |
- print("Current system ARCH =", arch) |
590 |
- print("Current system ACCEPT_KEYWORDS =", system_keywords) |
591 |
- system_keywords = system_keywords.split() |
592 |
- self.printer = AnalysisPrinter( |
593 |
- "keywords", |
594 |
- self.options["verbose"], |
595 |
- system_keywords) |
596 |
- self.analyser = KeywordAnalyser( arch, system_keywords, VARDB) |
597 |
- #self.analyser.set_order(portage.settings["USE"].split()) |
598 |
- # only for testing |
599 |
- test_use = portage.settings["USE"].split() |
600 |
- if self.options['prefix'] and 'prefix' not in test_use: |
601 |
- print("ANALYSE_KEYWORDS() 'prefix' flag not found in system", |
602 |
- "USE flags!!! appending for testing") |
603 |
- print() |
604 |
- test_use.append('prefix') |
605 |
- self.analyser.set_order(test_use) |
606 |
- # /end testing |
607 |
+ def analyse_keywords(self, keywords=None): |
608 |
+ """This will scan the installed packages db and analyze the |
609 |
+ keywords used for installation and produce a report on them. |
610 |
+ """ |
611 |
+ print() |
612 |
+ system_keywords = portage.settings["ACCEPT_KEYWORDS"] |
613 |
+ arch = portage.settings["ARCH"] |
614 |
+ if self.options["prefix"]: |
615 |
+ # build a new keyword for testing |
616 |
+ system_keywords = "~" + arch + "-linux" |
617 |
+ if self.options["verbose"] or self.options["prefix"]: |
618 |
+ print("Current system ARCH =", arch) |
619 |
+ print("Current system ACCEPT_KEYWORDS =", system_keywords) |
620 |
+ system_keywords = system_keywords.split() |
621 |
+ self.printer = AnalysisPrinter( |
622 |
+ "keywords", |
623 |
+ self.options["verbose"], |
624 |
+ system_keywords) |
625 |
+ self.analyser = KeywordAnalyser( arch, system_keywords, VARDB) |
626 |
+ #self.analyser.set_order(portage.settings["USE"].split()) |
627 |
+ # only for testing |
628 |
+ test_use = portage.settings["USE"].split() |
629 |
+ if self.options['prefix'] and 'prefix' not in test_use: |
630 |
+ print("ANALYSE_KEYWORDS() 'prefix' flag not found in system", |
631 |
+ "USE flags!!! appending for testing") |
632 |
+ print() |
633 |
+ test_use.append('prefix') |
634 |
+ self.analyser.set_order(test_use) |
635 |
+ # /end testing |
636 |
|
637 |
- if self.options["verbose"]: |
638 |
- cpvs = VARDB.cpv_all() |
639 |
- #print "Total number of installed ebuilds =", len(cpvs) |
640 |
- keyword_users = gather_keywords_info( |
641 |
- cpvs=cpvs, |
642 |
- system_keywords=system_keywords, |
643 |
- use_portage=self.options['portage'], |
644 |
- keywords=keywords, analyser = self.analyser |
645 |
- ) |
646 |
- blankline = nl |
647 |
- else: |
648 |
- keyword_users = gather_keywords_info( |
649 |
- system_keywords=system_keywords, |
650 |
- use_portage=self.options['portage'], |
651 |
- keywords=keywords, |
652 |
- analyser = self.analyser |
653 |
- ) |
654 |
- blankline = lambda: None |
655 |
- #print keyword_users |
656 |
- keyword_keys = sorted(keyword_users) |
657 |
- if self.options["verbose"]: |
658 |
- print(" Keyword System #pkgs cat/pkg-ver") |
659 |
- elif not self.options['quiet']: |
660 |
- print(" Keyword System #pkgs") |
661 |
- for keyword in keyword_keys: |
662 |
- kwd_stable = keyword_users[keyword]["stable"] |
663 |
- if len(kwd_stable): |
664 |
- self.printer(keyword, " ", kwd_stable) |
665 |
- blankline() |
666 |
- kwd_testing = keyword_users[keyword]["testing"] |
667 |
- if len(kwd_testing): |
668 |
- self.printer(keyword, "~", kwd_testing) |
669 |
- blankline() |
670 |
- kwd_missing = keyword_users[keyword]["missing"] |
671 |
- if len(kwd_missing): |
672 |
- self.printer(keyword, "-", kwd_missing) |
673 |
- blankline |
674 |
- if not self.options['quiet']: |
675 |
- if self.analyser.mismatched: |
676 |
- print("_________________________________________________") |
677 |
- print(("The following packages were found to have a \n" + |
678 |
- "different recorded ARCH than the current system ARCH")) |
679 |
- for cpv in self.analyser.mismatched: |
680 |
- print("\t", pp.cpv(cpv)) |
681 |
- print("===================================================") |
682 |
- print("Total number of keywords in report =", |
683 |
- pp.output.red(str(len(keyword_keys)))) |
684 |
- if self.options["verbose"]: |
685 |
- print("Total number of installed ebuilds =", |
686 |
- pp.output.red(str(len(cpvs)))) |
687 |
- print() |
688 |
+ if self.options["verbose"]: |
689 |
+ cpvs = VARDB.cpv_all() |
690 |
+ #print "Total number of installed ebuilds =", len(cpvs) |
691 |
+ keyword_users = gather_keywords_info( |
692 |
+ cpvs=cpvs, |
693 |
+ system_keywords=system_keywords, |
694 |
+ use_portage=self.options['portage'], |
695 |
+ keywords=keywords, analyser = self.analyser |
696 |
+ ) |
697 |
+ blankline = nl |
698 |
+ else: |
699 |
+ keyword_users = gather_keywords_info( |
700 |
+ system_keywords=system_keywords, |
701 |
+ use_portage=self.options['portage'], |
702 |
+ keywords=keywords, |
703 |
+ analyser = self.analyser |
704 |
+ ) |
705 |
+ blankline = lambda: None |
706 |
+ #print keyword_users |
707 |
+ keyword_keys = sorted(keyword_users) |
708 |
+ if self.options["verbose"]: |
709 |
+ print(" Keyword System #pkgs cat/pkg-ver") |
710 |
+ elif not self.options['quiet']: |
711 |
+ print(" Keyword System #pkgs") |
712 |
+ for keyword in keyword_keys: |
713 |
+ kwd_stable = keyword_users[keyword]["stable"] |
714 |
+ if len(kwd_stable): |
715 |
+ self.printer(keyword, " ", kwd_stable) |
716 |
+ blankline() |
717 |
+ kwd_testing = keyword_users[keyword]["testing"] |
718 |
+ if len(kwd_testing): |
719 |
+ self.printer(keyword, "~", kwd_testing) |
720 |
+ blankline() |
721 |
+ kwd_missing = keyword_users[keyword]["missing"] |
722 |
+ if len(kwd_missing): |
723 |
+ self.printer(keyword, "-", kwd_missing) |
724 |
+ blankline |
725 |
+ if not self.options['quiet']: |
726 |
+ if self.analyser.mismatched: |
727 |
+ print("_________________________________________________") |
728 |
+ print(("The following packages were found to have a \n" + |
729 |
+ "different recorded ARCH than the current system ARCH")) |
730 |
+ for cpv in self.analyser.mismatched: |
731 |
+ print("\t", pp.cpv(cpv)) |
732 |
+ print("===================================================") |
733 |
+ print("Total number of keywords in report =", |
734 |
+ pp.output.red(str(len(keyword_keys)))) |
735 |
+ if self.options["verbose"]: |
736 |
+ print("Total number of installed ebuilds =", |
737 |
+ pp.output.red(str(len(cpvs)))) |
738 |
+ print() |
739 |
|
740 |
|
741 |
- def analyse_packages(self): |
742 |
- """This will scan the installed packages db and analyze the |
743 |
- USE flags used for installation and produce a report. |
744 |
+ def analyse_packages(self): |
745 |
+ """This will scan the installed packages db and analyze the |
746 |
+ USE flags used for installation and produce a report. |
747 |
|
748 |
- @type target: string |
749 |
- @param target: the target to be analyzed, one of ["use", "pkguse"] |
750 |
- """ |
751 |
- system_use = portage.settings["USE"].split() |
752 |
- if self.options["verbose"]: |
753 |
- cpvs = VARDB.cpv_all() |
754 |
- key_width = 45 |
755 |
- else: |
756 |
- cpvs = get_installed_cpvs() |
757 |
- key_width = 1 |
758 |
+ @type target: string |
759 |
+ @param target: the target to be analyzed, one of ["use", "pkguse"] |
760 |
+ """ |
761 |
+ system_use = portage.settings["USE"].split() |
762 |
+ if self.options["verbose"]: |
763 |
+ cpvs = VARDB.cpv_all() |
764 |
+ key_width = 45 |
765 |
+ else: |
766 |
+ cpvs = get_installed_cpvs() |
767 |
+ key_width = 1 |
768 |
|
769 |
- self.printer = AnalysisPrinter( |
770 |
- "packages", |
771 |
- self.options["verbose"], |
772 |
- key_width=key_width) |
773 |
+ self.printer = AnalysisPrinter( |
774 |
+ "packages", |
775 |
+ self.options["verbose"], |
776 |
+ key_width=key_width) |
777 |
|
778 |
- cpvs = sorted(cpvs) |
779 |
- flags = FlagAnalyzer( |
780 |
- system=system_use, |
781 |
- filter_defaults=False, |
782 |
- target="USE" |
783 |
- ) |
784 |
+ cpvs = sorted(cpvs) |
785 |
+ flags = FlagAnalyzer( |
786 |
+ system=system_use, |
787 |
+ filter_defaults=False, |
788 |
+ target="USE" |
789 |
+ ) |
790 |
|
791 |
- if self.options["verbose"]: |
792 |
- print(" cat/pkg-ver USE Flags") |
793 |
- # "app-emulation/emul-linux-x86-sdl-20100915 ...." |
794 |
- blankline = nl |
795 |
- elif not self.options['quiet']: |
796 |
- print(" cat/pkg-ver USE Flags") |
797 |
- blankline = lambda: None |
798 |
- for cpv in cpvs: |
799 |
- (flag_plus, flag_neg, unset) = flags.analyse_cpv(cpv) |
800 |
- if self.options["unset"]: |
801 |
- self.printer(cpv, "", (flag_plus, flag_neg, unset)) |
802 |
- else: |
803 |
- self.printer(cpv, "", (flag_plus, flag_neg, [])) |
804 |
- if not self.options['quiet']: |
805 |
- print("===================================================") |
806 |
- print("Total number of installed ebuilds =", |
807 |
- pp.output.red(str(len([x for x in cpvs])))) |
808 |
- print() |
809 |
+ if self.options["verbose"]: |
810 |
+ print(" cat/pkg-ver USE Flags") |
811 |
+ # "app-emulation/emul-linux-x86-sdl-20100915 ...." |
812 |
+ blankline = nl |
813 |
+ elif not self.options['quiet']: |
814 |
+ print(" cat/pkg-ver USE Flags") |
815 |
+ blankline = lambda: None |
816 |
+ for cpv in cpvs: |
817 |
+ (flag_plus, flag_neg, unset) = flags.analyse_cpv(cpv) |
818 |
+ if self.options["unset"]: |
819 |
+ self.printer(cpv, "", (flag_plus, flag_neg, unset)) |
820 |
+ else: |
821 |
+ self.printer(cpv, "", (flag_plus, flag_neg, [])) |
822 |
+ if not self.options['quiet']: |
823 |
+ print("===================================================") |
824 |
+ print("Total number of installed ebuilds =", |
825 |
+ pp.output.red(str(len([x for x in cpvs])))) |
826 |
+ print() |
827 |
|
828 |
|
829 |
def main(input_args): |
830 |
- """Common starting method by the analyze master |
831 |
- unless all modules are converted to this class method. |
832 |
+ """Common starting method by the analyze master |
833 |
+ unless all modules are converted to this class method. |
834 |
|
835 |
- @param input_args: input args as supplied by equery master module. |
836 |
- """ |
837 |
- query_module = Analyse() |
838 |
- query_module.run(input_args, gentoolkit.CONFIG['quiet']) |
839 |
+ @param input_args: input args as supplied by equery master module. |
840 |
+ """ |
841 |
+ query_module = Analyse() |
842 |
+ query_module.run(input_args, gentoolkit.CONFIG['quiet']) |
843 |
|
844 |
# vim: set ts=4 sw=4 tw=79: |
845 |
|
846 |
diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py |
847 |
index f1d7e88..0db001e 100644 |
848 |
--- a/pym/gentoolkit/enalyze/rebuild.py |
849 |
+++ b/pym/gentoolkit/enalyze/rebuild.py |
850 |
@@ -18,10 +18,10 @@ import sys |
851 |
|
852 |
import gentoolkit |
853 |
from gentoolkit.dbapi import PORTDB, VARDB |
854 |
-from gentoolkit.enalyze.base import ModuleBase |
855 |
+from gentoolkit.module_base import ModuleBase |
856 |
from gentoolkit import pprinter as pp |
857 |
from gentoolkit.enalyze.lib import (get_installed_use, get_flags, FlagAnalyzer, |
858 |
- KeywordAnalyser) |
859 |
+ KeywordAnalyser) |
860 |
from gentoolkit.flag import reduce_flags |
861 |
from gentoolkit.enalyze.output import RebuildPrinter |
862 |
from gentoolkit.atom import Atom |
863 |
@@ -31,339 +31,339 @@ import portage |
864 |
|
865 |
|
866 |
def cpv_all_diff_use( |
867 |
- cpvs=None, |
868 |
- system_flags=None, |
869 |
- # override-able for testing |
870 |
- _get_flags=get_flags, |
871 |
- _get_used=get_installed_use |
872 |
- ): |
873 |
- """Data gathering and analysis function determines |
874 |
- the difference between the current default USE flag settings |
875 |
- and the currently installed pkgs recorded USE flag settings |
876 |
- |
877 |
- @type cpvs: list |
878 |
- @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
879 |
- defaults to entire installed pkg db |
880 |
- @type: system_flags: list |
881 |
- @param system_flags: the current default USE flags as defined |
882 |
- by portage.settings["USE"].split() |
883 |
- @type _get_flags: function |
884 |
- @param _get_flags: ovride-able for testing, |
885 |
- defaults to gentoolkit.enalyze.lib.get_flags |
886 |
- @param _get_used: ovride-able for testing, |
887 |
- defaults to gentoolkit.enalyze.lib.get_installed_use |
888 |
- @rtype dict. {cpv:['flag1', '-flag2',...]} |
889 |
- """ |
890 |
- if cpvs is None: |
891 |
- cpvs = VARDB.cpv_all() |
892 |
- cpvs.sort() |
893 |
- data = {} |
894 |
- cp_counts = {} |
895 |
- # pass them in to override for tests |
896 |
- flags = FlagAnalyzer(system_flags, |
897 |
- filter_defaults=True, |
898 |
- target="USE", |
899 |
- _get_flags=_get_flags, |
900 |
- _get_used=get_installed_use |
901 |
- ) |
902 |
- for cpv in cpvs: |
903 |
- plus, minus, unset = flags.analyse_cpv(cpv) |
904 |
- atom = Atom("="+cpv) |
905 |
- atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
906 |
- for flag in minus: |
907 |
- plus.add("-"+flag) |
908 |
- if len(plus): |
909 |
- if atom.cp not in data: |
910 |
- data[atom.cp] = [] |
911 |
- if atom.cp not in cp_counts: |
912 |
- cp_counts[atom.cp] = 0 |
913 |
- atom.use = list(plus) |
914 |
- data[atom.cp].append(atom) |
915 |
- cp_counts[atom.cp] += 1 |
916 |
- return data, cp_counts |
917 |
+ cpvs=None, |
918 |
+ system_flags=None, |
919 |
+ # override-able for testing |
920 |
+ _get_flags=get_flags, |
921 |
+ _get_used=get_installed_use |
922 |
+ ): |
923 |
+ """Data gathering and analysis function determines |
924 |
+ the difference between the current default USE flag settings |
925 |
+ and the currently installed pkgs recorded USE flag settings |
926 |
+ |
927 |
+ @type cpvs: list |
928 |
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
929 |
+ defaults to entire installed pkg db |
930 |
+ @type: system_flags: list |
931 |
+ @param system_flags: the current default USE flags as defined |
932 |
+ by portage.settings["USE"].split() |
933 |
+ @type _get_flags: function |
934 |
+ @param _get_flags: ovride-able for testing, |
935 |
+ defaults to gentoolkit.enalyze.lib.get_flags |
936 |
+ @param _get_used: ovride-able for testing, |
937 |
+ defaults to gentoolkit.enalyze.lib.get_installed_use |
938 |
+ @rtype dict. {cpv:['flag1', '-flag2',...]} |
939 |
+ """ |
940 |
+ if cpvs is None: |
941 |
+ cpvs = VARDB.cpv_all() |
942 |
+ cpvs.sort() |
943 |
+ data = {} |
944 |
+ cp_counts = {} |
945 |
+ # pass them in to override for tests |
946 |
+ flags = FlagAnalyzer(system_flags, |
947 |
+ filter_defaults=True, |
948 |
+ target="USE", |
949 |
+ _get_flags=_get_flags, |
950 |
+ _get_used=get_installed_use |
951 |
+ ) |
952 |
+ for cpv in cpvs: |
953 |
+ plus, minus, unset = flags.analyse_cpv(cpv) |
954 |
+ atom = Atom("="+cpv) |
955 |
+ atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
956 |
+ for flag in minus: |
957 |
+ plus.add("-"+flag) |
958 |
+ if len(plus): |
959 |
+ if atom.cp not in data: |
960 |
+ data[atom.cp] = [] |
961 |
+ if atom.cp not in cp_counts: |
962 |
+ cp_counts[atom.cp] = 0 |
963 |
+ atom.use = list(plus) |
964 |
+ data[atom.cp].append(atom) |
965 |
+ cp_counts[atom.cp] += 1 |
966 |
+ return data, cp_counts |
967 |
|
968 |
|
969 |
def cpv_all_diff_keywords( |
970 |
- cpvs=None, |
971 |
- system_keywords=None, |
972 |
- use_portage=False, |
973 |
- # override-able for testing |
974 |
- keywords=portage.settings["ACCEPT_KEYWORDS"], |
975 |
- analyser = None |
976 |
- ): |
977 |
- """Analyze the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS |
978 |
- |
979 |
- @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
980 |
- defaults to entire installed pkg db |
981 |
- @param system_keywords: list of the system keywords |
982 |
- @param keywords: user defined list of keywords to check and report on |
983 |
- or reports on all relevant keywords found to have been used. |
984 |
- @param _get_kwds: overridable function for testing |
985 |
- @param _get_used: overridable function for testing |
986 |
- @rtype dict. {keyword:{"stable":[cat/pkg-ver,...], |
987 |
- "testing":[cat/pkg-ver,...]} |
988 |
- """ |
989 |
- if cpvs is None: |
990 |
- cpvs = VARDB.cpv_all() |
991 |
- keyword_users = {} |
992 |
- cp_counts = {} |
993 |
- for cpv in cpvs: |
994 |
- if cpv.startswith("virtual"): |
995 |
- continue |
996 |
- if use_portage: |
997 |
- keyword = analyser.get_inst_keyword_cpv(cpv) |
998 |
- else: |
999 |
- pkg = Package(cpv) |
1000 |
- keyword = analyser.get_inst_keyword_pkg(pkg) |
1001 |
- #print "returned keyword =", cpv, keyword, keyword[0] |
1002 |
- key = keyword[0] |
1003 |
- if key in ["~", "-"] and keyword not in system_keywords: |
1004 |
- atom = Atom("="+cpv) |
1005 |
- if atom.cp not in keyword_users: |
1006 |
- keyword_users[atom.cp] = [] |
1007 |
- if atom.cp not in cp_counts: |
1008 |
- cp_counts[atom.cp] = 0 |
1009 |
- if key in ["~"]: |
1010 |
- atom.keyword = keyword |
1011 |
- atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
1012 |
- keyword_users[atom.cp].append(atom) |
1013 |
- cp_counts[atom.cp] += 1 |
1014 |
- elif key in ["-"]: |
1015 |
- #print "adding cpv to missing:", cpv |
1016 |
- atom.keyword = "**" |
1017 |
- atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
1018 |
- keyword_users[atom.cp].append(atom) |
1019 |
- cp_counts[atom.cp] += 1 |
1020 |
- return keyword_users, cp_counts |
1021 |
+ cpvs=None, |
1022 |
+ system_keywords=None, |
1023 |
+ use_portage=False, |
1024 |
+ # override-able for testing |
1025 |
+ keywords=portage.settings["ACCEPT_KEYWORDS"], |
1026 |
+ analyser = None |
1027 |
+ ): |
1028 |
+ """Analyze the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS |
1029 |
+ |
1030 |
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or |
1031 |
+ defaults to entire installed pkg db |
1032 |
+ @param system_keywords: list of the system keywords |
1033 |
+ @param keywords: user defined list of keywords to check and report on |
1034 |
+ or reports on all relevant keywords found to have been used. |
1035 |
+ @param _get_kwds: overridable function for testing |
1036 |
+ @param _get_used: overridable function for testing |
1037 |
+ @rtype dict. {keyword:{"stable":[cat/pkg-ver,...], |
1038 |
+ "testing":[cat/pkg-ver,...]} |
1039 |
+ """ |
1040 |
+ if cpvs is None: |
1041 |
+ cpvs = VARDB.cpv_all() |
1042 |
+ keyword_users = {} |
1043 |
+ cp_counts = {} |
1044 |
+ for cpv in cpvs: |
1045 |
+ if cpv.startswith("virtual"): |
1046 |
+ continue |
1047 |
+ if use_portage: |
1048 |
+ keyword = analyser.get_inst_keyword_cpv(cpv) |
1049 |
+ else: |
1050 |
+ pkg = Package(cpv) |
1051 |
+ keyword = analyser.get_inst_keyword_pkg(pkg) |
1052 |
+ #print "returned keyword =", cpv, keyword, keyword[0] |
1053 |
+ key = keyword[0] |
1054 |
+ if key in ["~", "-"] and keyword not in system_keywords: |
1055 |
+ atom = Atom("="+cpv) |
1056 |
+ if atom.cp not in keyword_users: |
1057 |
+ keyword_users[atom.cp] = [] |
1058 |
+ if atom.cp not in cp_counts: |
1059 |
+ cp_counts[atom.cp] = 0 |
1060 |
+ if key in ["~"]: |
1061 |
+ atom.keyword = keyword |
1062 |
+ atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
1063 |
+ keyword_users[atom.cp].append(atom) |
1064 |
+ cp_counts[atom.cp] += 1 |
1065 |
+ elif key in ["-"]: |
1066 |
+ #print "adding cpv to missing:", cpv |
1067 |
+ atom.keyword = "**" |
1068 |
+ atom.slot = VARDB.aux_get(atom.cpv, ["SLOT"])[0] |
1069 |
+ keyword_users[atom.cp].append(atom) |
1070 |
+ cp_counts[atom.cp] += 1 |
1071 |
+ return keyword_users, cp_counts |
1072 |
|
1073 |
|
1074 |
class Rebuild(ModuleBase): |
1075 |
- """Installed db analysis tool to query the installed databse |
1076 |
- and produce/output stats for USE flags or keywords/mask. |
1077 |
- The 'rebuild' action output is in the form suitable for file type output |
1078 |
- to create a new package.use, package.keywords, package.unmask |
1079 |
- type files in the event of needing to rebuild the |
1080 |
- /etc/portage/* user configs |
1081 |
- """ |
1082 |
- def __init__(self): |
1083 |
- ModuleBase.__init__(self) |
1084 |
- self.module_name = "rebuild" |
1085 |
- self.options = { |
1086 |
- "use": False, |
1087 |
- "keywords": False, |
1088 |
- "unmask": False, |
1089 |
- "verbose": False, |
1090 |
- "quiet": False, |
1091 |
- "exact": False, |
1092 |
- "pretend": False, |
1093 |
- "prefix": False, |
1094 |
- "portage": True, |
1095 |
- "slot": False |
1096 |
- #"unset": False |
1097 |
- } |
1098 |
- self.module_opts = { |
1099 |
- "-p": ("pretend", "boolean", True), |
1100 |
- "--pretend": ("pretend", "boolean", True), |
1101 |
- "-e": ("exact", "boolean", True), |
1102 |
- "--exact": ("exact", "boolean", True), |
1103 |
- "-s": ("slot", "boolean", True), |
1104 |
- "--slot": ("slot", "boolean", True), |
1105 |
- "-v": ("verbose", "boolean", True), |
1106 |
- "--verbose": ("verbose", "boolean", True), |
1107 |
- } |
1108 |
- self.formatted_options = [ |
1109 |
- (" -h, --help", "Outputs this useage message"), |
1110 |
- (" -p, --pretend", "Does not actually create the files."), |
1111 |
- (" ", "It directs the outputs to the screen"), |
1112 |
- (" -e, --exact", "will atomize the package with a"), |
1113 |
- (" ", "leading '=' and include the version"), |
1114 |
- (" -s, --slot", "will atomize the package with a"), |
1115 |
- (" ", "leading '=' and include the slot") |
1116 |
- ] |
1117 |
- self.formatted_args = [ |
1118 |
- (" use", |
1119 |
- "causes the action to analyze the installed packages USE flags"), |
1120 |
- (" keywords", |
1121 |
- "causes the action to analyze the installed packages keywords"), |
1122 |
- (" unmask", |
1123 |
- "causes the action to analyze the installed packages " + \ |
1124 |
- "current mask status") |
1125 |
- ] |
1126 |
- self.short_opts = "hepsv" |
1127 |
- self.long_opts = ("help", "exact", "pretend", "slot", "verbose") |
1128 |
- self.need_queries = True |
1129 |
- self.arg_spec = "TargetSpec" |
1130 |
- self.arg_options = ['use', 'keywords', 'unmask'] |
1131 |
- self.arg_option = False |
1132 |
- self.warning = ( |
1133 |
- " CAUTION", |
1134 |
- "This is beta software and some features/options are incomplete,", |
1135 |
- "some features may change in future releases includig its name.", |
1136 |
- "The file generated is saved in your home directory", |
1137 |
- "Feedback will be appreciated, http://bugs.gentoo.org") |
1138 |
- |
1139 |
- |
1140 |
- |
1141 |
- def run(self, input_args, quiet=False): |
1142 |
- """runs the module |
1143 |
- |
1144 |
- @param input_args: input arguments to be parsed |
1145 |
- """ |
1146 |
- self.options['quiet'] = quiet |
1147 |
- query = self.main_setup(input_args) |
1148 |
- query = self.validate_query(query) |
1149 |
- if query in ["use"]: |
1150 |
- self.rebuild_use() |
1151 |
- elif query in ["keywords"]: |
1152 |
- self.rebuild_keywords() |
1153 |
- elif query in ["unmask"]: |
1154 |
- self.rebuild_unmask() |
1155 |
- |
1156 |
- |
1157 |
- def rebuild_use(self): |
1158 |
- if not self.options["quiet"]: |
1159 |
- print() |
1160 |
- print(" -- Scanning installed packages for USE flag settings that") |
1161 |
- print(" do not match the default settings") |
1162 |
- system_use = portage.settings["USE"].split() |
1163 |
- output = RebuildPrinter( |
1164 |
- "use", self.options["pretend"], self.options["exact"], |
1165 |
- self.options['slot']) |
1166 |
- pkgs, cp_counts = cpv_all_diff_use(system_flags=system_use) |
1167 |
- pkg_count = len(pkgs) |
1168 |
- if self.options["verbose"]: |
1169 |
- print() |
1170 |
- print((pp.emph(" -- Found ") + pp.number(str(pkg_count)) + |
1171 |
- pp.emph(" packages that need entries"))) |
1172 |
- #print pp.emph(" package.use to maintain their current setting") |
1173 |
- if pkgs: |
1174 |
- pkg_keys = sorted(pkgs) |
1175 |
- #print len(pkgs) |
1176 |
- if self.options["pretend"] and not self.options["quiet"]: |
1177 |
- print() |
1178 |
- print(pp.globaloption( |
1179 |
- " -- These are the installed packages & use flags " + |
1180 |
- "that were detected")) |
1181 |
- print(pp.globaloption(" to need use flag settings other " + |
1182 |
- "than the defaults.")) |
1183 |
- print() |
1184 |
- elif not self.options["quiet"]: |
1185 |
- print(" -- preparing pkgs for file entries") |
1186 |
- for pkg in pkg_keys: |
1187 |
- output(pkg, pkgs[pkg], cp_counts[pkg]) |
1188 |
- if self.options['verbose']: |
1189 |
- message = (pp.emph(" ") + |
1190 |
- pp.number(str(pkg_count)) + |
1191 |
- pp.emph(" different packages")) |
1192 |
- print() |
1193 |
- print(pp.globaloption(" -- Totals")) |
1194 |
- print(message) |
1195 |
- #print |
1196 |
- #unique = list(unique_flags) |
1197 |
- #unique.sort() |
1198 |
- #print unique |
1199 |
- if not self.options["pretend"]: |
1200 |
- filepath = os.path.expanduser('~/package.use.test') |
1201 |
- self.save_file(filepath, output.lines) |
1202 |
- |
1203 |
- def rebuild_keywords(self): |
1204 |
- print("Module action not yet available") |
1205 |
- print() |
1206 |
- """This will scan the installed packages db and analyze the |
1207 |
- keywords used for installation and produce a report on them. |
1208 |
- """ |
1209 |
- system_keywords = portage.settings["ACCEPT_KEYWORDS"].split() |
1210 |
- output = RebuildPrinter( |
1211 |
- "keywords", self.options["pretend"], self.options["exact"], |
1212 |
- self.options['slot']) |
1213 |
- arch = portage.settings["ARCH"] |
1214 |
- if self.options["prefix"]: |
1215 |
- # build a new keyword for testing |
1216 |
- system_keywords = "~" + arch + "-linux" |
1217 |
- if self.options["verbose"] or self.options["prefix"]: |
1218 |
- print("Current system ARCH =", arch) |
1219 |
- print("Current system ACCEPT_KEYWORDS =", system_keywords) |
1220 |
- self.analyser = KeywordAnalyser( arch, system_keywords, VARDB) |
1221 |
- #self.analyser.set_order(portage.settings["USE"].split()) |
1222 |
- # only for testing |
1223 |
- test_use = portage.settings["USE"].split() |
1224 |
- if self.options['prefix'] and 'prefix' not in test_use: |
1225 |
- print("REBUILD_KEYWORDS() 'prefix' flag not found in system", |
1226 |
- "USE flags!!! appending for testing") |
1227 |
- print() |
1228 |
- test_use.append('prefix') |
1229 |
- self.analyser.set_order(test_use) |
1230 |
- # /end testing |
1231 |
- |
1232 |
- cpvs = VARDB.cpv_all() |
1233 |
- #print "Total number of installed ebuilds =", len(cpvs) |
1234 |
- pkgs, cp_counts = cpv_all_diff_keywords( |
1235 |
- cpvs=cpvs, |
1236 |
- system_keywords=system_keywords, |
1237 |
- use_portage=self.options['portage'], |
1238 |
- analyser = self.analyser |
1239 |
- ) |
1240 |
- #print([pkgs[p][0].cpv for p in pkgs]) |
1241 |
- if pkgs: |
1242 |
- pkg_keys = sorted(pkgs) |
1243 |
- #print(len(pkgs)) |
1244 |
- if self.options["pretend"] and not self.options["quiet"]: |
1245 |
- print() |
1246 |
- print(pp.globaloption( |
1247 |
- " -- These are the installed packages & keywords " + |
1248 |
- "that were detected")) |
1249 |
- print(pp.globaloption(" to need keyword settings other " + |
1250 |
- "than the defaults.")) |
1251 |
- print() |
1252 |
- elif not self.options["quiet"]: |
1253 |
- print(" -- preparing pkgs for file entries") |
1254 |
- for pkg in pkg_keys: |
1255 |
- output(pkg, pkgs[pkg], cp_counts[pkg]) |
1256 |
- if not self.options['quiet']: |
1257 |
- if self.analyser.mismatched: |
1258 |
- print("_________________________________________________") |
1259 |
- print(("The following packages were found to have a \n" + |
1260 |
- "different recorded ARCH than the current system ARCH")) |
1261 |
- for cpv in self.analyser.mismatched: |
1262 |
- print("\t", pp.cpv(cpv)) |
1263 |
- print("===================================================") |
1264 |
- print("Total number of entries in report =", |
1265 |
- pp.output.red(str(len(pkg_keys)))) |
1266 |
- if self.options["verbose"]: |
1267 |
- print("Total number of installed ebuilds =", |
1268 |
- pp.output.red(str(len(cpvs)))) |
1269 |
- print() |
1270 |
- if not self.options["pretend"]: |
1271 |
- filepath = os.path.expanduser('~/package.keywords.test') |
1272 |
- self.save_file(filepath, output.lines) |
1273 |
- |
1274 |
- |
1275 |
- def rebuild_unmask(self): |
1276 |
- print("Module action not yet available") |
1277 |
- print() |
1278 |
- |
1279 |
- |
1280 |
- def save_file(self, filepath, data): |
1281 |
- """Writes the data to the file determined by filepath |
1282 |
- |
1283 |
- @param filepath: string. eg. '/path/to/filename' |
1284 |
- @param data: list of lines to write to filepath |
1285 |
- """ |
1286 |
- if not self.options["quiet"]: |
1287 |
- print(' - Saving file: %s' %filepath) |
1288 |
- with open(filepath, "w") as output: |
1289 |
- output.write('\n'.join(data)) |
1290 |
- print(" - Done") |
1291 |
+ """Installed db analysis tool to query the installed databse |
1292 |
+ and produce/output stats for USE flags or keywords/mask. |
1293 |
+ The 'rebuild' action output is in the form suitable for file type output |
1294 |
+ to create a new package.use, package.keywords, package.unmask |
1295 |
+ type files in the event of needing to rebuild the |
1296 |
+ /etc/portage/* user configs |
1297 |
+ """ |
1298 |
+ def __init__(self): |
1299 |
+ ModuleBase.__init__(self) |
1300 |
+ self.module_name = "rebuild" |
1301 |
+ self.options = { |
1302 |
+ "use": False, |
1303 |
+ "keywords": False, |
1304 |
+ "unmask": False, |
1305 |
+ "verbose": False, |
1306 |
+ "quiet": False, |
1307 |
+ "exact": False, |
1308 |
+ "pretend": False, |
1309 |
+ "prefix": False, |
1310 |
+ "portage": True, |
1311 |
+ "slot": False |
1312 |
+ #"unset": False |
1313 |
+ } |
1314 |
+ self.module_opts = { |
1315 |
+ "-p": ("pretend", "boolean", True), |
1316 |
+ "--pretend": ("pretend", "boolean", True), |
1317 |
+ "-e": ("exact", "boolean", True), |
1318 |
+ "--exact": ("exact", "boolean", True), |
1319 |
+ "-s": ("slot", "boolean", True), |
1320 |
+ "--slot": ("slot", "boolean", True), |
1321 |
+ "-v": ("verbose", "boolean", True), |
1322 |
+ "--verbose": ("verbose", "boolean", True), |
1323 |
+ } |
1324 |
+ self.formatted_options = [ |
1325 |
+ (" -h, --help", "Outputs this useage message"), |
1326 |
+ (" -p, --pretend", "Does not actually create the files."), |
1327 |
+ (" ", "It directs the outputs to the screen"), |
1328 |
+ (" -e, --exact", "will atomize the package with a"), |
1329 |
+ (" ", "leading '=' and include the version"), |
1330 |
+ (" -s, --slot", "will atomize the package with a"), |
1331 |
+ (" ", "leading '=' and include the slot") |
1332 |
+ ] |
1333 |
+ self.formatted_args = [ |
1334 |
+ (" use", |
1335 |
+ "causes the action to analyze the installed packages USE flags"), |
1336 |
+ (" keywords", |
1337 |
+ "causes the action to analyze the installed packages keywords"), |
1338 |
+ (" unmask", |
1339 |
+ "causes the action to analyze the installed packages " + \ |
1340 |
+ "current mask status") |
1341 |
+ ] |
1342 |
+ self.short_opts = "hepsv" |
1343 |
+ self.long_opts = ("help", "exact", "pretend", "slot", "verbose") |
1344 |
+ self.need_queries = True |
1345 |
+ self.arg_spec = "TargetSpec" |
1346 |
+ self.arg_options = ['use', 'keywords', 'unmask'] |
1347 |
+ self.arg_option = False |
1348 |
+ self.warning = ( |
1349 |
+ " CAUTION", |
1350 |
+ "This is beta software and some features/options are incomplete,", |
1351 |
+ "some features may change in future releases includig its name.", |
1352 |
+ "The file generated is saved in your home directory", |
1353 |
+ "Feedback will be appreciated, http://bugs.gentoo.org") |
1354 |
+ |
1355 |
+ |
1356 |
+ |
1357 |
+ def run(self, input_args, quiet=False): |
1358 |
+ """runs the module |
1359 |
+ |
1360 |
+ @param input_args: input arguments to be parsed |
1361 |
+ """ |
1362 |
+ self.options['quiet'] = quiet |
1363 |
+ query = self.main_setup(input_args) |
1364 |
+ query = self.validate_query(query) |
1365 |
+ if query in ["use"]: |
1366 |
+ self.rebuild_use() |
1367 |
+ elif query in ["keywords"]: |
1368 |
+ self.rebuild_keywords() |
1369 |
+ elif query in ["unmask"]: |
1370 |
+ self.rebuild_unmask() |
1371 |
+ |
1372 |
+ |
1373 |
+ def rebuild_use(self): |
1374 |
+ if not self.options["quiet"]: |
1375 |
+ print() |
1376 |
+ print(" -- Scanning installed packages for USE flag settings that") |
1377 |
+ print(" do not match the default settings") |
1378 |
+ system_use = portage.settings["USE"].split() |
1379 |
+ output = RebuildPrinter( |
1380 |
+ "use", self.options["pretend"], self.options["exact"], |
1381 |
+ self.options['slot']) |
1382 |
+ pkgs, cp_counts = cpv_all_diff_use(system_flags=system_use) |
1383 |
+ pkg_count = len(pkgs) |
1384 |
+ if self.options["verbose"]: |
1385 |
+ print() |
1386 |
+ print((pp.emph(" -- Found ") + pp.number(str(pkg_count)) + |
1387 |
+ pp.emph(" packages that need entries"))) |
1388 |
+ #print pp.emph(" package.use to maintain their current setting") |
1389 |
+ if pkgs: |
1390 |
+ pkg_keys = sorted(pkgs) |
1391 |
+ #print len(pkgs) |
1392 |
+ if self.options["pretend"] and not self.options["quiet"]: |
1393 |
+ print() |
1394 |
+ print(pp.globaloption( |
1395 |
+ " -- These are the installed packages & use flags " + |
1396 |
+ "that were detected")) |
1397 |
+ print(pp.globaloption(" to need use flag settings other " + |
1398 |
+ "than the defaults.")) |
1399 |
+ print() |
1400 |
+ elif not self.options["quiet"]: |
1401 |
+ print(" -- preparing pkgs for file entries") |
1402 |
+ for pkg in pkg_keys: |
1403 |
+ output(pkg, pkgs[pkg], cp_counts[pkg]) |
1404 |
+ if self.options['verbose']: |
1405 |
+ message = (pp.emph(" ") + |
1406 |
+ pp.number(str(pkg_count)) + |
1407 |
+ pp.emph(" different packages")) |
1408 |
+ print() |
1409 |
+ print(pp.globaloption(" -- Totals")) |
1410 |
+ print(message) |
1411 |
+ #print |
1412 |
+ #unique = list(unique_flags) |
1413 |
+ #unique.sort() |
1414 |
+ #print unique |
1415 |
+ if not self.options["pretend"]: |
1416 |
+ filepath = os.path.expanduser('~/package.use.test') |
1417 |
+ self.save_file(filepath, output.lines) |
1418 |
+ |
1419 |
+ def rebuild_keywords(self): |
1420 |
+ print("Module action not yet available") |
1421 |
+ print() |
1422 |
+ """This will scan the installed packages db and analyze the |
1423 |
+ keywords used for installation and produce a report on them. |
1424 |
+ """ |
1425 |
+ system_keywords = portage.settings["ACCEPT_KEYWORDS"].split() |
1426 |
+ output = RebuildPrinter( |
1427 |
+ "keywords", self.options["pretend"], self.options["exact"], |
1428 |
+ self.options['slot']) |
1429 |
+ arch = portage.settings["ARCH"] |
1430 |
+ if self.options["prefix"]: |
1431 |
+ # build a new keyword for testing |
1432 |
+ system_keywords = "~" + arch + "-linux" |
1433 |
+ if self.options["verbose"] or self.options["prefix"]: |
1434 |
+ print("Current system ARCH =", arch) |
1435 |
+ print("Current system ACCEPT_KEYWORDS =", system_keywords) |
1436 |
+ self.analyser = KeywordAnalyser( arch, system_keywords, VARDB) |
1437 |
+ #self.analyser.set_order(portage.settings["USE"].split()) |
1438 |
+ # only for testing |
1439 |
+ test_use = portage.settings["USE"].split() |
1440 |
+ if self.options['prefix'] and 'prefix' not in test_use: |
1441 |
+ print("REBUILD_KEYWORDS() 'prefix' flag not found in system", |
1442 |
+ "USE flags!!! appending for testing") |
1443 |
+ print() |
1444 |
+ test_use.append('prefix') |
1445 |
+ self.analyser.set_order(test_use) |
1446 |
+ # /end testing |
1447 |
+ |
1448 |
+ cpvs = VARDB.cpv_all() |
1449 |
+ #print "Total number of installed ebuilds =", len(cpvs) |
1450 |
+ pkgs, cp_counts = cpv_all_diff_keywords( |
1451 |
+ cpvs=cpvs, |
1452 |
+ system_keywords=system_keywords, |
1453 |
+ use_portage=self.options['portage'], |
1454 |
+ analyser = self.analyser |
1455 |
+ ) |
1456 |
+ #print([pkgs[p][0].cpv for p in pkgs]) |
1457 |
+ if pkgs: |
1458 |
+ pkg_keys = sorted(pkgs) |
1459 |
+ #print(len(pkgs)) |
1460 |
+ if self.options["pretend"] and not self.options["quiet"]: |
1461 |
+ print() |
1462 |
+ print(pp.globaloption( |
1463 |
+ " -- These are the installed packages & keywords " + |
1464 |
+ "that were detected")) |
1465 |
+ print(pp.globaloption(" to need keyword settings other " + |
1466 |
+ "than the defaults.")) |
1467 |
+ print() |
1468 |
+ elif not self.options["quiet"]: |
1469 |
+ print(" -- preparing pkgs for file entries") |
1470 |
+ for pkg in pkg_keys: |
1471 |
+ output(pkg, pkgs[pkg], cp_counts[pkg]) |
1472 |
+ if not self.options['quiet']: |
1473 |
+ if self.analyser.mismatched: |
1474 |
+ print("_________________________________________________") |
1475 |
+ print(("The following packages were found to have a \n" + |
1476 |
+ "different recorded ARCH than the current system ARCH")) |
1477 |
+ for cpv in self.analyser.mismatched: |
1478 |
+ print("\t", pp.cpv(cpv)) |
1479 |
+ print("===================================================") |
1480 |
+ print("Total number of entries in report =", |
1481 |
+ pp.output.red(str(len(pkg_keys)))) |
1482 |
+ if self.options["verbose"]: |
1483 |
+ print("Total number of installed ebuilds =", |
1484 |
+ pp.output.red(str(len(cpvs)))) |
1485 |
+ print() |
1486 |
+ if not self.options["pretend"]: |
1487 |
+ filepath = os.path.expanduser('~/package.keywords.test') |
1488 |
+ self.save_file(filepath, output.lines) |
1489 |
+ |
1490 |
+ |
1491 |
+ def rebuild_unmask(self): |
1492 |
+ print("Module action not yet available") |
1493 |
+ print() |
1494 |
+ |
1495 |
+ |
1496 |
+ def save_file(self, filepath, data): |
1497 |
+ """Writes the data to the file determined by filepath |
1498 |
+ |
1499 |
+ @param filepath: string. eg. '/path/to/filename' |
1500 |
+ @param data: list of lines to write to filepath |
1501 |
+ """ |
1502 |
+ if not self.options["quiet"]: |
1503 |
+ print(' - Saving file: %s' %filepath) |
1504 |
+ with open(filepath, "w") as output: |
1505 |
+ output.write('\n'.join(data)) |
1506 |
+ print(" - Done") |
1507 |
|
1508 |
|
1509 |
def main(input_args): |
1510 |
- """Common starting method by the analyze master |
1511 |
- unless all modules are converted to this class method. |
1512 |
+ """Common starting method by the analyze master |
1513 |
+ unless all modules are converted to this class method. |
1514 |
|
1515 |
- @param input_args: input args as supplied by equery master module. |
1516 |
- """ |
1517 |
- query_module = Rebuild() |
1518 |
- query_module.run(input_args, gentoolkit.CONFIG['quiet']) |
1519 |
+ @param input_args: input args as supplied by equery master module. |
1520 |
+ """ |
1521 |
+ query_module = Rebuild() |
1522 |
+ query_module.run(input_args, gentoolkit.CONFIG['quiet']) |
1523 |
|
1524 |
# vim: set ts=4 sw=4 tw=79: |
1525 |
|
1526 |
|
1527 |
diff --git a/pym/gentoolkit/enalyze/base.py b/pym/gentoolkit/module_base.py |
1528 |
similarity index 100% |
1529 |
rename from pym/gentoolkit/enalyze/base.py |
1530 |
rename to pym/gentoolkit/module_base.py |