Skip to content

Commit 0749ad0

Browse files
committed
build-manifest: handle rust-src being target-independent
1 parent 73d9c24 commit 0749ad0

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/tools/build-manifest/src/versions.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ impl PkgType {
8888
PkgType::Other(_) => true,
8989
}
9090
}
91+
92+
/// Whether this package is target-independent or not.
93+
fn target_independent(&self) -> bool {
94+
*self == PkgType::RustSrc
95+
}
9196
}
9297

9398
#[derive(Debug, Default, Clone)]
@@ -198,15 +203,15 @@ impl Versions {
198203
package: &PkgType,
199204
target: &str,
200205
) -> 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+
}
210215
}
211216

212217
pub(crate) fn package_version(&mut self, package: &PkgType) -> Result<String, Error> {

0 commit comments

Comments
 (0)