bazelbuild / bazelbuild/rules_pkg
`remap_paths` in `pkg_tar` is not applied to `deps`
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Reproduction example:
```starlark
# BUILD.bazel
load("@rules_pkg//:pkg.bzl", "pkg_tar")
pkg_tar(
name = "pkg",
srcs = ["//foo:file.txt"], # results in bar/file.txt
remap_paths = {
"foo": "bar",
},
strip_prefix = "/",
deps = ["//foo"], # results in foo/file.txt
)
# foo/BUILD.bazel
load("@rules_pkg//:pkg.bzl", "pkg_tar")
exports_files(["file.txt"])
pkg_tar(
name = "foo",
srcs = [":file.txt"],
strip_prefix = "/",
visibility = ["//visibility:public"],
)
```
```
$ bazel build //:pkg.tar && tar tvf bazel-bin/pkg.tar
drwxr-xr-x 0/0 0 2000-01-01 00:00 bar/
-r-xr-xr-x 0/0 0 2000-01-01 00:00 bar/file.txt
drwxr-xr-x 0/0 0 2000-01-01 00:00 foo/
-r-xr-xr-x 0/0 0 2000-01-01 00:00 foo/file.txt
```
Contributor guide
Research direction
Start by running the BUILD.bazel reproduction with `bazel build //:pkg.tar` and inspecting the `pkg_tar` implementation loaded from `@rules_pkg//:pkg.bzl`. Compare how `srcs` and `deps` are mapped into the archive. Done means the dependency file follows `remap_paths` and the resulting tar contains `bar/file.txt` rather than an additional `foo/file.txt`.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100