Skip to content

Commit

Permalink
build-manifest: handle rust-src being target-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Sep 25, 2020
1 parent 73d9c24 commit 0749ad0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/tools/build-manifest/src/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -198,15 +203,15 @@ impl Versions {
package: &PkgType,
target: &str,
) -> Result<String, Error> {
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<String, Error> {
Expand Down

0 comments on commit 0749ad0

Please sign in to comment.