aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2024-04-11 13:28:45 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-04-18 16:31:57 +0000
commit98826b0c2996fd795d5d991ed023d7846c5936a8 (patch)
tree0ad5a4ed15c8a48f22ac2c312ce84594cab6604b
parent08c5bbbf1b2069c520cbcb5660cd1c3fea2240ea (diff)
downloadtoolchain-utils-98826b0c2996fd795d5d991ed023d7846c5936a8.tar.gz
rust_tools: remove virtual/rust maintenance from rust_uprev.py
This will soon be maintained by the SDK builder instead: b/333764881 BUG=b:333764881 TEST=repo upload Cq-Depend: chromium:5448278, chromium:5448313 Change-Id: Iebc2aebee79d61a188cd030f4af41eb4583eaa8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5444020 Reviewed-by: Bob Haarman <inglorion@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
-rwxr-xr-xrust_tools/rust_uprev.py24
-rwxr-xr-xrust_tools/rust_uprev_test.py60
2 files changed, 0 insertions, 84 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py
index 9845c7c7..c35699e8 100755
--- a/rust_tools/rust_uprev.py
+++ b/rust_tools/rust_uprev.py
@@ -694,19 +694,6 @@ def update_rust_packages(
f.write(new_contents)
-def update_virtual_rust(
- template_version: RustVersion, new_version: RustVersion
-) -> None:
- template_ebuild = find_ebuild_path(
- EBUILD_PREFIX.joinpath("virtual/rust"), "rust", template_version
- )
- virtual_rust_dir = template_ebuild.parent
- new_name = f"rust-{new_version}.ebuild"
- new_ebuild = virtual_rust_dir.joinpath(new_name)
- shutil.copyfile(template_ebuild, new_ebuild)
- subprocess.check_call(["git", "add", new_name], cwd=virtual_rust_dir)
-
-
def unmerge_package_if_installed(pkgatom: str) -> None:
"""Unmerges a package if it is installed."""
shpkg = shlex.quote(pkgatom)
@@ -865,10 +852,6 @@ def create_rust_uprev(
"insert target version into rust packages",
lambda: update_rust_packages("dev-lang/rust", rust_version, add=True),
)
- run_step(
- "upgrade virtual/rust",
- lambda: update_virtual_rust(template_version, rust_version),
- )
def find_rust_versions() -> List[Tuple[RustVersion, Path]]:
@@ -1003,13 +986,6 @@ def remove_rust_uprev(
"dev-lang/rust-host", delete_version, add=False
),
)
- run_step("remove virtual/rust", lambda: remove_virtual_rust(delete_version))
-
-
-def remove_virtual_rust(delete_version: RustVersion) -> None:
- remove_ebuild_version(
- EBUILD_PREFIX.joinpath("virtual/rust"), "rust", delete_version
- )
def rust_bootstrap_path() -> Path:
diff --git a/rust_tools/rust_uprev_test.py b/rust_tools/rust_uprev_test.py
index a90f3d10..95156268 100755
--- a/rust_tools/rust_uprev_test.py
+++ b/rust_tools/rust_uprev_test.py
@@ -722,66 +722,6 @@ class RustUprevOtherStagesTests(unittest.TestCase):
cwd=new_ebuild.parent,
)
- @mock.patch.object(subprocess, "check_call")
- def test_remove_virtual_rust(self, mock_call):
- with tempfile.TemporaryDirectory() as tmpdir:
- ebuild_path = Path(
- tmpdir, f"virtual/rust/rust-{self.old_version}.ebuild"
- )
- os.makedirs(ebuild_path.parent)
- ebuild_path.touch()
- with mock.patch("rust_uprev.EBUILD_PREFIX", Path(tmpdir)):
- rust_uprev.remove_virtual_rust(self.old_version)
- mock_call.assert_called_once_with(
- ["git", "rm", str(ebuild_path.name)], cwd=ebuild_path.parent
- )
-
- @mock.patch.object(subprocess, "check_call")
- def test_remove_virtual_rust_with_symlink(self, mock_call):
- with tempfile.TemporaryDirectory() as tmpdir:
- ebuild_path = Path(
- tmpdir, f"virtual/rust/rust-{self.old_version}.ebuild"
- )
- symlink_path = Path(
- tmpdir, f"virtual/rust/rust-{self.old_version}-r14.ebuild"
- )
- os.makedirs(ebuild_path.parent)
- ebuild_path.touch()
- symlink_path.symlink_to(ebuild_path.name)
- with mock.patch("rust_uprev.EBUILD_PREFIX", Path(tmpdir)):
- rust_uprev.remove_virtual_rust(self.old_version)
- mock_call.assert_has_calls(
- [
- mock.call(
- ["git", "rm", ebuild_path.name],
- cwd=ebuild_path.parent,
- ),
- mock.call(
- ["git", "rm", symlink_path.name],
- cwd=ebuild_path.parent,
- ),
- ],
- any_order=True,
- )
-
- @mock.patch.object(rust_uprev, "find_ebuild_path")
- @mock.patch.object(shutil, "copyfile")
- @mock.patch.object(subprocess, "check_call")
- def test_update_virtual_rust(self, mock_call, mock_copy, mock_find_ebuild):
- ebuild_path = Path(
- f"/some/dir/virtual/rust/rust-{self.current_version}.ebuild"
- )
- mock_find_ebuild.return_value = Path(ebuild_path)
- rust_uprev.update_virtual_rust(self.current_version, self.new_version)
- mock_call.assert_called_once_with(
- ["git", "add", f"rust-{self.new_version}.ebuild"],
- cwd=ebuild_path.parent,
- )
- mock_copy.assert_called_once_with(
- ebuild_path.parent.joinpath(f"rust-{self.current_version}.ebuild"),
- ebuild_path.parent.joinpath(f"rust-{self.new_version}.ebuild"),
- )
-
@mock.patch("rust_uprev.find_rust_versions")
def test_find_oldest_rust_version_pass(self, rust_versions):
oldest_version_name = f"rust-{self.old_version}.ebuild"