@@ -232,26 +232,27 @@ struct Builder {
232232
233233 input : PathBuf ,
234234 output : PathBuf ,
235- gpg_passphrase : String ,
236235 digests : BTreeMap < String , String > ,
237236 s3_address : String ,
238237 date : String ,
239238
240- should_sign : bool ,
239+ legacy : bool ,
240+ legacy_gpg_passphrase : String ,
241241}
242242
243243fn 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 ( ) ;
255256
256257 let mut args = env:: args ( ) . skip ( 1 ) ;
257258 let input = PathBuf :: from ( args. next ( ) . unwrap ( ) ) ;
@@ -263,7 +264,7 @@ fn main() {
263264
264265 // Do not ask for a passphrase while manually testing
265266 let mut passphrase = String :: new ( ) ;
266- if should_sign {
267+ if legacy {
267268 // `x.py` passes the passphrase via stdin.
268269 t ! ( io:: stdin( ) . read_to_string( & mut passphrase) ) ;
269270 }
@@ -273,12 +274,12 @@ fn main() {
273274
274275 input,
275276 output,
276- gpg_passphrase : passphrase,
277277 digests : BTreeMap :: new ( ) ,
278278 s3_address,
279279 date,
280280
281- should_sign,
281+ legacy,
282+ legacy_gpg_passphrase : passphrase,
282283 }
283284 . build ( ) ;
284285}
@@ -608,7 +609,7 @@ impl Builder {
608609 }
609610
610611 fn sign ( & self , path : & Path ) {
611- if !self . should_sign {
612+ if !self . legacy {
612613 return ;
613614 }
614615
@@ -631,7 +632,7 @@ impl Builder {
631632 . arg ( path)
632633 . stdin ( Stdio :: piped ( ) ) ;
633634 let mut child = t ! ( cmd. spawn( ) ) ;
634- t ! ( child. stdin. take( ) . unwrap( ) . write_all( self . gpg_passphrase . as_bytes( ) ) ) ;
635+ t ! ( child. stdin. take( ) . unwrap( ) . write_all( self . legacy_gpg_passphrase . as_bytes( ) ) ) ;
635636 assert ! ( t!( child. wait( ) ) . success( ) ) ;
636637 }
637638
0 commit comments