mirror of
https://github.com/rust-lang/book.git
synced 2026-07-16 15:18:30 -04:00
infra: rewrite rustup toolchain paths in update-rustc.sh
As with project paths, we do not want these to have the paths from the user who runs `update-rustc.sh`, but some totally generic path.
This commit is contained in:
@@ -8,8 +8,9 @@ echo 'Building book dependencies in tmp/packages...'
|
||||
mkdir -p tmp/packages
|
||||
cp -r packages/trpl tmp/packages/trpl
|
||||
cd tmp/packages/trpl
|
||||
cargo clean > /dev/null
|
||||
cargo build > /dev/null
|
||||
# hide the output; if it fails, debug then.
|
||||
cargo clean > /dev/null 2>&1
|
||||
cargo build > /dev/null 2>&1
|
||||
cd - > /dev/null
|
||||
|
||||
# Build the book before making any changes for comparison of the output.
|
||||
@@ -73,6 +74,16 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do
|
||||
# instead of a path to the computer of whoever is running this
|
||||
sed -i '' -E -e 's@(Compiling|Checking) ([^\)]*) v0.1.0 (.*)@\1 \2 v0.1.0 (file:///projects/\2)@' "${full_output_path}"
|
||||
|
||||
# Likewise, use a "default" installation directory for rustup's install
|
||||
# location so the version of the source is not a path on the computer of
|
||||
# whoever is doing the update. This does two substitutions:
|
||||
#
|
||||
# - Replaces the path up to `.rustup/toolchains` with `file:///home`, while
|
||||
# preserving leading spaces and the `-->`.
|
||||
# - Replaces the version-and-architecture-tripl with just the version, so
|
||||
# e.g. `1.82-aarch64-apple-darwin` becomes `1.82`.
|
||||
sed -i '' -E -e 's@^([[:space:]]*-->[[:space:]]+).*(\.rustup/toolchains/[[:digit:]]+\.[[:digit:]]+)([^/]*)@\1file:///home/\2@' "${full_output_path}"
|
||||
|
||||
# Restore the previous compile time, if there is one
|
||||
if [ -n "${compile_time}" ]; then
|
||||
sed -i '' -E -e "s/Finished \`(dev|test)\` profile \[unoptimized \+ debuginfo] target\(s\) in [0-9.]*/Finished \`\1\` profile [unoptimized + debuginfo] target(s) in ${compile_time}/" "${full_output_path}"
|
||||
|
||||
Reference in New Issue
Block a user