Skip to content

Commit d6b492e

Browse files
authored
Merge pull request #287 from MikeMcQuaid/codesign-tweaks
macho: require `codesign!` call to be done explicitly.
2 parents b93877d + 2cbe364 commit d6b492e

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

lib/macho.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def self.open(filename)
4949
# @return [void]
5050
# @raise [ModificationError] if the operation fails
5151
def self.codesign!(filename)
52-
# codesign binary is not available on Linux
53-
return if RUBY_PLATFORM !~ /darwin/
52+
raise ArgumentError, "codesign binary is not available on Linux" if RUBY_PLATFORM !~ /darwin/
5453
raise ArgumentError, "#{filename}: no such file" unless File.file?(filename)
5554

5655
_, _, status = Open3.capture3("codesign", "--sign", "-", "--force",

lib/macho/tools.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ def self.change_dylib_id(filename, new_id, options = {})
2525

2626
file.change_dylib_id(new_id, options)
2727
file.write!
28-
29-
MachO.codesign!(filename)
3028
end
3129

3230
# Changes a shared library install name in a Mach-O or Fat binary,
@@ -43,8 +41,6 @@ def self.change_install_name(filename, old_name, new_name, options = {})
4341

4442
file.change_install_name(old_name, new_name, options)
4543
file.write!
46-
47-
MachO.codesign!(filename)
4844
end
4945

5046
# Changes a runtime path in a Mach-O or Fat binary, overwriting the source
@@ -61,8 +57,6 @@ def self.change_rpath(filename, old_path, new_path, options = {})
6157

6258
file.change_rpath(old_path, new_path, options)
6359
file.write!
64-
65-
MachO.codesign!(filename)
6660
end
6761

6862
# Add a runtime path to a Mach-O or Fat binary, overwriting the source file.
@@ -77,8 +71,6 @@ def self.add_rpath(filename, new_path, options = {})
7771

7872
file.add_rpath(new_path, options)
7973
file.write!
80-
81-
MachO.codesign!(filename)
8274
end
8375

8476
# Delete a runtime path from a Mach-O or Fat binary, overwriting the source
@@ -94,8 +86,6 @@ def self.delete_rpath(filename, old_path, options = {})
9486

9587
file.delete_rpath(old_path, options)
9688
file.write!
97-
98-
MachO.codesign!(filename)
9989
end
10090

10191
# Merge multiple Mach-Os into one universal (Fat) binary.
@@ -116,8 +106,6 @@ def self.merge_machos(filename, *files, fat64: false)
116106

117107
fat_macho = MachO::FatFile.new_from_machos(*machos, :fat64 => fat64)
118108
fat_macho.write(filename)
119-
120-
MachO.codesign!(filename)
121109
end
122110
end
123111
end

0 commit comments

Comments
 (0)