@@ -127,13 +127,13 @@ def unpack(tarball, dst, verbose=False, match=None):
127
127
shutil .move (tp , fp )
128
128
shutil .rmtree (os .path .join (dst , fname ))
129
129
130
- def run (args , verbose = False , exception = False , cwd = None ):
130
+ def run (args , verbose = False , exception = False , cwd = None , env = None ):
131
131
if verbose :
132
132
print ("running: " + ' ' .join (args ))
133
133
sys .stdout .flush ()
134
134
# Use Popen here instead of call() as it apparently allows powershell on
135
135
# Windows to not lock up waiting for input presumably.
136
- ret = subprocess .Popen (args , cwd = cwd )
136
+ ret = subprocess .Popen (args , cwd = cwd , env = env )
137
137
code = ret .wait ()
138
138
if code != 0 :
139
139
err = "failed to run: " + ' ' .join (args )
@@ -385,17 +385,15 @@ def build_bootstrap(self):
385
385
raise Exception ("no cargo executable found at `%s`" % self .cargo ())
386
386
args = [self .cargo (), "build" , "--manifest-path" ,
387
387
os .path .join (self .rust_root , "src/bootstrap/Cargo.toml" )]
388
+ if self .verbose :
389
+ args .append ("--verbose" )
390
+ if self .verbose > 1 :
391
+ args .append ("--verbose" )
388
392
if self .use_locked_deps :
389
393
args .append ("--locked" )
390
394
if self .use_vendored_sources :
391
395
args .append ("--frozen" )
392
- self .run (args , env )
393
-
394
- def run (self , args , env = None , cwd = None ):
395
- proc = subprocess .Popen (args , env = env , cwd = cwd )
396
- ret = proc .wait ()
397
- if ret != 0 :
398
- sys .exit (ret )
396
+ run (args , env = env , verbose = self .verbose )
399
397
400
398
def output (self , args , env = None , cwd = None ):
401
399
default_encoding = sys .getdefaultencoding ()
@@ -567,7 +565,7 @@ def update_submodules(self):
567
565
path = line [1 :].split (' ' )[1 ]
568
566
submodules .append ([path , line [0 ]])
569
567
570
- self . run (["git" , "submodule" , "sync" ], cwd = self .rust_root )
568
+ run (["git" , "submodule" , "sync" ], cwd = self .rust_root )
571
569
572
570
for submod in submodules :
573
571
path , status = submod
@@ -580,15 +578,15 @@ def update_submodules(self):
580
578
submod_path = os .path .join (self .rust_root , path )
581
579
582
580
if status == ' ' :
583
- self . run (["git" , "reset" , "--hard" ], cwd = submod_path )
584
- self . run (["git" , "clean" , "-fdx" ], cwd = submod_path )
581
+ run (["git" , "reset" , "--hard" ], cwd = submod_path )
582
+ run (["git" , "clean" , "-fdx" ], cwd = submod_path )
585
583
elif status == '+' :
586
- self . run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
587
- self . run (["git" , "reset" , "--hard" ], cwd = submod_path )
588
- self . run (["git" , "clean" , "-fdx" ], cwd = submod_path )
584
+ run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
585
+ run (["git" , "reset" , "--hard" ], cwd = submod_path )
586
+ run (["git" , "clean" , "-fdx" ], cwd = submod_path )
589
587
elif status == '-' :
590
- self . run (["git" , "submodule" , "init" , path ], cwd = self .rust_root )
591
- self . run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
588
+ run (["git" , "submodule" , "init" , path ], cwd = self .rust_root )
589
+ run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
592
590
else :
593
591
raise ValueError ('unknown submodule status: ' + status )
594
592
@@ -620,6 +618,11 @@ def bootstrap():
620
618
except :
621
619
pass
622
620
621
+ if '\n verbose = 2' in rb .config_toml :
622
+ rb .verbose = 2
623
+ elif '\n verbose = 1' in rb .config_toml :
624
+ rb .verbose = 1
625
+
623
626
rb .use_vendored_sources = '\n vendor = true' in rb .config_toml or \
624
627
'CFG_ENABLE_VENDOR' in rb .config_mk
625
628
@@ -676,7 +679,7 @@ def bootstrap():
676
679
env ["BUILD" ] = rb .build
677
680
env ["SRC" ] = rb .rust_root
678
681
env ["BOOTSTRAP_PARENT_ID" ] = str (os .getpid ())
679
- rb . run (args , env )
682
+ run (args , env = env , verbose = rb . verbose )
680
683
681
684
def main ():
682
685
start_time = time ()
0 commit comments