@@ -88,6 +88,11 @@ impl PkgType {
88
88
PkgType :: Other ( _) => true ,
89
89
}
90
90
}
91
+
92
+ /// Whether this package is target-independent or not.
93
+ fn target_independent ( & self ) -> bool {
94
+ * self == PkgType :: RustSrc
95
+ }
91
96
}
92
97
93
98
#[ derive( Debug , Default , Clone ) ]
@@ -198,15 +203,15 @@ impl Versions {
198
203
package : & PkgType ,
199
204
target : & str ,
200
205
) -> Result < String , Error > {
201
- Ok ( format ! (
202
- "{}-{}-{}.tar.gz" ,
203
- package . tarball_component_name ( ) ,
204
- self . package_version ( package ) . with_context ( || format! (
205
- "failed to get the package version for component {:?}" ,
206
- package ,
207
- ) ) ? ,
208
- target
209
- ) )
206
+ let component_name = package . tarball_component_name ( ) ;
207
+ let version = self . package_version ( package ) . with_context ( || {
208
+ format ! ( "failed to get the package version for component {:?}" , package , )
209
+ } ) ? ;
210
+ if package. target_independent ( ) {
211
+ Ok ( format ! ( "{}-{}.tar.gz" , component_name , version ) )
212
+ } else {
213
+ Ok ( format ! ( "{}-{}-{}.tar.gz" , component_name , version , target) )
214
+ }
210
215
}
211
216
212
217
pub ( crate ) fn package_version ( & mut self , package : & PkgType ) -> Result < String , Error > {
0 commit comments