mirror of
https://github.com/taiki-e/install-action
synced 2026-11-02 21:14:01 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06efa1629e | ||
|
|
682ce6c3c6 | ||
|
|
0d9077fcb6 | ||
|
|
ad358d449d | ||
|
|
353b306589 | ||
|
|
e1a0ce81ae | ||
|
|
2a3464cd4b | ||
|
|
5f1e428a2a | ||
|
|
96f9ee39b0 | ||
|
|
75d961f4a7 | ||
|
|
202fd96ad6 | ||
|
|
df5c3c0999 | ||
|
|
f371bdc125 | ||
|
|
e9605306a6 | ||
|
|
8bf69897ab |
+15
-2
@@ -10,13 +10,25 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.89.1] - 2026-11-02
|
||||
|
||||
- Install `ld.mold` symlink when installing `mold` on Linux. Previously, only `mold` binary was installed. ([#2050](https://github.com/taiki-e/install-action/pull/2050), thanks @FirelightFlagboy)
|
||||
|
||||
- Update `parse-dockerfile@latest` to 0.1.9.
|
||||
|
||||
- Update `parse-changelog@latest` to 0.6.18.
|
||||
|
||||
- Update `cargo-minimal-versions@latest` to 0.1.38.
|
||||
|
||||
- Update `cargo-hack@latest` to 0.6.46.
|
||||
|
||||
## [2.89.0] - 2026-11-01
|
||||
|
||||
- Support `yq`. ([#2036](https://github.com/taiki-e/install-action/pull/2036), thanks @FirelightFlagboy)
|
||||
|
||||
- Support `mold`. ([#2044](https://github.com/taiki-e/install-action/pull/2044), thanks @FirelightFlagboy)
|
||||
|
||||
- Fix an error when cargo-binstall had already been installed at non-standard location. ([#2048](https://github.com/taiki-e/install-action/pull/2048))
|
||||
- Fix an error when old cargo-binstall had already been installed at non-standard location. ([#2048](https://github.com/taiki-e/install-action/pull/2048))
|
||||
|
||||
- Update `wasm-tools@latest` to 1.263.0.
|
||||
|
||||
@@ -8000,7 +8012,8 @@ Note: This release is considered a breaking change because installing on version
|
||||
|
||||
Initial release
|
||||
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.89.0...HEAD
|
||||
[Unreleased]: https://github.com/taiki-e/install-action/compare/v2.89.1...HEAD
|
||||
[2.89.1]: https://github.com/taiki-e/install-action/compare/v2.89.0...v2.89.1
|
||||
[2.89.0]: https://github.com/taiki-e/install-action/compare/v2.88.1...v2.89.0
|
||||
[2.88.1]: https://github.com/taiki-e/install-action/compare/v2.88.0...v2.88.1
|
||||
[2.88.0]: https://github.com/taiki-e/install-action/compare/v2.87.33...v2.88.0
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ description: GitHub Action for installing development tools
|
||||
inputs:
|
||||
tool:
|
||||
description: Tools to install (whitespace or comma separated list)
|
||||
required: true
|
||||
# default: #publish:tool
|
||||
required: false
|
||||
default: cargo-deb
|
||||
checksum:
|
||||
description: Whether to enable checksums (strongly discouraged to disable)
|
||||
required: false
|
||||
|
||||
Generated
+26
@@ -23,6 +23,32 @@
|
||||
"latest": {
|
||||
"version": "0.12.0"
|
||||
},
|
||||
"0.13.0": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF38C509F31796",
|
||||
"hash": "0e9b2b30f68898177f1cb6f0ecbfa909a82479473a49a0ef66529fd088e3e410"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DF38C5070813E1",
|
||||
"hash": "4f33e0aac922606522fe5e4a3a23a5ed8083c3af50a05108301315e50b995502"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DF38C5085F5899",
|
||||
"hash": "74ee42748b969027ce3ab0a1f07c28316e3583f0e2597e0207bdd0f812bf71ad"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DF38C504C8AA07",
|
||||
"hash": "248e25f5c6a7242b054bd8f705470abb7a5a79b2b7c07df347c5d7049b783452"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DF38C503997128",
|
||||
"hash": "a4882533f5d423f8397ba431256d1cef45a3e13dbfc359decafee3800ee90e55"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DF38C503BB78FA",
|
||||
"hash": "105355bb079bd80bb9067a546dbb6f70e7b5df6eed1ef55f100ceaef019ee4c6"
|
||||
}
|
||||
},
|
||||
"0.12": {
|
||||
"version": "0.12.0"
|
||||
},
|
||||
|
||||
Generated
+2
-2
@@ -2,10 +2,10 @@
|
||||
"rust_crate": "cargo-hack",
|
||||
"template": null,
|
||||
"latest": {
|
||||
"version": "0.6.45"
|
||||
"version": "0.6.46"
|
||||
},
|
||||
"0.6": {
|
||||
"version": "0.6.45"
|
||||
"version": "0.6.46"
|
||||
},
|
||||
"0.6.46": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
Generated
+2
-2
@@ -30,10 +30,10 @@
|
||||
}
|
||||
},
|
||||
"latest": {
|
||||
"version": "0.1.37"
|
||||
"version": "0.1.38"
|
||||
},
|
||||
"0.1": {
|
||||
"version": "0.1.37"
|
||||
"version": "0.1.38"
|
||||
},
|
||||
"0.1.38": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
Generated
+26
@@ -23,6 +23,32 @@
|
||||
"latest": {
|
||||
"version": "1.2.2"
|
||||
},
|
||||
"2.0.0": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF38FCF3DD13D8",
|
||||
"hash": "6c59665faf1b14d0944391e6f2a1b510195e6be92c63060a9d1770ed00676824"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DF38FCF35490F8",
|
||||
"hash": "0ab8b29f659d159de78f70376c6ffa7730879f18fcde397567b683796eb5fd73"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DF38FCF3CEB5D7",
|
||||
"hash": "e4d974025ffb64c8017ab3dfca9b37023e607fb5a720cb65b441b834e269546f"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DF38FCF25652BB",
|
||||
"hash": "8c5ca4d1d4b6fc66e5175c8a1150e1daa85099080646322058d9083c72986bba"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DF38FCF26A606B",
|
||||
"hash": "b46139f7d42895c62962450886dd35f4554c17531209ea69b2db053d2a142bcb"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DF38FCF2537DAB",
|
||||
"hash": "dd6b3135f7949cb3132697b6ae4affcc50b15ca04f566872b576377394bfaccd"
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"version": "1.2.2"
|
||||
},
|
||||
|
||||
Generated
+8
-2
@@ -3,7 +3,10 @@
|
||||
"template": {
|
||||
"x86_64_linux_gnu": {
|
||||
"url": "https://github.com/rui314/mold/releases/download/v${version}/mold-${version}-x86_64-linux.tar.gz",
|
||||
"bin": "mold-${version}-x86_64-linux/bin/mold"
|
||||
"bin": [
|
||||
"mold-${version}-x86_64-linux/bin/mold",
|
||||
"mold-${version}-x86_64-linux/bin/ld.mold"
|
||||
]
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"url": "https://github.com/rui314/mold/releases/download/v${version}/mold-${version}-x86_64-windows.zip",
|
||||
@@ -11,7 +14,10 @@
|
||||
},
|
||||
"aarch64_linux_gnu": {
|
||||
"url": "https://github.com/rui314/mold/releases/download/v${version}/mold-${version}-aarch64-linux.tar.gz",
|
||||
"bin": "mold-${version}-aarch64-linux/bin/mold"
|
||||
"bin": [
|
||||
"mold-${version}-aarch64-linux/bin/mold",
|
||||
"mold-${version}-aarch64-linux/bin/ld.mold"
|
||||
]
|
||||
}
|
||||
},
|
||||
"latest": {
|
||||
|
||||
Generated
+2
-2
@@ -2,10 +2,10 @@
|
||||
"rust_crate": "parse-changelog",
|
||||
"template": null,
|
||||
"latest": {
|
||||
"version": "0.6.17"
|
||||
"version": "0.6.18"
|
||||
},
|
||||
"0.6": {
|
||||
"version": "0.6.17"
|
||||
"version": "0.6.18"
|
||||
},
|
||||
"0.6.18": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
Generated
+2
-2
@@ -30,10 +30,10 @@
|
||||
}
|
||||
},
|
||||
"latest": {
|
||||
"version": "0.1.8"
|
||||
"version": "0.1.9"
|
||||
},
|
||||
"0.1": {
|
||||
"version": "0.1.8"
|
||||
"version": "0.1.9"
|
||||
},
|
||||
"0.1.9": {
|
||||
"x86_64_linux_musl": {
|
||||
|
||||
Generated
+22
@@ -26,6 +26,28 @@
|
||||
"0.4": {
|
||||
"version": "0.4.2"
|
||||
},
|
||||
"0.4.3": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF38C42FA20D71",
|
||||
"hash": "4a4cfa92ea2abaee02b40daa596a95ca2725816a6a32cb03a8f48ddead287681"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DF38C4B1783498",
|
||||
"hash": "a8597928a5d9e326b3ebfc4b85ed2016ae9765347bc77f12a07ffd267de13eeb"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DF38C42AEBC2E3",
|
||||
"hash": "f9968983da816f30ad8423b5ce7ac93e1e305f913bab6c164b88fbeab434d7cb"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DF38C43E9873EF",
|
||||
"hash": "b2c6e636199c7fa9dae8838fbebb49cb99933908eb7dd67f25ec831bb38e1c52"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DF38C4D37A6A1E",
|
||||
"hash": "9177fa5651df1dd13f1825d9d051c426348e176b21357bfd308149dabd4321b1"
|
||||
}
|
||||
},
|
||||
"0.4.2": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF34007C56F413",
|
||||
|
||||
Generated
+34
@@ -40,6 +40,40 @@
|
||||
"1": {
|
||||
"version": "1.55.0"
|
||||
},
|
||||
"1.56.0": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF3901D6994151",
|
||||
"hash": "1c2493cfcf52d3367d6cb25780d9190c111c2219c34c820574c43e8bae15c528"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DF3901D6B61EBF",
|
||||
"hash": "ff37fb20e8d072e193cb659ecb932994ba2add772cbf86909c368fb95a630c50"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DF3901D6B8B3D4",
|
||||
"hash": "c4cd2846dc0128e29a947bc6f56e1e5ef01707275b0e58590fbe48105198661d"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DF3901D6C59F52",
|
||||
"hash": "ace61b9397ae28189c674ae332d67a8074dafd71e87724dfb8b22412d8253bb5"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DF3901D6A3BCD7",
|
||||
"hash": "c19b97a8c175ac7bd8105b8c8240ce740bf078333b12cc62ea49002c1b33e6e0"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DF3901D6998F29",
|
||||
"hash": "c235b06385f8b588ddc66b20a80117716ba0f8e584d59a7c186a3c6c8491b6fe"
|
||||
},
|
||||
"powerpc64le_linux_musl": {
|
||||
"etag": "0x8DF3901D6B1690C",
|
||||
"hash": "4f73890254bcb14c3ed082b372be839e27d52c08bfd950f82644c7aaf125c146"
|
||||
},
|
||||
"s390x_linux_musl": {
|
||||
"etag": "0x8DF3901D6AED3ED",
|
||||
"hash": "9f5a1cc59ecc6fd67cd919bf40d310d01012431c03b304be0ab077d0a8ca4b4d"
|
||||
}
|
||||
},
|
||||
"1.55": {
|
||||
"version": "1.55.0"
|
||||
},
|
||||
|
||||
Generated
+26
@@ -26,6 +26,32 @@
|
||||
"0.36": {
|
||||
"version": "0.36.1"
|
||||
},
|
||||
"0.36.2": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF386231B44435",
|
||||
"hash": "5736f27a806888f7ed89fba6bb8a3a00e5da895f1ad870f699b3018b7c8bcb0d"
|
||||
},
|
||||
"x86_64_macos": {
|
||||
"etag": "0x8DF386230ADB71F",
|
||||
"hash": "879cbc99179aebfa6c569e5e6672b60ed19647c15a9e948e3a644c97df69625a"
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"etag": "0x8DF386231B09ED0",
|
||||
"hash": "758578f69b265955e17d5288959b4d96f76c1eb96374841f7627c54b573e0377"
|
||||
},
|
||||
"aarch64_linux_musl": {
|
||||
"etag": "0x8DF386231EF7540",
|
||||
"hash": "751f3c6b8f1978deda3c1cec47cdafeeb150c29a9970267df8de26289a1c21c8"
|
||||
},
|
||||
"aarch64_macos": {
|
||||
"etag": "0x8DF3862309E85F7",
|
||||
"hash": "7fb1666195a8fe2075fd4fb4076831f1152ef8257dfe087d343e71f17a389688"
|
||||
},
|
||||
"aarch64_windows": {
|
||||
"etag": "0x8DF386230AA866C",
|
||||
"hash": "ae55bbfefd06c2be5b35f8732693e3e6604d55a5dc281bd61b47e8bb1d68ffa1"
|
||||
}
|
||||
},
|
||||
"0.36.1": {
|
||||
"x86_64_linux_musl": {
|
||||
"etag": "0x8DF36DBCA96DA32",
|
||||
|
||||
@@ -5,7 +5,6 @@ default-run = "generate-manifest"
|
||||
|
||||
[dependencies]
|
||||
install-action-manifest-schema = { path = "../manifest-schema" }
|
||||
anyhow = "1"
|
||||
flate2 = "1"
|
||||
fs-err = "3"
|
||||
jiff = { version = "0.2", default-features = false, features = ["std", "serde"] }
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
"platform": {
|
||||
"x86_64_linux_gnu": {
|
||||
"asset_name": "${package}-${version}-x86_64-linux.tar.gz",
|
||||
"bin": "${package}-${version}-x86_64-linux/bin/mold"
|
||||
"bin": [
|
||||
"${package}-${version}-x86_64-linux/bin/mold",
|
||||
"${package}-${version}-x86_64-linux/bin/ld.mold"
|
||||
]
|
||||
},
|
||||
"x86_64_windows": {
|
||||
"asset_name": "${package}-${version}-x86_64-windows.zip",
|
||||
@@ -14,7 +17,10 @@
|
||||
},
|
||||
"aarch64_linux_gnu": {
|
||||
"asset_name": "${package}-${version}-aarch64-linux.tar.gz",
|
||||
"bin": "${package}-${version}-aarch64-linux/bin/mold"
|
||||
"bin": [
|
||||
"${package}-${version}-aarch64-linux/bin/mold",
|
||||
"${package}-${version}-aarch64-linux/bin/ld.mold"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-28
@@ -14,7 +14,6 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use fs_err as fs;
|
||||
use install_action_internal_codegen::{
|
||||
BaseManifest, HostPlatform, Manifest, ManifestDownloadInfo, ManifestRef, ManifestTemplate,
|
||||
@@ -54,8 +53,7 @@ fn main() {
|
||||
let repo = base_info
|
||||
.repository
|
||||
.strip_prefix(GITHUB_START)
|
||||
.context("repository must start with https://github.com/")
|
||||
.unwrap();
|
||||
.expect("repository must start with https://github.com/");
|
||||
|
||||
eprintln!("downloading metadata from {GITHUB_API_START}repos/{repo}");
|
||||
|
||||
@@ -108,9 +106,7 @@ fn main() {
|
||||
base_info.rust_crate = base_info
|
||||
.rust_crate
|
||||
.as_ref()
|
||||
.map(|s| replace_vars(s, package, None, None, base_info.rust_crate.as_deref()))
|
||||
.transpose()
|
||||
.unwrap();
|
||||
.map(|s| replace_vars(s, package, None, None, base_info.rust_crate.as_deref()));
|
||||
if let Some(crate_name) = &base_info.rust_crate {
|
||||
eprintln!("downloading crate info from https://crates.io/api/v1/crates/{crate_name}");
|
||||
let info: crates_io::Crate =
|
||||
@@ -500,8 +496,7 @@ fn main() {
|
||||
.asset_name
|
||||
.as_ref()
|
||||
.or(base_info.asset_name.as_ref())
|
||||
.with_context(|| format!("asset_name is needed for {package} on {platform:?}"))
|
||||
.unwrap()
|
||||
.unwrap_or_else(|| panic!("asset_name is needed for {package} on {platform:?}"))
|
||||
.as_slice()
|
||||
.iter()
|
||||
.map(|asset_name| {
|
||||
@@ -513,8 +508,7 @@ fn main() {
|
||||
base_info.rust_crate.as_deref(),
|
||||
)
|
||||
})
|
||||
.collect::<Result<Vec<_>>>()
|
||||
.unwrap();
|
||||
.collect::<Vec<_>>();
|
||||
let (url, digest, asset_name) = match asset_names.iter().find_map(|asset_name| {
|
||||
release
|
||||
.assets
|
||||
@@ -536,7 +530,7 @@ fn main() {
|
||||
"{version}-{platform:?}-{}",
|
||||
Path::new(&url).file_name().unwrap().to_str().unwrap()
|
||||
));
|
||||
let response = download(&url).unwrap();
|
||||
let response = download(&url);
|
||||
let etag =
|
||||
response.header("etag").expect("binary should have an etag").replace('\"', "");
|
||||
|
||||
@@ -608,7 +602,7 @@ fn main() {
|
||||
eprintln!("already downloaded");
|
||||
minisign_verify::Signature::from_file(sig_download_cache).unwrap()
|
||||
} else {
|
||||
let buf = download(&url).unwrap().into_string().unwrap();
|
||||
let buf = download(&url).into_string().unwrap();
|
||||
eprintln!("download complete");
|
||||
fs::write(sig_download_cache, &buf).unwrap();
|
||||
minisign_verify::Signature::decode(&buf).unwrap()
|
||||
@@ -715,7 +709,6 @@ fn main() {
|
||||
Some(platform),
|
||||
base_info.rust_crate.as_deref(),
|
||||
)
|
||||
.unwrap()
|
||||
})
|
||||
}),
|
||||
),
|
||||
@@ -779,7 +772,7 @@ fn main() {
|
||||
|
||||
// update an existing manifests.json to avoid discarding work done in the event of a fetch error.
|
||||
if existing_manifest.is_some() && !version_req_given {
|
||||
write_manifests(manifest_path, &manifests.clone()).unwrap();
|
||||
write_manifests(manifest_path, &manifests.clone());
|
||||
eprintln!("wrote {} with incomplete data", manifest_path.display());
|
||||
}
|
||||
}
|
||||
@@ -939,25 +932,26 @@ fn main() {
|
||||
|
||||
manifests.rust_crate = base_info.rust_crate;
|
||||
|
||||
write_manifests(manifest_path, &manifests).unwrap();
|
||||
write_manifests(manifest_path, &manifests);
|
||||
eprintln!("wrote {}", manifest_path.display());
|
||||
}
|
||||
|
||||
fn write_manifests(manifest_path: &Path, manifests: &Manifests) -> Result<()> {
|
||||
let mut buf = serde_json::to_vec_pretty(&manifests)?;
|
||||
#[track_caller]
|
||||
fn write_manifests(manifest_path: &Path, manifests: &Manifests) {
|
||||
let mut buf = serde_json::to_vec_pretty(&manifests).unwrap();
|
||||
buf.push(b'\n');
|
||||
fs::write(manifest_path, buf)?;
|
||||
Ok(())
|
||||
fs::write(manifest_path, buf).unwrap();
|
||||
}
|
||||
|
||||
#[allow(clippy::literal_string_with_formatting_args)]
|
||||
#[track_caller]
|
||||
fn replace_vars(
|
||||
s: &str,
|
||||
package: &str,
|
||||
version: Option<&str>,
|
||||
platform: Option<HostPlatform>,
|
||||
rust_crate: Option<&str>,
|
||||
) -> Result<String> {
|
||||
) -> String {
|
||||
static RUST_SPECIFIC: &[(&str, fn(HostPlatform) -> &'static str)] = &[
|
||||
("${rust_target}", HostPlatform::rust_target),
|
||||
("${rust_target_arch}", HostPlatform::rust_target_arch),
|
||||
@@ -980,14 +974,14 @@ fn replace_vars(
|
||||
if s.contains('$') {
|
||||
for &(var, _) in RUST_SPECIFIC {
|
||||
if s.contains(var) {
|
||||
bail!(
|
||||
panic!(
|
||||
"base manifest for {package} refers {var}, but 'rust_crate' field is not set"
|
||||
);
|
||||
}
|
||||
}
|
||||
bail!("variable not fully replaced: '{s}'");
|
||||
panic!("variable not fully replaced: '{s}'");
|
||||
}
|
||||
Ok(s)
|
||||
s
|
||||
}
|
||||
|
||||
struct GitHubTokens {
|
||||
@@ -1035,7 +1029,8 @@ static GITHUB_TOKENS: LazyLock<GitHubTokens> = LazyLock::new(|| {
|
||||
}
|
||||
});
|
||||
|
||||
fn download(url: &str) -> Result<ureq::Response> {
|
||||
#[track_caller]
|
||||
fn download(url: &str) -> ureq::Response {
|
||||
let mut token = GITHUB_TOKENS.get(url);
|
||||
let mut retry = 0;
|
||||
let mut retry_time = 0;
|
||||
@@ -1056,7 +1051,7 @@ fn download(url: &str) -> Result<ureq::Response> {
|
||||
.set("X-GitHub-Api-Version", "2022-11-28");
|
||||
}
|
||||
match req.call() {
|
||||
Ok(res) => return Ok(res),
|
||||
Ok(res) => return res,
|
||||
Err(e) => last_error = Some(e),
|
||||
}
|
||||
retry_time += 1;
|
||||
@@ -1073,17 +1068,17 @@ fn download(url: &str) -> Result<ureq::Response> {
|
||||
eprintln!("download failed; retrying after {}s ({retry}/{max_retry})", retry_time * 2);
|
||||
std::thread::sleep(Duration::from_secs(retry_time * 2));
|
||||
}
|
||||
Err(last_error.unwrap().into())
|
||||
panic!("{}", last_error.unwrap())
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn download_to_buf(url: &str, buf: &mut Vec<u8>) {
|
||||
download(url).unwrap().into_reader().read_to_end(buf).unwrap();
|
||||
download(url).into_reader().read_to_end(buf).unwrap();
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn download_json<T: DeserializeOwned>(url: &str) -> T {
|
||||
download(url).unwrap().into_json().unwrap()
|
||||
download(url).into_json().unwrap()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
use std::{
|
||||
fmt, format,
|
||||
io::{Error, Result},
|
||||
process::{Command, ExitStatus, Output},
|
||||
str,
|
||||
string::{String, ToString as _},
|
||||
};
|
||||
|
||||
use anyhow::{Context as _, Error, Result};
|
||||
|
||||
macro_rules! cmd {
|
||||
($program:expr $(, $arg:expr)* $(,)?) => {{
|
||||
let mut _cmd = std::process::Command::new($program);
|
||||
@@ -55,8 +54,8 @@ impl ProcessBuilder {
|
||||
/// Executes a process, waiting for completion, and mapping non-zero exit
|
||||
/// status to an error.
|
||||
pub(crate) fn run(&mut self) -> Result<()> {
|
||||
let status = self.cmd.status().with_context(|| {
|
||||
process_error(format!("could not execute process {self}"), None, None)
|
||||
let status = self.cmd.status().map_err(|e| {
|
||||
process_error(format!("could not execute process {self}: {e}"), None, None)
|
||||
})?;
|
||||
if status.success() {
|
||||
Ok(())
|
||||
@@ -151,5 +150,5 @@ fn process_error(mut msg: String, status: Option<ExitStatus>, output: Option<&Ou
|
||||
}
|
||||
}
|
||||
|
||||
Error::msg(msg)
|
||||
Error::other(msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user