@@ -14,9 +14,7 @@ use crate::versions::{PkgType, Versions};
14
14
use std:: collections:: { BTreeMap , HashMap , HashSet } ;
15
15
use std:: env;
16
16
use std:: fs:: { self , File } ;
17
- use std:: io:: { self , Read , Write } ;
18
17
use std:: path:: { Path , PathBuf } ;
19
- use std:: process:: { Command , Stdio } ;
20
18
21
19
static HOSTS : & [ & str ] = & [
22
20
"aarch64-apple-darwin" ,
@@ -200,29 +198,10 @@ struct Builder {
200
198
output : PathBuf ,
201
199
s3_address : String ,
202
200
date : String ,
203
-
204
- legacy : bool ,
205
- legacy_gpg_passphrase : String ,
206
201
}
207
202
208
203
fn 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" ) {
226
205
num. to_str ( ) . unwrap ( ) . parse ( ) . expect ( "invalid number for BUILD_MANIFEST_NUM_THREADS" )
227
206
} else {
228
207
num_cpus:: get ( )
@@ -239,13 +218,6 @@ fn main() {
239
218
let s3_address = args. next ( ) . unwrap ( ) ;
240
219
let channel = args. next ( ) . unwrap ( ) ;
241
220
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
-
249
221
Builder {
250
222
versions : Versions :: new ( & channel, & input) . unwrap ( ) ,
251
223
checksums : t ! ( Checksums :: new( ) ) ,
@@ -255,19 +227,13 @@ fn main() {
255
227
output,
256
228
s3_address,
257
229
date,
258
-
259
- legacy,
260
- legacy_gpg_passphrase : passphrase,
261
230
}
262
231
. build ( ) ;
263
232
}
264
233
265
234
impl Builder {
266
235
fn build ( & mut self ) {
267
236
self . check_toolstate ( ) ;
268
- if self . legacy {
269
- self . digest_and_sign ( ) ;
270
- }
271
237
let manifest = self . build_manifest ( ) ;
272
238
273
239
let channel = self . versions . channel ( ) . to_string ( ) ;
@@ -310,15 +276,6 @@ impl Builder {
310
276
}
311
277
}
312
278
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
-
322
279
fn build_manifest ( & mut self ) -> Manifest {
323
280
let mut manifest = Manifest {
324
281
manifest_version : "2" . to_string ( ) ,
@@ -584,51 +541,6 @@ impl Builder {
584
541
format ! ( "{}/{}/{}" , self . s3_address, self . date, file_name)
585
542
}
586
543
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
-
632
544
fn write_channel_files ( & mut self , channel_name : & str , manifest : & Manifest ) {
633
545
self . write ( & toml:: to_string ( & manifest) . unwrap ( ) , channel_name, ".toml" ) ;
634
546
self . write ( & manifest. date , channel_name, "-date.txt" ) ;
@@ -645,10 +557,6 @@ impl Builder {
645
557
646
558
let dst = self . output . join ( name) ;
647
559
t ! ( fs:: write( & dst, contents) ) ;
648
- if self . legacy {
649
- self . hash ( & dst) ;
650
- self . sign ( & dst) ;
651
- }
652
560
}
653
561
654
562
fn write_shipped_files ( & self , path : & Path ) {
0 commit comments