summaryrefslogtreecommitdiffstats
path: root/src/tools/build-manifest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /src/tools/build-manifest
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/build-manifest')
-rw-r--r--src/tools/build-manifest/Cargo.toml1
-rw-r--r--src/tools/build-manifest/src/main.rs2
-rw-r--r--src/tools/build-manifest/src/versions.rs28
3 files changed, 28 insertions, 3 deletions
diff --git a/src/tools/build-manifest/Cargo.toml b/src/tools/build-manifest/Cargo.toml
index c437bde5a..6c3b5bb00 100644
--- a/src/tools/build-manifest/Cargo.toml
+++ b/src/tools/build-manifest/Cargo.toml
@@ -9,6 +9,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0.32"
flate2 = "1.0.16"
+xz2 = "0.1.7"
tar = "0.4.29"
sha2 = "0.10.1"
rayon = "1.5.1"
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index 21dad9eb7..8b28c68e0 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -24,6 +24,7 @@ static HOSTS: &[&str] = &[
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu",
+ "loongarch64-unknown-linux-gnu",
"mips-unknown-linux-gnu",
"mips64-unknown-linux-gnuabi64",
"mips64el-unknown-linux-gnuabi64",
@@ -97,6 +98,7 @@ static TARGETS: &[&str] = &[
"i686-unknown-linux-gnu",
"i686-unknown-linux-musl",
"i686-unknown-uefi",
+ "loongarch64-unknown-linux-gnu",
"m68k-unknown-linux-gnu",
"mips-unknown-linux-gnu",
"mips-unknown-linux-musl",
diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs
index dde9745af..7a4c15d01 100644
--- a/src/tools/build-manifest/src/versions.rs
+++ b/src/tools/build-manifest/src/versions.rs
@@ -5,6 +5,7 @@ use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use tar::Archive;
+use xz2::read::XzDecoder;
const DEFAULT_TARGET: &str = "x86_64-unknown-linux-gnu";
@@ -175,9 +176,23 @@ impl Versions {
}
fn load_version_from_tarball(&mut self, package: &PkgType) -> Result<VersionInfo, Error> {
- let tarball_name = self.tarball_name(package, DEFAULT_TARGET)?;
- let tarball = self.dist_path.join(tarball_name);
+ for ext in ["xz", "gz"] {
+ let info =
+ self.load_version_from_tarball_inner(&self.dist_path.join(self.archive_name(
+ package,
+ DEFAULT_TARGET,
+ &format!("tar.{}", ext),
+ )?))?;
+ if info.present {
+ return Ok(info);
+ }
+ }
+
+ // If neither tarball is present, we fallback to returning the non-present info.
+ Ok(VersionInfo::default())
+ }
+ fn load_version_from_tarball_inner(&mut self, tarball: &Path) -> Result<VersionInfo, Error> {
let file = match File::open(&tarball) {
Ok(file) => file,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
@@ -187,7 +202,14 @@ impl Versions {
}
Err(err) => return Err(err.into()),
};
- let mut tar = Archive::new(GzDecoder::new(file));
+ let mut tar: Archive<Box<dyn std::io::Read>> =
+ Archive::new(if tarball.extension().map_or(false, |e| e == "gz") {
+ Box::new(GzDecoder::new(file))
+ } else if tarball.extension().map_or(false, |e| e == "xz") {
+ Box::new(XzDecoder::new(file))
+ } else {
+ unimplemented!("tarball extension not recognized: {}", tarball.display())
+ });
let mut version = None;
let mut git_commit = None;