@@ -3117,53 +3117,56 @@ impl Step for Distcheck {
3117
3117
///
3118
3118
/// FIXME(#136822): dist components are under-tested.
3119
3119
fn run ( self , builder : & Builder < ' _ > ) {
3120
- builder. info ( "Distcheck" ) ;
3121
- let dir = builder. tempdir ( ) . join ( "distcheck" ) ;
3122
- let _ = fs:: remove_dir_all ( & dir) ;
3123
- t ! ( fs:: create_dir_all( & dir) ) ;
3120
+ // Use a temporary directory completely outside the current checkout, to avoid reusing any
3121
+ // local source code, built artifacts or configuration by accident
3122
+ let root_dir = std:: env:: temp_dir ( ) . join ( "distcheck" ) ;
3124
3123
3125
- // Guarantee that these are built before we begin running.
3126
- builder. ensure ( dist:: PlainSourceTarball ) ;
3127
- builder. ensure ( dist:: Src ) ;
3124
+ // Check that we can build some basic things from the plain source tarball
3125
+ builder. info ( "Distcheck plain source tarball" ) ;
3126
+ let plain_src_tarball = builder. ensure ( dist:: PlainSourceTarball ) ;
3127
+ let plain_src_dir = root_dir. join ( "distcheck-plain-src" ) ;
3128
+ builder. clear_dir ( & plain_src_dir) ;
3128
3129
3129
3130
command ( "tar" )
3130
3131
. arg ( "-xf" )
3131
- . arg ( builder . ensure ( dist :: PlainSourceTarball ) . tarball ( ) )
3132
+ . arg ( plain_src_tarball . tarball ( ) )
3132
3133
. arg ( "--strip-components=1" )
3133
- . current_dir ( & dir )
3134
+ . current_dir ( & plain_src_dir )
3134
3135
. run ( builder) ;
3135
3136
command ( "./configure" )
3137
+ . arg ( "--set" )
3138
+ . arg ( "rust.omit-git-hash=false" )
3136
3139
. args ( & builder. config . configure_args )
3137
3140
. arg ( "--enable-vendor" )
3138
- . current_dir ( & dir )
3141
+ . current_dir ( & plain_src_dir )
3139
3142
. run ( builder) ;
3140
3143
command ( helpers:: make ( & builder. config . host_target . triple ) )
3141
3144
. arg ( "check" )
3142
- . current_dir ( & dir )
3145
+ . current_dir ( & plain_src_dir )
3143
3146
. run ( builder) ;
3144
3147
3145
3148
// Now make sure that rust-src has all of libstd's dependencies
3146
3149
builder. info ( "Distcheck rust-src" ) ;
3147
- let dir = builder. tempdir ( ) . join ( "distcheck-src" ) ;
3148
- let _ = fs :: remove_dir_all ( & dir ) ;
3149
- t ! ( fs :: create_dir_all ( & dir ) ) ;
3150
+ let src_tarball = builder. ensure ( dist :: Src ) ;
3151
+ let src_dir = root_dir . join ( "distcheck-src" ) ;
3152
+ builder . clear_dir ( & src_dir ) ;
3150
3153
3151
3154
command ( "tar" )
3152
3155
. arg ( "-xf" )
3153
- . arg ( builder . ensure ( dist :: Src ) . tarball ( ) )
3156
+ . arg ( src_tarball . tarball ( ) )
3154
3157
. arg ( "--strip-components=1" )
3155
- . current_dir ( & dir )
3158
+ . current_dir ( & src_dir )
3156
3159
. run ( builder) ;
3157
3160
3158
- let toml = dir . join ( "rust-src/lib/rustlib/src/rust/library/std/Cargo.toml" ) ;
3161
+ let toml = src_dir . join ( "rust-src/lib/rustlib/src/rust/library/std/Cargo.toml" ) ;
3159
3162
command ( & builder. initial_cargo )
3160
3163
// Will read the libstd Cargo.toml
3161
3164
// which uses the unstable `public-dependency` feature.
3162
3165
. env ( "RUSTC_BOOTSTRAP" , "1" )
3163
3166
. arg ( "generate-lockfile" )
3164
3167
. arg ( "--manifest-path" )
3165
3168
. arg ( & toml)
3166
- . current_dir ( & dir )
3169
+ . current_dir ( & src_dir )
3167
3170
. run ( builder) ;
3168
3171
}
3169
3172
}
0 commit comments