Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Formula/c/cocogitto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ def install
system "git", "commit", "-m", "chore: initial commit"
assert_equal "No errored commits", shell_output("#{bin}/cog check 2>&1").strip

linkage_with_libgit2 = (bin/"cog").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"cog", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
10 changes: 4 additions & 6 deletions Formula/c/convco.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ def install
shell_output("#{bin}/convco check", 1).lines.first)

# Verify that we are using the libgit2 library
linkage_with_libgit2 = (bin/"convco").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end
assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"convco", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
4 changes: 2 additions & 2 deletions Formula/c/corsixth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ def install

test do
if OS.mac?
require "utils/linkage"
lua = Formula["lua"]

app = prefix/"CorsixTH.app/Contents/MacOS/CorsixTH"
assert_includes app.dynamically_linked_libraries, "#{lua.opt_lib}/liblua.dylib"
assert Utils.binary_linked_to_library?(app, lua.opt_lib/"liblua.dylib"), "No linkage with lua!"
end

PTY.spawn(bin/"CorsixTH") do |r, _w, pid|
Expand Down
11 changes: 4 additions & 7 deletions Formula/e/eza.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ def install
system "git", "commit", "-m", "Initial commit"
assert_equal "--", eza_output.call

linkage_with_libgit2 = (bin/"eza").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"eza", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
14 changes: 5 additions & 9 deletions Formula/g/gfold.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ def install
end

assert_match "\e[0m\e[32mclean\e[0m (master)", shell_output("#{bin}/gfold #{testpath} 2>&1")
assert_match "gfold #{version}", shell_output("#{bin}/gfold --version")

# libgit2 linkage test to avoid using vendored one
# https://github.com/Homebrew/homebrew-core/pull/125393#issuecomment-1465250076
linkage_with_libgit2 = (bin/"gfold").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."

assert_match "gfold #{version}", shell_output("#{bin}/gfold --version")
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"gfold", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
11 changes: 4 additions & 7 deletions Formula/g/git-absorb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ def install
system "git", "add", "test"
system "git", "absorb"

linkage_with_libgit2 = (bin/"git-absorb").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"git-absorb", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
11 changes: 4 additions & 7 deletions Formula/g/git-branchless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ def install
system "git", "branchless", "init"
assert_match "Initial Commit", shell_output("git sl").strip

linkage_with_libgit2 = (bin/"git-branchless").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"git-branchless", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
11 changes: 4 additions & 7 deletions Formula/g/git-cliff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@ def install
- Initial commit
EOS

linkage_with_libgit2 = (bin/"git-cliff").dynamically_linked_libraries.any? do |dll|
next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)

File.realpath(dll) == (Formula["libgit2"].opt_lib/shared_library("libgit2")).realpath.to_s
end

assert linkage_with_libgit2, "No linkage with libgit2! Cargo is likely using a vendored version."
require "utils/linkage"
library = Formula["libgit2"].opt_lib/shared_library("libgit2")
assert Utils.binary_linked_to_library?(bin/"git-cliff", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
Loading