diff options
author | Klaus Aehlig <aehlig@google.com> | 2018-01-16 04:51:20 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-16 04:53:17 -0800 |
commit | 0350ad30e80d5a5eb33362e304be7e2235d05114 (patch) | |
tree | 925e176481a97665873a617ff39147ebceb6a4f3 /tools | |
parent | 0819f73a4065fe7e87f665bb3806610c224dfadb (diff) |
http_archive: support programmatic patching
Support applying a sequence of commands to an http_archive,
after the patch files are applied. In this way, tasks like
shebang-fixes can easily be added.
Fixes #3395.
Change-Id: Ifdad584a852efd425c436d57ef71a0d681488629
PiperOrigin-RevId: 182037265
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/repo/http.bzl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/build_defs/repo/http.bzl b/tools/build_defs/repo/http.bzl index 79732bccc0..5a2e813e21 100644 --- a/tools/build_defs/repo/http.bzl +++ b/tools/build_defs/repo/http.bzl @@ -39,6 +39,11 @@ def _patch(ctx): st = ctx.execute([bash_exe, "-c", command]) if st.return_code: fail("Error applying patch %s:\n%s" % (str(patchfile), st.stderr)) + for cmd in ctx.attr.patch_cmds: + st = ctx.execute([bash_exe, "-c", cmd]) + if st.return_code: + fail("Error applying patch command %s:\n%s%s" + % (cmd, st.stdout, st.stderr)) def _http_archive_impl(ctx): """Implementation of the http_archive rule.""" @@ -82,6 +87,7 @@ _http_archive_attrs = { "build_file_content": attr.string(), "patches": attr.label_list(default=[]), "patch_tool": attr.string(default="patch"), + "patch_cmds": attr.string_list(default=[]), } @@ -187,6 +193,7 @@ Args: patches: A list of files that are to be applied as patches after extracting the archive. patch_tool: the patch(1) utility to use. + patch_cmds: sequence of commands to be applied after patches are applied. """ |