|
3 | 3 | # following and inlining the target bytes. |
4 | 4 | # |
5 | 5 | # Forked from @tar.bzl//tar/private:preserve_symlinks.awk and tracking |
6 | | -# https://github.com/bazel-contrib/tar.bzl/pull/115. Two behavioural |
7 | | -# differences remain: |
| 6 | +# https://github.com/bazel-contrib/tar.bzl/pull/115. One behavioural |
| 7 | +# difference remains: |
8 | 8 | # |
9 | | -# 1. `bazel-out/` vs `external/` strip is exclusive (`if` / `else if`) |
10 | | -# rather than two sequential `sub`s. Without this, paths matching |
11 | | -# both regexes — e.g. `bazel-out/<cfg>/bin/external/<repo>/...`, |
12 | | -# the canonical shape of a generated wheel file — get |
13 | | -# over-stripped down to `external/<repo>/...`, miss the |
14 | | -# `symlink_map` lookup, and dangle inside the OCI layer. |
15 | | -# 2. Classified `bazel-out/` or `external/` targets NOT in the |
16 | | -# layer's mtree fall back to `type=file content=...` (bsdtar |
17 | | -# inlines the bytes) instead of being written as a dangling |
18 | | -# `type=link link=external/<repo>/...`. Exercised by py_venv's |
19 | | -# `_virtualenv.py` symlink into the rules_py source tree, which |
20 | | -# under bzlmod's `external/aspect_rules_py+/...` layout isn't a |
21 | | -# separate tar entry. |
| 9 | +# The `bazel-out/` vs `external/` strip is exclusive (`if` / `else if`) |
| 10 | +# rather than two sequential `sub`s. Without this, paths matching |
| 11 | +# both regexes — e.g. `bazel-out/<cfg>/bin/external/<repo>/...`, |
| 12 | +# the canonical shape of a generated wheel file — get |
| 13 | +# over-stripped down to `external/<repo>/...`, miss the |
| 14 | +# `symlink_map` lookup, and dangle inside the OCI layer. |
22 | 15 | # |
23 | | -# Send a follow-up PR to bazel-contrib/tar.bzl with both once #115 |
| 16 | +# Send a follow-up PR to bazel-contrib/tar.bzl once #115 |
24 | 17 | # lands so this fork can retire. |
25 | 18 | # |
26 | 19 | # Invoked from `_run_tar_action` in [py_image_layer.bzl](py_image_layer.bzl) |
@@ -180,16 +173,8 @@ END { |
180 | 173 | linked_to = make_relative_link(mapped_link, field0) |
181 | 174 | } else if (resolved_path ~ /^bazel-out\// || resolved_path ~ /^external\//) { |
182 | 175 | # Classified to a Bazel-tree path but the target row |
183 | | - # isn't in this layer's mtree. Slow path falls back to |
184 | | - # `type=file content=...` so bsdtar inlines the target |
185 | | - # bytes; the hot path has no equivalent (declared |
186 | | - # symlinks whose targets aren't in the layer are a |
187 | | - # config bug) so we emit a dangling `type=link link=...` |
188 | | - # to surface the issue visibly. |
189 | | - if (original_line ~ /type=file/) { |
190 | | - out_lines[++n] = original_line |
191 | | - continue |
192 | | - } |
| 176 | + # isn't in this layer's mtree — a config bug. Emit a |
| 177 | + # dangling `type=link link=...` to surface it visibly. |
193 | 178 | linked_to = resolved_path |
194 | 179 | } else { |
195 | 180 | # Already a relative path |
|
0 commit comments