Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package_dir unexpectedly being stripped from files when it matches Bazel package name #905

Open
sloretz opened this issue Dec 6, 2024 · 0 comments

Comments

@sloretz
Copy link

sloretz commented Dec 6, 2024

Minimal reproducible example here: https://github.com/sloretz/rules_pkg_package_dir

Our codebase has a macro that calls pkg_tar with strip_prefix and package_dir set to hardcoded values, sort of like this:

load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

def macro_using_pkg_tar(name, srcs, **kwargs):
    pkg_tar(
        name = name,
        extension = "tar.gz",
        compressor_args = "--fast",
        strip_prefix = "/",
        package_dir = "/data",
        srcs = srcs,
        **kwargs
    )

If I call that macro in the Bazel package //tools then the file in the archive is put at data/tools/foo.txt. If I call the same macro in the Bazel package //data then the file in the archive is data/foo.txt with rules_pkg 1.0.1, and data/data/foo.txt with rules_pkg 0.9.1.

I expect the 0.9.1 behavior. Any ideas on workarounds to prevent package_dir from being stripped in 1.0.1?

Possibly caused by #749?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant