diff options
author | Bob Haarman <inglorion@chromium.org> | 2024-01-24 23:58:09 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-01-25 03:18:36 +0000 |
commit | 7868f472843914a6bae785cdcb3cbc24b301f7f8 (patch) | |
tree | e041ffe8b2362cca235d58cbe957019975abd969 | |
parent | 1333c3072658ec89485529fbbf6eb7dde6f8791d (diff) | |
download | toolchain-utils-7868f472843914a6bae785cdcb3cbc24b301f7f8.tar.gz |
rust_uprev: make find_ebuild_for_rust_version() call find_ebuild_path()
Previously, find_ebuild_for_rust_version() enumerated all versions of
dev-lang/rust, then filtered them to only those that match the specified
version. Instead, call find_ebuild_path(), which finds the requested
version directly and also contains an implementation of the logic
that tests only one version exists and properly accounts for symlinks.
BUG=b:318424456
TEST=presubmit, use the new code to create a rust uprev
Change-Id: Id7a058cb58a94cfa8a208d92ba6fc24b6344a683
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5233111
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: Bob Haarman <inglorion@chromium.org>
Tested-by: Bob Haarman <inglorion@chromium.org>
Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
-rwxr-xr-x | rust_tools/rust_uprev.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index d3b445b9..9c0570c5 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -956,17 +956,8 @@ def find_oldest_rust_version() -> RustVersion: def find_ebuild_for_rust_version(version: RustVersion) -> Path: - rust_ebuilds = [ - ebuild for x, ebuild in find_rust_versions() if x == version - ] - if not rust_ebuilds: - raise ValueError(f"No Rust ebuilds found matching {version}") - if len(rust_ebuilds) > 1: - raise ValueError( - f"Multiple Rust ebuilds found matching {version}: " - f"{rust_ebuilds}" - ) - return rust_ebuilds[0] + """Returns the path of the ebuild for the given version of dev-lang/rust.""" + return find_ebuild_path(RUST_PATH, "rust", version) def rebuild_packages(version: RustVersion): |