File tree 4 files changed +26
-1
lines changed
4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -669,3 +669,7 @@ changelog-seen = 2
669
669
670
670
# Whether to allow failures when building tools
671
671
#missing-tools = false
672
+
673
+ # List of compression formats to use when generating dist tarballs. The list of
674
+ # formats is provided to rust-installer, which must support all of them.
675
+ #compression-formats = ["gz", "xz"]
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ pub struct Config {
148
148
pub dist_sign_folder : Option < PathBuf > ,
149
149
pub dist_upload_addr : Option < String > ,
150
150
pub dist_gpg_password_file : Option < PathBuf > ,
151
+ pub dist_compression_formats : Option < Vec < String > > ,
151
152
152
153
// libstd features
153
154
pub backtrace : bool , // support for RUST_BACKTRACE
@@ -438,6 +439,7 @@ struct Dist {
438
439
upload_addr : Option < String > ,
439
440
src_tarball : Option < bool > ,
440
441
missing_tools : Option < bool > ,
442
+ compression_formats : Option < Vec < String > > ,
441
443
}
442
444
443
445
#[ derive( Deserialize ) ]
@@ -936,6 +938,7 @@ impl Config {
936
938
config. dist_sign_folder = t. sign_folder . map ( PathBuf :: from) ;
937
939
config. dist_gpg_password_file = t. gpg_password_file . map ( PathBuf :: from) ;
938
940
config. dist_upload_addr = t. upload_addr ;
941
+ config. dist_compression_formats = t. compression_formats ;
939
942
set ( & mut config. rust_dist_src , t. src_tarball ) ;
940
943
set ( & mut config. missing_tools , t. missing_tools ) ;
941
944
}
Original file line number Diff line number Diff line change @@ -147,6 +147,8 @@ def v(*args):
147
147
"experimental LLVM targets to build" )
148
148
v ("release-channel" , "rust.channel" , "the name of the release channel to build" )
149
149
v ("release-description" , "rust.description" , "optional descriptive string for version output" )
150
+ v ("dist-compression-formats" , None ,
151
+ "comma-separated list of compression formats to use" )
150
152
151
153
# Used on systems where "cc" is unavailable
152
154
v ("default-linker" , "rust.default-linker" , "the default linker" )
@@ -349,6 +351,8 @@ def set(key, value):
349
351
elif option .name == 'option-checking' :
350
352
# this was handled above
351
353
pass
354
+ elif option .name == 'dist-compression-formats' :
355
+ set ('dist.compression-formats' , value .split (',' ))
352
356
else :
353
357
raise RuntimeError ("unhandled option {}" .format (option .name ))
354
358
Original file line number Diff line number Diff line change @@ -288,11 +288,25 @@ impl<'a> Tarball<'a> {
288
288
289
289
build_cli ( & self , & mut cmd) ;
290
290
cmd. arg ( "--work-dir" ) . arg ( & self . temp_dir ) ;
291
+ if let Some ( formats) = & self . builder . config . dist_compression_formats {
292
+ assert ! ( !formats. is_empty( ) , "dist.compression-formats can't be empty" ) ;
293
+ cmd. arg ( "--compression-formats" ) . arg ( formats. join ( "," ) ) ;
294
+ }
291
295
self . builder . run ( & mut cmd) ;
292
296
if self . delete_temp_dir {
293
297
t ! ( std:: fs:: remove_dir_all( & self . temp_dir) ) ;
294
298
}
295
299
296
- crate :: dist:: distdir ( self . builder ) . join ( format ! ( "{}.tar.gz" , package_name) )
300
+ // Use either the first compression format defined, or "gz" as the default.
301
+ let ext = self
302
+ . builder
303
+ . config
304
+ . dist_compression_formats
305
+ . as_ref ( )
306
+ . and_then ( |formats| formats. get ( 0 ) )
307
+ . map ( |s| s. as_str ( ) )
308
+ . unwrap_or ( "gz" ) ;
309
+
310
+ crate :: dist:: distdir ( self . builder ) . join ( format ! ( "{}.tar.{}" , package_name, ext) )
297
311
}
298
312
}
You can’t perform that action at this time.
0 commit comments