Skip to content

Commit 53dff19

Browse files
committed
yozefu: use brew-provided function for checking binary linkage
Signed-off-by: Rui Chen <[email protected]>
1 parent 43eaa33 commit 53dff19

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Formula/y/yozefu.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,9 @@ def install
2828
system "cargo", "install", *std_cargo_args(path: "crates/bin")
2929
end
3030

31-
def check_binary_linkage(binary, library)
32-
binary.dynamically_linked_libraries.any? do |dll|
33-
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)
34-
35-
File.realpath(dll) == File.realpath(library)
36-
end
37-
end
38-
3931
test do
32+
require "utils/linkage"
33+
4034
assert_match version.to_s, shell_output("#{bin}/yozf --version")
4135

4236
output = shell_output("#{bin}/yozf config get a 2>&1", 1)
@@ -46,7 +40,7 @@ def check_binary_linkage(binary, library)
4640
Formula["openssl@3"].opt_lib/shared_library("libssl"),
4741
Formula["openssl@3"].opt_lib/shared_library("libcrypto"),
4842
].each do |library|
49-
assert check_binary_linkage(bin/"yozf", library),
43+
assert Utils.binary_linked_to_library?(bin/"yozf", library),
5044
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
5145
end
5246
end

0 commit comments

Comments
 (0)