2 import wizard.deploy as wd
6 def __init__(self, quiet, verbose):
13 if not self.quiet and self.i % 10 == 0:
21 def write(self, str = ""):
24 def qwrite(self, str = ""):
28 def tweet(self, str = ""):
31 print str, # note comma
32 def chat(self, str = ""):
37 def main(argv, global_options):
38 usage = """usage: %prog summary [ARGS] APPS
40 Scans all of the collected data from parallel-find.pl, and
41 determines version histograms for our applications. You may
42 optionally pass application parameters to filter the installs.
47 %prog summary mediawiki
48 Displays only MediaWiki statistics
49 %prog summary -v -q mediawiki-1.2.3
50 Displays all deployments of this version"""
51 parser = optparse.OptionParser(usage)
52 parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
53 default=False, help="Print interesting directories")
54 parser.add_option("-q", "--quiet", dest="quiet", action="store_true",
55 default=False, help="Suppresses progress output")
56 parser.add_option("--count-exists", dest="count_exists",
57 default=False, help="Count deployments that contain a file")
58 options, show = parser.parse_args(argv)
59 fi = wd.getInstallLines(global_options)
60 if not show: show = wd.applications.keys()
61 show = frozenset(show)
65 printer = Printer(options.quiet, options.verbose)
66 printer.tweet("Processing")
70 deploy = wd.Deployment.parse(line)
71 except wd.DeploymentParseError:
74 except wd.NoSuchApplication:
77 name = deploy.getApplication().name
78 if name + "-" + str(deploy.getVersion()) in show:
79 printer.write("%s-%s deployment at %s" \
80 % (name, deploy.getVersion(), deploy.location))
86 if options.count_exists:
87 r = deploy.count_exists(options.count_exists)
89 printer.chat("Found " + options.count_exists + " in " + deploy.location)
91 for app in wd.applications.values():
92 if app.name not in show: continue
93 printer.write(app.report())
95 printer.write("With %d errors and %d unrecognized applications" % (errors, unrecognized))