-
Notifications
You must be signed in to change notification settings - Fork 217
prefix-stripped directory artifacts end up with two versions, with and without leading . #676
Copy link
Copy link
Closed
Labels
P2An issue that should be worked on when time is availableAn issue that should be worked on when time is availablebug
Description
For this BUILD.bazel file making a tar of a directory artifact:
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("//:rules.bzl", "make_directory")
# Makes a single file in nested directories: dir-dir/subdir/file
make_directory(
name = "dir",
)
# Should contain `./subdir/file`
pkg_tar(
name = "tar",
srcs = [":dir"],
strip_prefix = "dir-dir",
)With this simple directory-creating rule:
def _impl(ctx):
d = ctx.actions.declare_directory("%s-dir" % ctx.attr.name, sibling = None)
ctx.actions.run_shell(
outputs = [d],
command = "mkdir -p $1/subdir && touch $1/subdir/file",
arguments = [d.path],
)
return [DefaultInfo(files = depset([d]))]
make_directory = rule(
implementation = _impl,
)I expect to see just ./subdir/ and ./subdir/file in the tar, but instead have both subdir/ and ./subdir as well as ./subdir/file:
% bazel build :tar
INFO: Invocation ID: 8045b9ca-4244-4714-a1c2-6520e6d6fdf6
INFO: Analyzed target //:tar (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:tar up-to-date:
bazel-bin/tar.tar
INFO: Elapsed time: 0.135s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
% tar tvf bazel-bin/tar.tar
drwxr-xr-x 0 0 0 0 1 Jan 2000 subdir/
drwxr-xr-x 0 0 0 0 1 Jan 2000 ./subdir/
-r-xr-xr-x 0 0 0 0 1 Jan 2000 ./subdir/fileReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2An issue that should be worked on when time is availableAn issue that should be worked on when time is availablebug