Skip to content

Commit

Permalink
bazel: Patch aspect lib to resolve external build issue (#30453)
Browse files Browse the repository at this point in the history
bazel/patch: Patch aspect lib to resolve external build issue

upstream issue is bazel-contrib/bazel-lib#548
pr is: bazel-contrib/bazel-lib#547

Currently the websites and archive patch this indepenendently

This caused a breakage (in all 3) when aspect lib was updated

envoyproxy/envoy-website#368

This should prevent that until there is some upstream resolution

Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax authored Oct 24, 2023
1 parent b87d861 commit e2a509e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions bazel/aspect.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/lib/private/yq.bzl b/lib/private/yq.bzl
index 29ca3d7..c8cd5eb 100644
--- a/lib/private/yq.bzl
+++ b/lib/private/yq.bzl
@@ -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),
7 changes: 6 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ def envoy_dependencies(skip_targets = []):
patches = ["@envoy//bazel:rules_pkg.patch"],
)
external_http_archive("com_github_aignas_rules_shellcheck")
external_http_archive("aspect_bazel_lib")
external_http_archive(
"aspect_bazel_lib",
patch_args = ["-p1"],
patches = ["@envoy//bazel:aspect.patch"],
)

_com_github_fdio_vpp_vcl()

# Unconditional, since we use this only for compiler-agnostic fuzzing utils.
Expand Down

0 comments on commit e2a509e

Please sign in to comment.