summaryrefslogtreecommitdiff
path: root/lang/rust/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lang/rust/update.sh')
-rw-r--r--lang/rust/update.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/lang/rust/update.sh b/lang/rust/update.sh
new file mode 100644
index 000000000000..030ba5888a36
--- /dev/null
+++ b/lang/rust/update.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Requires: pkg install portfmt
+# Run in lang/rust
+set -eu
+
+get_commit() {
+ awk '
+$1 == "[pkg.rustc]" { pkg_rustc = 1 }
+pkg_rustc && $1 == "git_commit_hash" {
+ print substr($3, 2, 10)
+ exit
+}'
+}
+
+fetch -qo /tmp/channel-rust-stable.toml https://dev-static.rust-lang.org/dist/channel-rust-stable.toml
+version=$(</tmp/channel-rust-stable.toml awk '
+$1 == "[pkg.rustc]" { pkg_rustc = 1 }
+pkg_rustc && $1 == "version" {
+ print substr($3, 2, length($3) - 1)
+ exit
+}')
+new_commit=$(</tmp/channel-rust-stable.toml get_commit)
+rm /tmp/channel-rust-stable.toml
+
+fetch -qo - https://raw.githubusercontent.com/rust-lang/rust/${new_commit}/src/stage0.txt | awk '
+$1 == "date:" { date = $2 }
+$1 == "rustc:" { rustc = $2 }
+END { printf("BOOTSTRAPS_DATE=%s\nRUST_BOOTSTRAP_VERSION=%s\n", date, rustc) }' | portedit merge -i .
+
+sed -i '' -E -e "s,(\\$\\{RUST_DEFAULT\\}>=).*(:lang/\\$\\{RUST_DEFAULT\\}),\\1${version}\\2," \
+ ../../Mk/Uses/cargo.mk ../../Mk/bsd.gecko.mk
+
+portedit set-version -i "${version}" .
+make makesum
+portedit set-version -i "${version}" ../rust-bootstrap
+make -C ../rust-bootstrap makesum
+
+echo "lang/rust: Update to ${version}
+
+Changes: https://blog.rust-lang.org/FIXME/Rust-${version}.html
+PR: FIXME
+Exp-run by: antoine
+Differential Revision: FIXME" >rust.msg