@@ -26,35 +26,40 @@ fn main() {
2626 let mut build_lock;
2727 #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
2828 let _build_lock_guard;
29- #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
30- // Display PID of process holding the lock
31- // PID will be stored in a lock file
32- {
33- let path = config. out . join ( "lock" ) ;
34- let pid = match fs:: read_to_string ( & path) {
35- Ok ( contents) => contents,
36- Err ( _) => String :: new ( ) ,
37- } ;
38-
39- build_lock =
40- fd_lock:: RwLock :: new ( t ! ( fs:: OpenOptions :: new( ) . write( true ) . create( true ) . open( & path) ) ) ;
41- _build_lock_guard = match build_lock. try_write ( ) {
42- Ok ( mut lock) => {
43- t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
44- lock
45- }
46- err => {
47- drop ( err) ;
48- println ! ( "WARNING: build directory locked by process {pid}, waiting for lock" ) ;
49- let mut lock = t ! ( build_lock. write( ) ) ;
50- t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
51- lock
52- }
53- } ;
54- }
5529
56- #[ cfg( any( not( any( unix, windows) ) , target_os = "solaris" ) ) ]
57- println ! ( "WARNING: file locking not supported for target, not locking build directory" ) ;
30+ if !config. bypass_bootstrap_lock {
31+ // Display PID of process holding the lock
32+ // PID will be stored in a lock file
33+ #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
34+ {
35+ let path = config. out . join ( "lock" ) ;
36+ let pid = match fs:: read_to_string ( & path) {
37+ Ok ( contents) => contents,
38+ Err ( _) => String :: new ( ) ,
39+ } ;
40+
41+ build_lock = fd_lock:: RwLock :: new ( t ! ( fs:: OpenOptions :: new( )
42+ . write( true )
43+ . create( true )
44+ . open( & path) ) ) ;
45+ _build_lock_guard = match build_lock. try_write ( ) {
46+ Ok ( mut lock) => {
47+ t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
48+ lock
49+ }
50+ err => {
51+ drop ( err) ;
52+ println ! ( "WARNING: build directory locked by process {pid}, waiting for lock" ) ;
53+ let mut lock = t ! ( build_lock. write( ) ) ;
54+ t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
55+ lock
56+ }
57+ } ;
58+ }
59+
60+ #[ cfg( any( not( any( unix, windows) ) , target_os = "solaris" ) ) ]
61+ println ! ( "WARNING: file locking not supported for target, not locking build directory" ) ;
62+ }
5863
5964 // check_version warnings are not printed during setup
6065 let changelog_suggestion =
0 commit comments