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

[FR]: mtree_spec should support $(locations) expansions #653

Closed
thesayyn opened this issue Nov 14, 2023 · 1 comment
Closed

[FR]: mtree_spec should support $(locations) expansions #653

thesayyn opened this issue Nov 14, 2023 · 1 comment
Labels
enhancement New feature or request untriaged Requires traige

Comments

@thesayyn
Copy link
Collaborator

What is the current behavior?

Currently, there's no way to refer to generated files in tar(mtree=[]).

Describe the feature

Make this work;

tar(
    name = name, 
    srcs = [":content"],
    mtree = [
        "#mtree",
        "{} uid=0 gid=0 mode=0755 time=0 type=file content=$(location :content)".format(path.lstrip("/")),
    ],
    **common_kwargs
)
@thesayyn thesayyn added the enhancement New feature or request label Nov 14, 2023
@github-actions github-actions bot added the untriaged Requires traige label Nov 14, 2023
@gzm0
Copy link
Contributor

gzm0 commented Dec 15, 2023

Note that IIUC this is also necessary to be able to build tar from another repository:

This works when built in the main repository:

tar(
    name = "vite-config-tar",
    srcs = ["vite.config.js"], # just a source file
    mtree = [
        "app/vite.config.js uid=0 gid=0 mode=0755 type=file content=private/react_app/vite.config.js",
    ],
    visibility = ["//visibility:public"],
)

But fails when the target is built from another repository:

ERROR: /home/tos/.cache/bazel/_bazel_tos/9a3bb826a3e2f2e221c72da13796debf/external/dh_buildlib/private/react_app/BUILD.bazel:23:4: Tar external/dh_buildlib/private/react_app/vite-config-tar.tar failed: (Exit 1): bsdtar.sh failed: error executing command (from target @dh_buildlib//private/react_app:vite-config-tar) external/bsd_tar_linux_amd64/bsdtar.sh --create --file bazel-out/k8-fastbuild/bin/external/dh_buildlib/private/react_app/vite-config-tar.tar ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bsdtar: Error reading archive bazel-out/k8-fastbuild/bin/external/dh_buildlib/private/react_app/_vite-config-tar.mtree.txt: Can't open private/react_app/vite.config.js
bsdtar: Error exit delayed from previous errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

2 participants