]> scripts.mit.edu Git - wizard.git/commitdiff
Implement 'git summary unsupported'
authorEdward Z. Yang <ezyang@mit.edu>
Sun, 10 Jan 2010 05:39:45 +0000 (00:39 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sun, 10 Jan 2010 05:41:05 +0000 (00:41 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/command/summary/__init__.py
wizard/command/summary/unsupported.py [new file with mode: 0644]
wizard/command/summary/version.py
wizard/deploy.py

index f47c61a782adfed0dbf3347997cc0b690c9df0df..155c22c551a279119b467f7a5154160db050eea3 100644 (file)
@@ -12,6 +12,7 @@ Scans all of the collected data from parallel-find.pl, and
 calculates interesting information about them.
 
 Its subcommands are:
+    unsupported     List unsupported versions in the wild
     version         Breakdown of autoinstalls by version (default)
 
 Use %prog summary SUBCOMMAND --help for more information."""
diff --git a/wizard/command/summary/unsupported.py b/wizard/command/summary/unsupported.py
new file mode 100644 (file)
index 0000000..6c2ee7b
--- /dev/null
@@ -0,0 +1,34 @@
+import math
+import distutils.version
+
+from wizard import app, command, deploy, shell, util
+
+def main(argv, baton):
+    options, args = parse_args(argv, baton)
+    appname = args[0]
+    # grab all the supported versions
+    application = app.getApplication(appname)
+    tags = set(shell.eval("git", "--git-dir=" + application.repository(options.srv_path), "tag").strip().split())
+    unsupported = set()
+    for d in deploy.parse_install_lines(appname, options.versions_path):
+        version = d.detectVersion()
+        if "wordpress-%s" % version not in tags:
+            unsupported.add(version)
+    for v in unsupported:
+        print v
+
+def parse_args(argv, baton):
+    usage = """usage: %prog summary unsupported [ARGS] APP
+
+Determines what application versions are unsupported in our
+repository but are extant in migrated/unmigrated installs.
+We have to calculate the real version using our heuristic,
+since Git may lie if the user manually upgraded their install."""
+    parser = command.WizardOptionParser(usage)
+    baton.push(parser, "versions_path")
+    baton.push(parser, "srv_path")
+    options, args = parser.parse_all(argv)
+    if len(args) > 1:
+        parser.error("too many arguments")
+    return options, args
+
index c0fd1b7838ae6474037538097e0cb69a1b9af544..4cf139bbead01936bb70832dfa57231d284fb66a 100644 (file)
@@ -43,9 +43,9 @@ def parse_args(argv, baton):
 Prints graphs of version usage in autoinstallers
 
 Examples:
-    %prog summary list
+    %prog summary
         Show graphs for all autoinstall versions
-    %prog summary list mediawiki
+    %prog summary version mediawiki
         Show graph for MediaWiki autoinstall versions"""
     parser = command.WizardOptionParser(usage)
     baton.push(parser, "versions_path")
index 67c4118e0b7c37741a97e5ad7658bdde62b6014a..a748f1b78aaf82d2701c1f1a684465c3643c052f 100644 (file)
@@ -195,11 +195,23 @@ class Deployment(object):
         Checks if our version and the version number recorded in a file
         are consistent.
         """
+        real = self.detectVersion()
+        if not str(real) == self.app_version.pristine_tag.partition('-')[2]:
+            raise VersionMismatchError(real, self.version)
+
+    @property
+    @chdir_to_location
+    def detectVersion(self):
+        """
+        Returns the real version, based on filesystem, of install.
+
+        Throws a :class:`VersionDetectionError` if we couldn't figure out
+        what the real version was.
+        """
         real = self.application.detectVersion(self)
         if not real:
             raise VersionDetectionError
-        elif not str(real) == self.app_version.pristine_tag.partition('-')[2]:
-            raise VersionMismatchError(real, self.version)
+        return real
 
     @property
     @chdir_to_location