osbase/build: remove redundant platform_transition_binary rule

We have the aspect library in our dependencies anyway,
so there is no point in copying this.

Change-Id: I160a13a90dd45a0495670bd453a3aa0a16cfb771
Reviewed-on: https://review.monogon.dev/c/monogon/+/3674
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/cli/takeover/BUILD.bazel b/metropolis/cli/takeover/BUILD.bazel
index b3af473..d43d307 100644
--- a/metropolis/cli/takeover/BUILD.bazel
+++ b/metropolis/cli/takeover/BUILD.bazel
@@ -1,7 +1,7 @@
+load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_binary")
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 load("//build/static_binary_tarball:def.bzl", "static_binary_tarball")
 load("//osbase/build:def.bzl", "node_initramfs")
-load("//osbase/build:def.bzl", "platform_transition_binary")
 
 node_initramfs(
     name = "initramfs",
diff --git a/osbase/build/def.bzl b/osbase/build/def.bzl
index 8e9fcd9..af2562b 100644
--- a/osbase/build/def.bzl
+++ b/osbase/build/def.bzl
@@ -329,75 +329,3 @@
         ),
     },
 )
-
-# From Aspect's bazel-lib under Apache 2.0
-def _transition_platform_impl(_, attr):
-    return {"//command_line_option:platforms": str(attr.target_platform)}
-
-# Transition from any input configuration to one that includes the
-# --platforms command-line flag.
-_transition_platform = transition(
-    implementation = _transition_platform_impl,
-    inputs = [],
-    outputs = ["//command_line_option:platforms"],
-)
-
-
-def _platform_transition_binary_impl(ctx):
-    # We need to forward the DefaultInfo provider from the underlying rule.
-    # Unfortunately, we can't do this directly, because Bazel requires that the executable to run
-    # is actually generated by this rule, so we need to symlink to it, and generate a synthetic
-    # forwarding DefaultInfo.
-
-    result = []
-    binary = ctx.attr.binary[0]
-
-    default_info = binary[DefaultInfo]
-    files = default_info.files
-    new_executable = None
-    original_executable = default_info.files_to_run.executable
-    runfiles = default_info.default_runfiles
-
-    if not original_executable:
-        fail("Cannot transition a 'binary' that is not executable")
-
-    new_executable_name = ctx.attr.basename if ctx.attr.basename else original_executable.basename
-
-    # In order for the symlink to have the same basename as the original
-    # executable (important in the case of proto plugins), put it in a
-    # subdirectory named after the label to prevent collisions.
-    new_executable = ctx.actions.declare_file(paths.join(ctx.label.name, new_executable_name))
-    ctx.actions.symlink(
-        output = new_executable,
-        target_file = original_executable,
-        is_executable = True,
-    )
-    files = depset(direct = [new_executable], transitive = [files])
-    runfiles = runfiles.merge(ctx.runfiles([new_executable]))
-
-    result.append(
-        DefaultInfo(
-            files = files,
-            runfiles = runfiles,
-            executable = new_executable,
-        ),
-    )
-
-    return result
-
-platform_transition_binary = rule(
-    implementation = _platform_transition_binary_impl,
-    attrs = {
-        "basename": attr.string(),
-        "binary": attr.label(allow_files = True, cfg = _transition_platform),
-        "target_platform": attr.label(
-            doc = "The target platform to transition the binary.",
-            mandatory = True,
-        ),
-        "_allowlist_function_transition": attr.label(
-            default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
-        ),
-    },
-    executable = True,
-    doc = "Transitions the binary to use the provided platform.",
-)
\ No newline at end of file