|
| 1 | +From d10473f4ac89c23dcd8ea02488b28a649f4a9735 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Markus Rudy < [email protected]> |
| 3 | +Date: Tue, 6 Aug 2024 11:33:29 +0200 |
| 4 | +Subject: [PATCH] disable Windows support |
| 5 | + |
| 6 | +It's broken and we don't need it, see |
| 7 | +https://github.com/bazel-contrib/rules_oci/issues/420. |
| 8 | +--- |
| 9 | + oci/private/image.bzl | 9 --------- |
| 10 | + oci/private/util.bzl | 29 +---------------------------- |
| 11 | + 2 files changed, 1 insertion(+), 37 deletions(-) |
| 12 | + |
| 13 | +diff --git a/oci/private/image.bzl b/oci/private/image.bzl |
| 14 | +index e8a6ca5..434947c 100644 |
| 15 | +--- a/oci/private/image.bzl |
| 16 | ++++ b/oci/private/image.bzl |
| 17 | +@@ -226,15 +226,6 @@ def _oci_image_impl(ctx): |
| 18 | + |
| 19 | + action_env = {} |
| 20 | + |
| 21 | +- # Windows: Don't convert arguments like --entrypoint=/some/bin to --entrypoint=C:/msys64/some/bin |
| 22 | +- if ctx.target_platform_has_constraint(ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]): |
| 23 | +- # See https://www.msys2.org/wiki/Porting/: |
| 24 | +- # > Setting MSYS2_ARG_CONV_EXCL=* prevents any path transformation. |
| 25 | +- action_env["MSYS2_ARG_CONV_EXCL"] = "*" |
| 26 | +- |
| 27 | +- # This one is for Windows Git MSys |
| 28 | +- action_env["MSYS_NO_PATHCONV"] = "1" |
| 29 | +- |
| 30 | + ctx.actions.run( |
| 31 | + inputs = depset(inputs, transitive = transitive_inputs), |
| 32 | + arguments = [args], |
| 33 | +diff --git a/oci/private/util.bzl b/oci/private/util.bzl |
| 34 | +index 7c2a2c2..479ca7d 100644 |
| 35 | +--- a/oci/private/util.bzl |
| 36 | ++++ b/oci/private/util.bzl |
| 37 | +@@ -141,34 +141,7 @@ def _maybe_wrap_launcher_for_windows(ctx, bash_launcher): |
| 38 | + - make sure the bash_launcher is in the inputs to the action |
| 39 | + - @bazel_tools//tools/sh:toolchain_type should appear in the rules toolchains |
| 40 | + """ |
| 41 | +- if not ctx.target_platform_has_constraint(ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]): |
| 42 | +- return bash_launcher |
| 43 | +- |
| 44 | +- win_launcher = ctx.actions.declare_file("wrap_%s.bat" % ctx.label.name) |
| 45 | +- ctx.actions.write( |
| 46 | +- output = win_launcher, |
| 47 | +- content = r"""@echo off |
| 48 | +-SETLOCAL ENABLEEXTENSIONS |
| 49 | +-SETLOCAL ENABLEDELAYEDEXPANSION |
| 50 | +-for %%a in ("{bash_bin}") do set "bash_bin_dir=%%~dpa" |
| 51 | +-set PATH=%bash_bin_dir%;%PATH% |
| 52 | +-set "parent_dir=%~dp0" |
| 53 | +-set "parent_dir=!parent_dir:\=/!" |
| 54 | +-set args=%* |
| 55 | +-rem Escape \ and * in args before passing it with double quote |
| 56 | +-if defined args ( |
| 57 | +- set args=!args:\=\\\\! |
| 58 | +- set args=!args:"=\"! |
| 59 | +-) |
| 60 | +-"{bash_bin}" -c "%parent_dir%{launcher} !args!" |
| 61 | +-""".format( |
| 62 | +- bash_bin = ctx.toolchains["@bazel_tools//tools/sh:toolchain_type"].path, |
| 63 | +- launcher = paths.relativize(bash_launcher.path, win_launcher.dirname), |
| 64 | +- ), |
| 65 | +- is_executable = True, |
| 66 | +- ) |
| 67 | +- |
| 68 | +- return win_launcher |
| 69 | ++ return bash_launcher |
| 70 | + |
| 71 | + def _file_exists(rctx, path): |
| 72 | + result = rctx.execute(["stat", path]) |
| 73 | +-- |
| 74 | +2.46.0 |
| 75 | + |
0 commit comments