Re: [PATCH v6 1/2] scripts: generate_rust_analyzer.py: add versioning infrastructure
From: Tamir Duberstein
Date: Mon May 04 2026 - 18:01:38 EST
On Mon, 04 May 2026 22:20:59 +0900, Jesung Yang <y.j3ms.n@xxxxxxxxx> wrote:
> diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> index d5f9a0ca742c..934698c7eb95 100755
> --- a/scripts/generate_rust_analyzer.py
> +++ b/scripts/generate_rust_analyzer.py
> @@ -343,6 +346,153 @@ def generate_crates(
> [ ... skip 46 lines ... ]
> + # git -C ./rust-analyzer describe --tags --abbrev=0 "$hash"
> + # )
> + #
> + # link_prefix="https://github.com/rust-lang/rust-analyzer/releases/tag"
> + # echo "$link_prefix/$tag_predates"
> + # ```
I think we talked about this being a bit more defensive with (at least)
set -eu. How's this?
#!/usr/bin/env bash
set -euo pipefail
RUST_VERSION=$1
grep_args=()
while IFS= read -r subject; do
grep_args+=(--grep "$subject")
done < <(git -C rust log \
--fixed-strings \
--format='%s' \
--grep 'Merge pull request #' \
--merges \
--no-follow \
-n 10 \
"$RUST_VERSION" \
-- src/tools/rust-analyzer
)
tag_predates=$(
git -C rust-analyzer log \
--fixed-strings \
--format='%(describe:tags,abbrev=0)' \
--merges \
-n 1 \
"${grep_args[@]}"
)
link_prefix="https://github.com/rust-lang/rust-analyzer/releases/tag"
echo "$link_prefix/$tag_predates"
Note I added `--merges` in the first `git log`, inlined `LOOKAHEAD` (and
reduced it to 10, now that it's only merge commits), and replaced piping
into grep with `--grep`. The second and third `git log` commands are
combined.
> [ ... skip 60 lines ... ]
> + return ra_version_output
> + except FileNotFoundError:
> + return None
> +
> +def map_ra_version_baseline(ra_version_output: str) -> RaVersionInfo:
> + baselines = reversed(RaVersionInfo)
This is an iterator but it's possible for both `version_match` and
`date_match` to use it, which means the latter will observe an empty
iterator.
--
Tamir Duberstein <tamird@xxxxxxxxxx>