rust_uprev: remove the `copy patches` step
Patches no longer have rust's version in them, so we can safely skip
this step now.
BUG=b:266817148
TEST=Unittests
Change-Id: Ib54b2607f25eed5808cd6c544acc5ca3ce3a12f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4295527
Tested-by: George Burgess <gbiv@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Reviewed-by: Bob Haarman <inglorion@chromium.org>
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py
index 382d991..5bcb527 100755
--- a/rust_tools/rust_uprev.py
+++ b/rust_tools/rust_uprev.py
@@ -332,27 +332,6 @@
return template_version, ebuild_path, bootstrap_version
-def copy_patches(
- directory: Path, template_version: RustVersion, new_version: RustVersion
-) -> None:
- patch_path = directory / "files"
- prefix = "%s-%s-" % (directory.name, template_version)
- new_prefix = "%s-%s-" % (directory.name, new_version)
- for f in os.listdir(patch_path):
- if not f.startswith(prefix):
- continue
- logging.info("Copy patch %s to new version", f)
- new_name = f.replace(str(template_version), str(new_version))
- shutil.copyfile(
- os.path.join(patch_path, f),
- os.path.join(patch_path, new_name),
- )
-
- subprocess.check_call(
- ["git", "add", f"{new_prefix}*.patch"], cwd=patch_path
- )
-
-
def create_ebuild(
template_ebuild: str, pkgatom: str, new_version: RustVersion
) -> str:
@@ -648,10 +627,6 @@
EBUILD_PREFIX.joinpath("eclass/cros-rustc.eclass"), template_version
),
)
- run_step(
- "copy patches",
- lambda: copy_patches(RUST_PATH, template_version, rust_version),
- )
template_host_ebuild = EBUILD_PREFIX.joinpath(
f"dev-lang/rust-host/rust-host-{template_version}.ebuild"
)
diff --git a/rust_tools/rust_uprev_test.py b/rust_tools/rust_uprev_test.py
index 0c4c91e..c8ceeb7 100755
--- a/rust_tools/rust_uprev_test.py
+++ b/rust_tools/rust_uprev_test.py
@@ -471,52 +471,6 @@
)
@mock.patch.object(shutil, "copyfile")
- @mock.patch.object(os, "listdir")
- @mock.patch.object(subprocess, "check_call")
- def test_copy_patches(self, mock_call, mock_ls, mock_copy):
- mock_ls.return_value = [
- f"rust-{self.old_version}-patch-1.patch",
- f"rust-{self.old_version}-patch-2-old.patch",
- f"rust-{self.current_version}-patch-1.patch",
- f"rust-{self.current_version}-patch-2-new.patch",
- ]
- rust_uprev.copy_patches(
- rust_uprev.RUST_PATH, self.current_version, self.new_version
- )
- mock_copy.assert_has_calls(
- [
- mock.call(
- os.path.join(
- rust_uprev.RUST_PATH,
- "files",
- f"rust-{self.current_version}-patch-1.patch",
- ),
- os.path.join(
- rust_uprev.RUST_PATH,
- "files",
- f"rust-{self.new_version}-patch-1.patch",
- ),
- ),
- mock.call(
- os.path.join(
- rust_uprev.RUST_PATH,
- "files",
- f"rust-{self.current_version}-patch-2-new.patch",
- ),
- os.path.join(
- rust_uprev.RUST_PATH,
- "files",
- f"rust-{self.new_version}-patch-2-new.patch",
- ),
- ),
- ]
- )
- mock_call.assert_called_once_with(
- ["git", "add", f"rust-{self.new_version}-*.patch"],
- cwd=rust_uprev.RUST_PATH.joinpath("files"),
- )
-
- @mock.patch.object(shutil, "copyfile")
@mock.patch.object(subprocess, "check_call")
def test_create_rust_ebuild(self, mock_call, mock_copy):
template_ebuild = f"/path/to/rust-{self.current_version}-r2.ebuild"