Support rust

This commit is contained in:
Taiki Endo
2026-05-05 02:03:07 +09:00
parent a70acaa822
commit bbe1b9d5e1
8 changed files with 213 additions and 26 deletions

View File

@@ -48,6 +48,7 @@ glibc_pre_2_27_incompat=(
glibc_pre_2_17_incompat=(
"${glibc_pre_2_27_incompat[@]}"
deepsource # https://github.com/DeepSourceCorp/cli/issues/245
rust
)
musl_incompat=(
"${glibc_pre_2_17_incompat[@]}"
@@ -194,6 +195,19 @@ if [[ "${version}" != "latest" ]]; then
fi
# Not manifest-based
case "${runner}" in
# requires glibc 2.17 / musl 1.2
centos:6 | alpine:3.2) ;;
*)
case $((RANDOM % 5)) in
0) tools+=(rust) ;;
1) tools+=(rust@stable) ;;
2) tools+=(rust@nightly) ;;
3) tools+=(rust@1.93) ;;
4) tools+=(rust@1.93.0) ;;
esac
;;
esac
case "${host_os}" in
linux*)
# Installing snap to container is difficult...

View File

@@ -52,18 +52,32 @@ fn main() {
let mut paths: Vec<_> = fs::read_dir(&manifest_dir).unwrap().map(|r| r.unwrap()).collect();
paths.sort_by_key(fs_err::DirEntry::path);
let mut tools = vec![MarkdownEntry {
name: "valgrind".to_owned(),
alias: None,
website: "https://valgrind.org/".to_owned(),
installed_to: InstalledTo::Snap,
installed_from: InstalledFrom::Snap,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://sourceware.org/git/valgrind.git".to_owned(),
license_markdown:
"[GPL-2.0](https://sourceware.org/git/?p=valgrind.git;a=blob;f=COPYING;hb=HEAD)"
.to_owned(),
}];
let mut tools = vec![
MarkdownEntry {
name: "rust".to_owned(),
alias: None,
website: "https://rust-lang.org".to_owned(),
installed_to: InstalledTo::Cargo,
installed_from: InstalledFrom::Rustup,
platforms: Platforms { linux: true, macos: true, windows: true },
repository: "https://github.com/rust-lang/rust".to_owned(),
license_markdown:
"[Apache-2.0 OR MIT](https://github.com/rust-lang/rust/blob/main/COPYRIGHT)"
.to_owned(),
},
MarkdownEntry {
name: "valgrind".to_owned(),
alias: None,
website: "https://valgrind.org/".to_owned(),
installed_to: InstalledTo::Snap,
installed_from: InstalledFrom::Snap,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://sourceware.org/git/valgrind.git".to_owned(),
license_markdown:
"[GPL-2.0](https://sourceware.org/git/?p=valgrind.git;a=blob;f=COPYING;hb=HEAD)"
.to_owned(),
},
];
for path in paths {
let file_name = path.file_name();
@@ -153,6 +167,7 @@ struct MarkdownEntry {
#[derive(Debug, Eq, PartialEq)]
enum InstalledFrom {
GitHubRelease,
Rustup,
Snap,
}
@@ -215,6 +230,9 @@ impl fmt::Display for MarkdownEntry {
let markdown = format!("| [GitHub Releases]({}/releases) ", self.repository);
f.write_str(&markdown)?;
}
InstalledFrom::Rustup => {
f.write_str("| rustup ")?;
}
InstalledFrom::Snap => {
let markdown =
format!("| [snap](https://snapcraft.io/install/{}/ubuntu) ", self.name);

37
tools/rustup-hash.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0 OR MIT
set -CeEuo pipefail
IFS=$'\n\t'
trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR
cd -- "$(dirname -- "$0")"/..
# Get sha256 hash of rustup-init binaries
# NB: Synch with main.sh.
rustup_version=1.29.0
targets=(
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
powerpc64le-unknown-linux-gnu
powerpc64le-unknown-linux-musl
riscv64gc-unknown-linux-gnu
# riscv64gc-unknown-linux-musl # tier 2 without host tools
s390x-unknown-linux-gnu
# s390x-unknown-linux-musl # tier 3
x86_64-apple-darwin
aarch64-apple-darwin
x86_64-pc-windows-msvc
aarch64-pc-windows-msvc
)
for rust_target in "${targets[@]}"; do
exe=''
case "${rust_target}" in
*-windows*) exe=.exe ;;
esac
url="https://static.rust-lang.org/rustup/archive/${rustup_version}/${rust_target}/rustup-init${exe}.sha256"
printf '%s: ' "${rust_target}"
curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" | cut -d' ' -f1
done