@@ -84,7 +84,7 @@ pub(crate) struct Tarball<'a> {
84
84
85
85
pkgname : String ,
86
86
component : String ,
87
- target : String ,
87
+ target : Option < String > ,
88
88
product_name : String ,
89
89
overlay : OverlayKind ,
90
90
@@ -99,6 +99,14 @@ pub(crate) struct Tarball<'a> {
99
99
100
100
impl < ' a > Tarball < ' a > {
101
101
pub ( crate ) fn new ( builder : & ' a Builder < ' a > , component : & str , target : & str ) -> Self {
102
+ Self :: new_inner ( builder, component, Some ( target. into ( ) ) )
103
+ }
104
+
105
+ pub ( crate ) fn new_targetless ( builder : & ' a Builder < ' a > , component : & str ) -> Self {
106
+ Self :: new_inner ( builder, component, None )
107
+ }
108
+
109
+ fn new_inner ( builder : & ' a Builder < ' a > , component : & str , target : Option < String > ) -> Self {
102
110
let pkgname = crate :: dist:: pkgname ( builder, component) ;
103
111
104
112
let temp_dir = builder. out . join ( "tmp" ) . join ( "tarball" ) . join ( component) ;
@@ -113,7 +121,7 @@ impl<'a> Tarball<'a> {
113
121
114
122
pkgname,
115
123
component : component. into ( ) ,
116
- target : target . into ( ) ,
124
+ target,
117
125
product_name : "Rust" . into ( ) ,
118
126
overlay : OverlayKind :: Rust ,
119
127
@@ -197,7 +205,14 @@ impl<'a> Tarball<'a> {
197
205
198
206
let mut cmd = self . builder . tool_cmd ( crate :: tool:: Tool :: RustInstaller ) ;
199
207
200
- self . builder . info ( & format ! ( "Dist {} ({})" , self . component, self . target) ) ;
208
+ let package_name = if let Some ( target) = & self . target {
209
+ self . builder . info ( & format ! ( "Dist {} ({})" , self . component, target) ) ;
210
+ format ! ( "{}-{}" , self . pkgname, target)
211
+ } else {
212
+ self . builder . info ( & format ! ( "Dist {}" , self . component) ) ;
213
+ self . pkgname . clone ( )
214
+ } ;
215
+
201
216
let _time = crate :: util:: timeit ( self . builder ) ;
202
217
203
218
let mut component_name = self . component . clone ( ) ;
@@ -206,7 +221,11 @@ impl<'a> Tarball<'a> {
206
221
}
207
222
if self . include_target_in_component_name {
208
223
component_name. push ( '-' ) ;
209
- component_name. push_str ( & self . target ) ;
224
+ component_name. push_str (
225
+ & self
226
+ . target
227
+ . expect ( "include_target_in_component_name used in a targetless tarball" ) ,
228
+ ) ;
210
229
}
211
230
212
231
let distdir = crate :: dist:: distdir ( self . builder ) ;
@@ -222,12 +241,12 @@ impl<'a> Tarball<'a> {
222
241
. arg ( & distdir)
223
242
. arg ( "--non-installed-overlay" )
224
243
. arg ( self . overlay_dir )
225
- . arg ( format ! ( "--package-name={}-{} " , self . pkgname , self . target ) )
244
+ . arg ( format ! ( "--package-name={}" , package_name ) )
226
245
. arg ( "--legacy-manifest-dirs=rustlib,cargo" )
227
246
. arg ( format ! ( "--component-name={}" , component_name) ) ;
228
247
self . builder . run ( & mut cmd) ;
229
248
t ! ( std:: fs:: remove_dir_all( & self . temp_dir) ) ;
230
249
231
- distdir. join ( format ! ( "{}-{} .tar.gz" , self . pkgname , self . target ) )
250
+ distdir. join ( format ! ( "{}.tar.gz" , package_name ) )
232
251
}
233
252
}
0 commit comments