Skip to content

Commit ca70275

Browse files
committed
Resolve symlinks when copying in rabbitmqctl.bzl
1 parent b10221d commit ca70275

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

deps/rabbitmq_cli/rabbitmqctl.bzl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ ElixirAppInfo = provider(
3434
},
3535
)
3636

37+
def _copy(ctx, src, dst):
38+
ctx.actions.run_shell(
39+
inputs = [src],
40+
outputs = [dst],
41+
command = """set -euo pipefail
42+
43+
cp -RL "{src}" "{dst}"
44+
""".format(
45+
src = src.path,
46+
dst = dst.path,
47+
),
48+
)
49+
3750
def deps_dir_contents(ctx, deps, dir):
3851
files = []
3952
for dep in deps:
@@ -51,15 +64,7 @@ def deps_dir_contents(ctx, deps, dir):
5164
lib_info.app_name,
5265
rp,
5366
))
54-
args = ctx.actions.args()
55-
args.add(src)
56-
args.add(f)
57-
ctx.actions.run(
58-
inputs = [src],
59-
outputs = [f],
60-
executable = "cp",
61-
arguments = [args],
62-
)
67+
_copy(ctx, src, f)
6368
files.append(f)
6469
for beam in lib_info.beam:
6570
if not beam.is_directory:
@@ -69,15 +74,7 @@ def deps_dir_contents(ctx, deps, dir):
6974
"ebin",
7075
beam.basename,
7176
))
72-
args = ctx.actions.args()
73-
args.add(beam)
74-
args.add(f)
75-
ctx.actions.run(
76-
inputs = [beam],
77-
outputs = [f],
78-
executable = "cp",
79-
arguments = [args],
80-
)
77+
_copy(ctx, beam, f)
8178
files.append(f)
8279
else:
8380
fail("unexpected directory in", lib_info)

0 commit comments

Comments
 (0)