Copy rather than symlink rabbitmqctl in bazel
when creating rabbitmq home folders
This commit is contained in:
parent
31dffe78a7
commit
9e6d66ee5e
5
dist.bzl
5
dist.bzl
|
@ -11,9 +11,8 @@ load("@rules_erlang//:source_tree.bzl", "source_tree")
|
|||
load(
|
||||
":rabbitmq_home.bzl",
|
||||
"RABBITMQ_HOME_ATTRS",
|
||||
"RabbitmqHomeInfo",
|
||||
"copy_escript",
|
||||
"flatten",
|
||||
"link_escript",
|
||||
)
|
||||
load(
|
||||
":rabbitmq.bzl",
|
||||
|
@ -77,7 +76,7 @@ def _sbin_dir_private_impl(ctx):
|
|||
]
|
||||
|
||||
def _escript_dir_private_impl(ctx):
|
||||
escripts = [link_escript(ctx, escript) for escript in ctx.files._scripts]
|
||||
escripts = [copy_escript(ctx, escript) for escript in ctx.files._scripts]
|
||||
|
||||
return [
|
||||
DefaultInfo(
|
||||
|
|
|
@ -10,22 +10,29 @@ RabbitmqHomeInfo = provider(
|
|||
)
|
||||
|
||||
def _copy_script(ctx, script):
|
||||
dest = ctx.actions.declare_file(path_join(ctx.label.name, "sbin", script.basename))
|
||||
dest = ctx.actions.declare_file(
|
||||
path_join(ctx.label.name, "sbin", script.basename),
|
||||
)
|
||||
ctx.actions.expand_template(
|
||||
template = script,
|
||||
output = dest,
|
||||
substitutions = {},
|
||||
is_executable = True,
|
||||
)
|
||||
return dest
|
||||
|
||||
def link_escript(ctx, escript):
|
||||
def copy_escript(ctx, escript):
|
||||
e = ctx.attr._rabbitmqctl_escript.files_to_run.executable
|
||||
s = ctx.actions.declare_file(path_join(ctx.label.name, "escript", escript.basename))
|
||||
ctx.actions.symlink(
|
||||
output = s,
|
||||
target_file = e,
|
||||
dest = ctx.actions.declare_file(
|
||||
path_join(ctx.label.name, "escript", escript.basename),
|
||||
)
|
||||
return s
|
||||
ctx.actions.run(
|
||||
inputs = [e],
|
||||
outputs = [dest],
|
||||
executable = "cp",
|
||||
arguments = [e.path, dest.path],
|
||||
)
|
||||
return dest
|
||||
|
||||
def _plugins_dir_links(ctx, plugin):
|
||||
lib_info = plugin[ErlangAppInfo]
|
||||
|
@ -80,7 +87,7 @@ def _impl(ctx):
|
|||
source_scripts = ctx.files._scripts_windows
|
||||
scripts = [_copy_script(ctx, script) for script in source_scripts]
|
||||
|
||||
escripts = [link_escript(ctx, escript) for escript in ctx.files._scripts]
|
||||
escripts = [copy_escript(ctx, escript) for escript in ctx.files._scripts]
|
||||
|
||||
plugins = flatten([_plugins_dir_links(ctx, plugin) for plugin in plugins])
|
||||
|
||||
|
|
Loading…
Reference in New Issue