diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs index 9f37b22c4941d..d949dff72798b 100644 --- a/src/tools/build-manifest/src/versions.rs +++ b/src/tools/build-manifest/src/versions.rs @@ -88,6 +88,11 @@ impl PkgType { PkgType::Other(_) => true, } } + + /// Whether this package is target-independent or not. + fn target_independent(&self) -> bool { + *self == PkgType::RustSrc + } } #[derive(Debug, Default, Clone)] @@ -198,15 +203,15 @@ impl Versions { package: &PkgType, target: &str, ) -> Result { - Ok(format!( - "{}-{}-{}.tar.gz", - package.tarball_component_name(), - self.package_version(package).with_context(|| format!( - "failed to get the package version for component {:?}", - package, - ))?, - target - )) + let component_name = package.tarball_component_name(); + let version = self.package_version(package).with_context(|| { + format!("failed to get the package version for component {:?}", package,) + })?; + if package.target_independent() { + Ok(format!("{}-{}.tar.gz", component_name, version)) + } else { + Ok(format!("{}-{}-{}.tar.gz", component_name, version, target)) + } } pub(crate) fn package_version(&mut self, package: &PkgType) -> Result {