]> scripts.mit.edu Git - wizard.git/commitdiff
Add support for app-1.2.3 queries.
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Tue, 19 May 2009 04:34:44 +0000 (00:34 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Tue, 19 May 2009 04:34:44 +0000 (00:34 -0400)
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
bin/install-statistics

index cf78c5646c179c233560d3fbd4640d78192112d2..5bbc67d99a04745b72c748244426676731dac6eb 100755 (executable)
@@ -21,6 +21,7 @@ class Deployment(object):
     def __init__(self, location, version):
         self.location = location
         self.version = version
+        self.application = version.application
     @staticmethod
     def parse(line):
         """Parses a line from the results of parallel-find.pl.
@@ -127,9 +128,9 @@ optionally pass application parameters to filter the installs."""
     parser.add_option("--count-exists", dest="count_exists",
             default=False, help="Count deployments that contain a file")
     # There should be machine friendly output
-    options, show_applications = parser.parse_args()
-    if not show_applications: show_applications = applications.keys()
-    show_applications = frozenset(show_applications)
+    options, show = parser.parse_args()
+    if not show: show = applications.keys()
+    show = frozenset(show)
     vd = options.version_dir
     try:
         fi = fileinput.input([vd + "/" + f for f in os.listdir(vd)])
@@ -139,6 +140,7 @@ optionally pass application parameters to filter the installs."""
     errors = 0
     unrecognized = 0
     processed = 0
+    # I really don't like this boolean
     hanging = False # whether or not we last outputted a newline
     if not options.quiet: print "Processing",
     for line in fi:
@@ -155,7 +157,16 @@ optionally pass application parameters to filter the installs."""
         except NoSuchApplication:
             unrecognized += 1
             continue
-        if deploy.version.application.name not in show_applications: continue
+        if deploy.application.name + "-" + str(deploy.version.version) in show:
+            if hanging:
+                hanging = False
+                print
+            print "%s-%s deployment at %s" \
+                % (deploy.application.name, deploy.version.version, deploy.location)
+        elif deploy.application.name in show:
+            pass
+        else:
+            continue
         deploy.count()
         if options.count_exists:
             r = deploy.count_exists(options.count_exists)
@@ -167,7 +178,7 @@ optionally pass application parameters to filter the installs."""
     if hanging: print
     print
     for app in applications.values():
-        if app.name not in show_applications: continue
+        if app.name not in show: continue
         print app
         print
     print "With %d errors and %d unrecognized applications" % (errors, unrecognized)