]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/upgrade.py
Suppress ^M characters from Git progress bars.
[wizard.git] / wizard / command / upgrade.py
index 969404379c57bd8a3e7d61e78507da170560a236..4efbda83ae3f18f87dd366e0a471cfcfab4d90f6 100644 (file)
@@ -18,6 +18,8 @@ def main(argv, baton):
         dir = "."
     shell.drop_priviledges(dir, options.log_file)
     util.chdir(dir)
+    if os.path.exists(".scripts/blacklisted"):
+        raise BlacklistedError()
     sh = shell.Shell()
     util.set_git_env()
     if options.continue_:
@@ -50,7 +52,7 @@ def main(argv, baton):
         temp_wc_dir = perform_tmp_clone(sh)
         with util.ChangeDirectory(temp_wc_dir):
             sh.call("git", "remote", "add", "scripts", repo)
-            sh.call("git", "fetch", "scripts")
+            sh.call("git", "fetch", "-q", "scripts")
             user_commit, next_commit = calculate_parents(sh, version)
             # save variables so that --continue will work
             # yeah yeah no trailing newline whatever
@@ -72,10 +74,10 @@ def main(argv, baton):
         # a master branch may not necessarily exist if the user
         # was manually installed to an earlier version
         try:
-            sh.call("git", "checkout", "-b", "master", "--")
+            sh.call("git", "checkout", "-q", "-b", "master", "--")
         except shell.CallError:
-            sh.call("git", "checkout", "master", "--")
-        sh.call("git", "reset", "--hard", final_commit)
+            sh.call("git", "checkout", "-q", "master", "--")
+        sh.call("git", "reset", "-q", "--hard", final_commit)
         d.verifyVersion()
     # Till now, all of our operations were in a tmp sandbox.
     if options.dry_run:
@@ -87,7 +89,7 @@ def main(argv, baton):
     with util.IgnoreKeyboardInterrupts():
         with util.LockDirectory(".scripts-upgrade-lock"):
             # git merge (which performs a fast forward)
-            sh.call("git", "pull", temp_wc_dir, "master")
+            sh.call("git", "pull", "-q", temp_wc_dir, "master")
             version_obj = distutils.version.LooseVersion(version.partition('-')[2])
             try:
                 # run update script
@@ -97,10 +99,11 @@ def main(argv, baton):
                 logging.warning("Upgrade failed: rolling back")
                 perform_restore(d, backup)
                 raise
-            except deploy.WebVerificationError:
+            except deploy.WebVerificationError as e:
                 logging.warning("Web verification failed: rolling back")
+                logging.info("Web page that was output was:\n\n%s" % e.contents)
                 perform_restore(d, backup)
-                raise app.UpgradeFailure("Upgrade caused website to become inaccessible; site was rolled back")
+                raise app.UpgradeVerificationFailure("Upgrade caused website to become inaccessible; site was rolled back")
     # XXX: frob .htaccess to make site accessible
     #       to do this, check if .htaccess changed, first.  Upgrade
     #       process might have frobbed it.  Don't be
@@ -147,7 +150,7 @@ def perform_tmp_clone(sh):
     temp_dir = tempfile.mkdtemp(prefix="wizard")
     temp_wc_dir = os.path.join(temp_dir, "repo")
     logging.info("Using temporary directory: " + temp_wc_dir)
-    sh.call("git", "clone", "--shared", ".", temp_wc_dir)
+    sh.call("git", "clone", "-q", "--shared", ".", temp_wc_dir)
     return temp_wc_dir
 
 def perform_merge(sh, repo, d, version):
@@ -156,7 +159,7 @@ def perform_merge(sh, repo, d, version):
     # crazy merge algorithm:
     def make_virtual_commit(tag, parents = []):
         """WARNING: Changes state of Git repository"""
-        sh.call("git", "checkout", tag, "--")
+        sh.call("git", "checkout", "-q", tag, "--")
         d.parametrize(".")
         for file in d.application.parametrized_files:
             try:
@@ -233,3 +236,10 @@ The best way to resolve this is probably to attempt an upgrade again,
 with git rerere to remember merge resolutions (XXX: not sure if
 this actually works)."""
 
+class BlacklistedError(Error):
+    def __str__(self):
+        return """
+
+ERROR: This autoinstall was manually blacklisted against errors;
+if the user has not been notified of this, please send them
+mail."""