about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-30 19:01:01 +0000
committerbors <bors@rust-lang.org>2020-04-30 19:01:01 +0000
commit7ced01a730e8fc1bae2f8d4369c26812c0484da4 (patch)
tree5f972cddf361a86e359b3a523c5ac68110a151db /src/bootstrap
parentbe8589fc31162bb71b0f765beba6ce73ec8ba93a (diff)
parent97a8870022ec819c8b92b4c192242726c77e19f3 (diff)
Auto merge of #71717 - Dylan-DPC:rollup-av5vjor, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #70950 (extend NLL checker to understand `'empty` combined with universes)
 - #71433 (Add help message for missing right operand in condition)
 - #71449 (Move `{Free,}RegionRelations` and `FreeRegionMap` to `rustc_infer`)
 - #71559 (Detect git version before attempting to use --progress)
 - #71597 (Rename Unique::empty() -> Unique::dangling())

Failed merges:

r? @ghost
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index d5efed61b54..2aa3f9c7ec0 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function
 import argparse
 import contextlib
 import datetime
+import distutils.version
 import hashlib
 import os
 import re
@@ -331,6 +332,7 @@ class RustBuild(object):
         self.use_locked_deps = ''
         self.use_vendored_sources = ''
         self.verbose = False
+        self.git_version = None
 
     def download_stage0(self):
         """Fetch the build system for Rust, written in Rust
@@ -743,15 +745,13 @@ class RustBuild(object):
 
         run(["git", "submodule", "-q", "sync", module],
             cwd=self.rust_root, verbose=self.verbose)
-        try:
-            run(["git", "submodule", "update",
-                 "--init", "--recursive", "--progress", module],
-                cwd=self.rust_root, verbose=self.verbose, exception=True)
-        except RuntimeError:
-            # Some versions of git don't support --progress.
-            run(["git", "submodule", "update",
-                 "--init", "--recursive", module],
-                cwd=self.rust_root, verbose=self.verbose)
+
+        update_args = ["git", "submodule", "update", "--init", "--recursive"]
+        if self.git_version >= distutils.version.LooseVersion("2.11.0"):
+            update_args.append("--progress")
+        update_args.append(module)
+        run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
+
         run(["git", "reset", "-q", "--hard"],
             cwd=module_path, verbose=self.verbose)
         run(["git", "clean", "-qdfx"],
@@ -763,9 +763,13 @@ class RustBuild(object):
                 self.get_toml('submodules') == "false":
             return
 
-        # check the existence of 'git' command
+        default_encoding = sys.getdefaultencoding()
+
+        # check the existence and version of 'git' command
         try:
-            subprocess.check_output(['git', '--version'])
+            git_version_output = subprocess.check_output(['git', '--version'])
+            git_version_str = git_version_output.strip().split()[2].decode(default_encoding)
+            self.git_version = distutils.version.LooseVersion(git_version_str)
         except (subprocess.CalledProcessError, OSError):
             print("error: `git` is not found, please make sure it's installed and in the path.")
             sys.exit(1)