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

pkg_zip: treeartifact input with REMOVE_BASE_DIRECTORY leads to extra "/" zip entry #927

Open
rbeasley-avgo opened this issue Jan 27, 2025 · 0 comments
Assignees
Labels
bug P2 An issue that should be worked on when time is available

Comments

@rbeasley-avgo
Copy link

Suppose the following (loosely ripped from tests/zip/BUILD):

load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "REMOVE_BASE_DIRECTORY")
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
# load("...:directory.bzl", "directory")  # something that creates a directory/treeartifact

pkg_zip(
  name = "test_zip_tree_remove_base_directory",
  srcs = [":generate_tree_remove_base_directory"],
)

pkg_files(
  name = "generate_tree_remove_base_directory",
  srcs = [":generate_tree"],
  renames = {":generate_tree": REMOVE_BASE_DIRECTORY},
)

directory(
  name = "generate_tree",
  ...
)

When built, the resulting archive contains a "/" entry:

$ zipinfo  -1 bazel-bin/tests/zip/test_zip_tree_remove_base_directory.zip
/
a/
a/a
a/b/
a/b/c
b/
b/c/
b/c/d
b/d
b/e

I believe this is a minor regression from #640 .

rbeasley-avgo added a commit to rbeasley-avgo/rules_pkg that referenced this issue Jan 27, 2025
This is just a quick fix to handle the special case of mapping a tree
artifact to the root of a zip archive.

Resolves bazelbuild#927.
@aiuto aiuto added bug P2 An issue that should be worked on when time is available labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug P2 An issue that should be worked on when time is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants