diff options
author | Bob Haarman <inglorion@chromium.org> | 2024-01-25 19:20:52 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-02-01 00:17:31 +0000 |
commit | 7d31a04df666d131619cdafc42c30f8c4a6f63b6 (patch) | |
tree | b68366bff2be2eb76e4749b3f4602ddb3f0bc898 | |
parent | 36aedb0f1bdfec7dd0b9151b321c8c60f3bdc98c (diff) | |
download | toolchain-utils-7d31a04df666d131619cdafc42c30f8c4a6f63b6.tar.gz |
rust_uprev: remove update_manifest()
update_manifest() takes a path, which we then translate to a package
name, which we then look up in the filesystem to get the path to
the ebuild file. This change removes a level of indirection by
calling ebuild_actions() with the package name directly.
BUG=None
TEST=Create a rust uprev
Change-Id: I1b1651cc7d1fc735c353b55fa28c5766015e4829
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5255377
Tested-by: Bob Haarman <inglorion@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: Bob Haarman <inglorion@chromium.org>
-rwxr-xr-x | rust_tools/rust_uprev.py | 39 | ||||
-rwxr-xr-x | rust_tools/rust_uprev_test.py | 10 |
2 files changed, 11 insertions, 38 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index 9c0570c5..4ff8a4c9 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -498,7 +498,7 @@ def fetch_distfile_from_mirror(name: str) -> None: This ensures that the file exists on the mirror, and that we can read it. We overwrite any existing distfile - to ensure the checksums that update_manifest() records + to ensure the checksums that `ebuild manifest` records match the file as it exists on the mirror. This function also attempts to verify the ACL for @@ -693,12 +693,6 @@ def mirror_rust_source(version: RustVersion) -> None: ) -def update_manifest(ebuild_file: PathOrStr) -> None: - """Updates the MANIFEST for the ebuild at the given path.""" - ebuild = Path(ebuild_file) - ebuild_actions(ebuild.parent.name, ["manifest"]) - - def update_rust_packages( pkgatom: str, rust_version: RustVersion, add: bool ) -> None: @@ -854,11 +848,7 @@ def create_rust_uprev( ) run_step( "update bootstrap manifest", - lambda: update_manifest( - rust_bootstrap_path().joinpath( - f"rust-bootstrap-{template_version}.ebuild" - ) - ), + lambda: ebuild_actions("dev-lang/rust-bootstrap", ["manifest"]), ) run_step( "update bootstrap version", @@ -871,7 +861,7 @@ def create_rust_uprev( template_host_ebuild = EBUILD_PREFIX.joinpath( f"dev-lang/rust-host/rust-host-{template_version}.ebuild" ) - host_file = run_step( + run_step( "create host ebuild", lambda: create_ebuild( template_host_ebuild, "dev-lang/rust-host", rust_version @@ -879,15 +869,15 @@ def create_rust_uprev( ) run_step( "update host manifest to add new version", - lambda: update_manifest(Path(host_file)), + lambda: ebuild_actions("dev-lang/rust-host", ["manifest"]), ) - target_file = run_step( + run_step( "create target ebuild", lambda: create_ebuild(template_ebuild, "dev-lang/rust", rust_version), ) run_step( "update target manifest to add new version", - lambda: update_manifest(Path(target_file)), + lambda: ebuild_actions("dev-lang/rust", ["manifest"]), ) run_step( "generate profile data for rustc", @@ -908,12 +898,8 @@ def create_rust_uprev( lambda: set_include_profdata_src(CROS_RUSTC_ECLASS, include=True), ) run_step( - "update host manifest to add profile data", - lambda: update_manifest(Path(host_file)), - ) - run_step( - "update target manifest to add profile data", - lambda: update_manifest(Path(target_file)), + "update dev-lang/rust-artifacts manifest to add profile data", + lambda: ebuild_actions("dev-lang/rust-artifacts", ["manifest"]), ) if not skip_compile: run_step("build packages", lambda: rebuild_packages(rust_version)) @@ -1034,10 +1020,9 @@ def remove_rust_bootstrap_version( rust_bootstrap_path(), "rust-bootstrap", version ), ) - ebuild_file = find_ebuild_for_package("rust-bootstrap") run_step( "update bootstrap manifest to delete old version", - lambda: update_manifest(ebuild_file), + lambda: ebuild_actions("dev-lang/rust-bootstrap", ["manifest"]), ) @@ -1070,10 +1055,9 @@ def remove_rust_uprev( delete_version, ), ) - target_file = find_ebuild_for_package("rust") run_step( "update target manifest to delete old version", - lambda: update_manifest(target_file), + lambda: ebuild_actions("dev-lang/rust", ["manifest"]), ) run_step( "remove target version from rust packages", @@ -1081,10 +1065,9 @@ def remove_rust_uprev( "dev-lang/rust", delete_version, add=False ), ) - host_file = find_ebuild_for_package("rust-host") run_step( "update host manifest to delete old version", - lambda: update_manifest(host_file), + lambda: ebuild_actions("dev-lang/rust-host", ["manifest"]), ) run_step( "remove host version from rust packages", diff --git a/rust_tools/rust_uprev_test.py b/rust_tools/rust_uprev_test.py index 28903cd6..67adc3a4 100755 --- a/rust_tools/rust_uprev_test.py +++ b/rust_tools/rust_uprev_test.py @@ -638,16 +638,6 @@ BOOTSTRAP_VERSION="1.3.6" ) -class UpdateManifestTest(unittest.TestCase): - """Tests for update_manifest step in rust_uprev""" - - @mock.patch.object(rust_uprev, "ebuild_actions") - def test_update_manifest(self, mock_run): - ebuild_file = Path("/path/to/rust/rust-1.1.1.ebuild") - rust_uprev.update_manifest(ebuild_file) - mock_run.assert_called_once_with("rust", ["manifest"]) - - class UpdateBootstrapEbuildTest(unittest.TestCase): """Tests for rust_uprev.update_bootstrap_ebuild()""" |