rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

`remap_paths` in `pkg_tar` is not applied to `deps`

Open mering opened this issue 7 months ago • 1 comments

Reproduction example:

# 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

mering avatar May 28 '25 14:05 mering