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

yq: Fix path resolution for external targets #547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/private/yq.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ def _yq_impl(ctx):

# For split operations, yq outputs files in the same directory so we
# must cd to the correct output dir before executing it
bin_dir = "/".join([ctx.bin_dir.path, ctx.label.package]) if ctx.label.package else ctx.bin_dir.path
bin_dir = ctx.bin_dir.path
if ctx.label.workspace_name:
bin_dir = "%s/external/%s" % (bin_dir, ctx.label.workspace_name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work with --nolegacy_external_runfiles.

bin_dir = "/".join([bin_dir, ctx.label.package]) if ctx.label.package else bin_dir
escape_bin_dir = _escape_path(bin_dir)
cmd = "cd {bin_dir} && {yq} {args} {eval_cmd} {expression} {sources} {maybe_out}".format(
bin_dir = ctx.bin_dir.path + "/" + ctx.label.package,
bin_dir = bin_dir,
yq = escape_bin_dir + yq_bin.path,
eval_cmd = "eval" if len(inputs) <= 1 else "eval-all",
args = " ".join(args),
Expand Down