Skip to content

Commit 2a59135

Browse files
Auto merge of #149964 - Mark-Simulacrum:ci-channel, r=<try>
Write file with channel to S3
2 parents a6525d5 + e76556c commit 2a59135

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

src/bootstrap/src/lib.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,26 +1624,20 @@ impl Build {
16241624
self.release(&self.version)
16251625
}
16261626

1627-
/// Returns the "package version" for a component given the `num` release
1628-
/// number.
1627+
/// Returns the "package version" for a component.
16291628
///
16301629
/// The package version is typically what shows up in the names of tarballs.
1631-
/// For channels like beta/nightly it's just the channel name, otherwise
1632-
/// it's the `num` provided.
1633-
fn package_vers(&self, num: &str) -> String {
1630+
/// For channels like beta/nightly it's just the channel name, otherwise it's the release
1631+
/// version.
1632+
fn rust_package_vers(&self) -> String {
16341633
match &self.config.channel[..] {
1635-
"stable" => num.to_string(),
1634+
"stable" => self.version.to_string(),
16361635
"beta" => "beta".to_string(),
16371636
"nightly" => "nightly".to_string(),
1638-
_ => format!("{num}-dev"),
1637+
_ => format!("{}-dev", self.version),
16391638
}
16401639
}
16411640

1642-
/// Returns the value of `package_vers` above for Rust itself.
1643-
fn rust_package_vers(&self) -> String {
1644-
self.package_vers(&self.version)
1645-
}
1646-
16471641
/// Returns the `version` string associated with this compiler for Rust
16481642
/// itself.
16491643
///

src/ci/channel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly
1+
stable

src/ci/scripts/upload-artifacts.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
set -euo pipefail
77
IFS=$'\n\t'
88

9+
ci_dir=`cd $(dirname $0)/.. && pwd`
910
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
1011

1112
upload_dir="$(mktemp -d)"
@@ -22,6 +23,22 @@ if [[ "${DEPLOY-0}" -eq "1" ]] || [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then
2223
mv "${dist_dir}"/* "${upload_dir}"
2324
fi
2425

26+
# We write the release channel into the output so that
27+
# `rustup-toolchain-install-master` or other, similar, tools can automatically
28+
# detect the appropriate name to use for downloading artifacts.
29+
#
30+
# For nightly and beta this isn't strictly necessary as just trying both is
31+
# enough, but stable builds produce artifacts with a version (e.g.,
32+
# rust-src-1.92.0.tar.xz) which can't be easily guessed otherwise.
33+
channel=$(releaseChannel)
34+
if [[ "$channel" = "stable" ]]; then
35+
# On stable, artifacts use the version number. See rust_package_vers in
36+
# src/bootstrap/src/lib.rs.
37+
cat "$ci_dir/../version" > "${upload_dir}/package-version"
38+
else
39+
echo "$channel" > "${upload_dir}/package-version"
40+
fi
41+
2542
# CPU usage statistics.
2643
cp build/cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv"
2744

0 commit comments

Comments
 (0)