2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-27 17:43:27 +00:00

yq: Fix path resolution for external targets

Signed-off-by: Ryan Northey <ryan@synca.io>
This commit is contained in:
Ryan Northey 2023-09-24 09:36:41 +01:00
parent b60dc04ed3
commit f3109f1ef0

View file

@ -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)
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),