@@ -216,9 +216,23 @@ struct Builder {
216
216
rustfmt_git_commit_hash : Option < String > ,
217
217
llvm_tools_git_commit_hash : Option < String > ,
218
218
lldb_git_commit_hash : Option < String > ,
219
+
220
+ should_sign : bool ,
219
221
}
220
222
221
223
fn main ( ) {
224
+ // Avoid signing packages while manually testing
225
+ // Do NOT set this envvar in CI
226
+ let should_sign = env:: var ( "BUILD_MANIFEST_DISABLE_SIGNING" ) . is_err ( ) ;
227
+
228
+ // Safety check to ensure signing is always enabled on CI
229
+ // The CI environment variable is set by both Travis and AppVeyor
230
+ if !should_sign && env:: var ( "CI" ) . is_ok ( ) {
231
+ println ! ( "The 'BUILD_MANIFEST_DISABLE_SIGNING' env var can't be enabled on CI." ) ;
232
+ println ! ( "If you're not running this on CI, unset the 'CI' env var." ) ;
233
+ panic ! ( ) ;
234
+ }
235
+
222
236
let mut args = env:: args ( ) . skip ( 1 ) ;
223
237
let input = PathBuf :: from ( args. next ( ) . unwrap ( ) ) ;
224
238
let output = PathBuf :: from ( args. next ( ) . unwrap ( ) ) ;
@@ -231,8 +245,12 @@ fn main() {
231
245
let llvm_tools_release = args. next ( ) . unwrap ( ) ;
232
246
let lldb_release = args. next ( ) . unwrap ( ) ;
233
247
let s3_address = args. next ( ) . unwrap ( ) ;
248
+
249
+ // Do not ask for a passphrase while manually testing
234
250
let mut passphrase = String :: new ( ) ;
235
- t ! ( io:: stdin( ) . read_to_string( & mut passphrase) ) ;
251
+ if should_sign {
252
+ t ! ( io:: stdin( ) . read_to_string( & mut passphrase) ) ;
253
+ }
236
254
237
255
Builder {
238
256
rust_release,
@@ -265,6 +283,8 @@ fn main() {
265
283
rustfmt_git_commit_hash : None ,
266
284
llvm_tools_git_commit_hash : None ,
267
285
lldb_git_commit_hash : None ,
286
+
287
+ should_sign,
268
288
} . build ( ) ;
269
289
}
270
290
@@ -588,6 +608,10 @@ impl Builder {
588
608
}
589
609
590
610
fn sign ( & self , path : & Path ) {
611
+ if !self . should_sign {
612
+ return ;
613
+ }
614
+
591
615
let filename = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
592
616
let asc = self . output . join ( format ! ( "{}.asc" , filename) ) ;
593
617
println ! ( "signing: {:?}" , path) ;
0 commit comments