@@ -14,9 +14,7 @@ use crate::versions::{PkgType, Versions};
1414use std:: collections:: { BTreeMap , HashMap , HashSet } ;
1515use std:: env;
1616use std:: fs:: { self , File } ;
17- use std:: io:: { self , Read , Write } ;
1817use std:: path:: { Path , PathBuf } ;
19- use std:: process:: { Command , Stdio } ;
2018
2119static HOSTS : & [ & str ] = & [
2220 "aarch64-apple-darwin" ,
@@ -200,29 +198,10 @@ struct Builder {
200198 output : PathBuf ,
201199 s3_address : String ,
202200 date : String ,
203-
204- legacy : bool ,
205- legacy_gpg_passphrase : String ,
206201}
207202
208203fn main ( ) {
209- // Up until Rust 1.48 the release process relied on build-manifest to create the SHA256
210- // checksums of released files and to sign the tarballs. That was moved over to promote-release
211- // in time for the branching of Rust 1.48, but the old release process still had to work the
212- // old way.
213- //
214- // When running build-manifest through the old ./x.py dist hash-and-sign the environment
215- // variable will be set, enabling the legacy behavior of generating the .sha256 files and
216- // signing the tarballs.
217- //
218- // Once the old release process is fully decommissioned, the environment variable, all the
219- // related code in this tool and ./x.py dist hash-and-sign can be removed.
220- let legacy = env:: var_os ( "BUILD_MANIFEST_LEGACY" ) . is_some ( ) ;
221-
222- let num_threads = if legacy {
223- // Avoid overloading the old server in legacy mode.
224- 1
225- } else if let Some ( num) = env:: var_os ( "BUILD_MANIFEST_NUM_THREADS" ) {
204+ let num_threads = if let Some ( num) = env:: var_os ( "BUILD_MANIFEST_NUM_THREADS" ) {
226205 num. to_str ( ) . unwrap ( ) . parse ( ) . expect ( "invalid number for BUILD_MANIFEST_NUM_THREADS" )
227206 } else {
228207 num_cpus:: get ( )
@@ -239,13 +218,6 @@ fn main() {
239218 let s3_address = args. next ( ) . unwrap ( ) ;
240219 let channel = args. next ( ) . unwrap ( ) ;
241220
242- // Do not ask for a passphrase while manually testing
243- let mut passphrase = String :: new ( ) ;
244- if legacy {
245- // `x.py` passes the passphrase via stdin.
246- t ! ( io:: stdin( ) . read_to_string( & mut passphrase) ) ;
247- }
248-
249221 Builder {
250222 versions : Versions :: new ( & channel, & input) . unwrap ( ) ,
251223 checksums : t ! ( Checksums :: new( ) ) ,
@@ -255,19 +227,13 @@ fn main() {
255227 output,
256228 s3_address,
257229 date,
258-
259- legacy,
260- legacy_gpg_passphrase : passphrase,
261230 }
262231 . build ( ) ;
263232}
264233
265234impl Builder {
266235 fn build ( & mut self ) {
267236 self . check_toolstate ( ) ;
268- if self . legacy {
269- self . digest_and_sign ( ) ;
270- }
271237 let manifest = self . build_manifest ( ) ;
272238
273239 let channel = self . versions . channel ( ) . to_string ( ) ;
@@ -310,15 +276,6 @@ impl Builder {
310276 }
311277 }
312278
313- /// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
314- fn digest_and_sign ( & mut self ) {
315- for file in t ! ( self . input. read_dir( ) ) . map ( |e| t ! ( e) . path ( ) ) {
316- file. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
317- self . hash ( & file) ;
318- self . sign ( & file) ;
319- }
320- }
321-
322279 fn build_manifest ( & mut self ) -> Manifest {
323280 let mut manifest = Manifest {
324281 manifest_version : "2" . to_string ( ) ,
@@ -584,51 +541,6 @@ impl Builder {
584541 format ! ( "{}/{}/{}" , self . s3_address, self . date, file_name)
585542 }
586543
587- fn hash ( & self , path : & Path ) -> String {
588- let sha = t ! ( Command :: new( "shasum" )
589- . arg( "-a" )
590- . arg( "256" )
591- . arg( path. file_name( ) . unwrap( ) )
592- . current_dir( path. parent( ) . unwrap( ) )
593- . output( ) ) ;
594- assert ! ( sha. status. success( ) ) ;
595-
596- let filename = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
597- let sha256 = self . output . join ( format ! ( "{}.sha256" , filename) ) ;
598- t ! ( fs:: write( & sha256, & sha. stdout) ) ;
599-
600- let stdout = String :: from_utf8_lossy ( & sha. stdout ) ;
601- stdout. split_whitespace ( ) . next ( ) . unwrap ( ) . to_string ( )
602- }
603-
604- fn sign ( & self , path : & Path ) {
605- if !self . legacy {
606- return ;
607- }
608-
609- let filename = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
610- let asc = self . output . join ( format ! ( "{}.asc" , filename) ) ;
611- println ! ( "signing: {:?}" , path) ;
612- let mut cmd = Command :: new ( "gpg" ) ;
613- cmd. arg ( "--pinentry-mode=loopback" )
614- . arg ( "--no-tty" )
615- . arg ( "--yes" )
616- . arg ( "--batch" )
617- . arg ( "--passphrase-fd" )
618- . arg ( "0" )
619- . arg ( "--personal-digest-preferences" )
620- . arg ( "SHA512" )
621- . arg ( "--armor" )
622- . arg ( "--output" )
623- . arg ( & asc)
624- . arg ( "--detach-sign" )
625- . arg ( path)
626- . stdin ( Stdio :: piped ( ) ) ;
627- let mut child = t ! ( cmd. spawn( ) ) ;
628- t ! ( child. stdin. take( ) . unwrap( ) . write_all( self . legacy_gpg_passphrase. as_bytes( ) ) ) ;
629- assert ! ( t!( child. wait( ) ) . success( ) ) ;
630- }
631-
632544 fn write_channel_files ( & mut self , channel_name : & str , manifest : & Manifest ) {
633545 self . write ( & toml:: to_string ( & manifest) . unwrap ( ) , channel_name, ".toml" ) ;
634546 self . write ( & manifest. date , channel_name, "-date.txt" ) ;
@@ -645,10 +557,6 @@ impl Builder {
645557
646558 let dst = self . output . join ( name) ;
647559 t ! ( fs:: write( & dst, contents) ) ;
648- if self . legacy {
649- self . hash ( & dst) ;
650- self . sign ( & dst) ;
651- }
652560 }
653561
654562 fn write_shipped_files ( & self , path : & Path ) {
0 commit comments