@@ -232,26 +232,27 @@ struct Builder {
232
232
233
233
input : PathBuf ,
234
234
output : PathBuf ,
235
- gpg_passphrase : String ,
236
235
digests : BTreeMap < String , String > ,
237
236
s3_address : String ,
238
237
date : String ,
239
238
240
- should_sign : bool ,
239
+ legacy : bool ,
240
+ legacy_gpg_passphrase : String ,
241
241
}
242
242
243
243
fn main ( ) {
244
- // Avoid signing packages while manually testing
245
- // Do NOT set this envvar in CI
246
- let should_sign = env:: var ( "BUILD_MANIFEST_DISABLE_SIGNING" ) . is_err ( ) ;
247
-
248
- // Safety check to ensure signing is always enabled on CI
249
- // The CI environment variable is set by both Travis and AppVeyor
250
- if !should_sign && env:: var ( "CI" ) . is_ok ( ) {
251
- println ! ( "The 'BUILD_MANIFEST_DISABLE_SIGNING' env var can't be enabled on CI." ) ;
252
- println ! ( "If you're not running this on CI, unset the 'CI' env var." ) ;
253
- panic ! ( ) ;
254
- }
244
+ // Up until Rust 1.48 the release process relied on build-manifest to create the SHA256
245
+ // checksums of released files and to sign the tarballs. That was moved over to promote-release
246
+ // in time for the branching of Rust 1.48, but the old release process still had to work the
247
+ // old way.
248
+ //
249
+ // When running build-manifest through the old ./x.py dist hash-and-sign the environment
250
+ // variable will be set, enabling the legacy behavior of generating the .sha256 files and
251
+ // signing the tarballs.
252
+ //
253
+ // Once the old release process is fully decommissioned, the environment variable, all the
254
+ // related code in this tool and ./x.py dist hash-and-sign can be removed.
255
+ let legacy = env:: var ( "BUILD_MANIFEST_LEGACY" ) . is_ok ( ) ;
255
256
256
257
let mut args = env:: args ( ) . skip ( 1 ) ;
257
258
let input = PathBuf :: from ( args. next ( ) . unwrap ( ) ) ;
@@ -263,7 +264,7 @@ fn main() {
263
264
264
265
// Do not ask for a passphrase while manually testing
265
266
let mut passphrase = String :: new ( ) ;
266
- if should_sign {
267
+ if legacy {
267
268
// `x.py` passes the passphrase via stdin.
268
269
t ! ( io:: stdin( ) . read_to_string( & mut passphrase) ) ;
269
270
}
@@ -273,12 +274,12 @@ fn main() {
273
274
274
275
input,
275
276
output,
276
- gpg_passphrase : passphrase,
277
277
digests : BTreeMap :: new ( ) ,
278
278
s3_address,
279
279
date,
280
280
281
- should_sign,
281
+ legacy,
282
+ legacy_gpg_passphrase : passphrase,
282
283
}
283
284
. build ( ) ;
284
285
}
@@ -604,7 +605,7 @@ impl Builder {
604
605
}
605
606
606
607
fn sign ( & self , path : & Path ) {
607
- if !self . should_sign {
608
+ if !self . legacy {
608
609
return ;
609
610
}
610
611
@@ -627,7 +628,7 @@ impl Builder {
627
628
. arg ( path)
628
629
. stdin ( Stdio :: piped ( ) ) ;
629
630
let mut child = t ! ( cmd. spawn( ) ) ;
630
- t ! ( child. stdin. take( ) . unwrap( ) . write_all( self . gpg_passphrase . as_bytes( ) ) ) ;
631
+ t ! ( child. stdin. take( ) . unwrap( ) . write_all( self . legacy_gpg_passphrase . as_bytes( ) ) ) ;
631
632
assert ! ( t!( child. wait( ) ) . success( ) ) ;
632
633
}
633
634
0 commit comments