Skip to content

Commit 04366fc

Browse files
authored
Merge pull request #22441 from Homebrew/linux-skip-relocation
keg: fix any_skip_relocation cellar on Linux
2 parents e0a979f + a149f5c commit 04366fc

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

Library/Homebrew/extend/os/linux/keg_relocate.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold: false)
6565
old_interpreter.sub old_prefix, new_prefix
6666
end
6767
updated[:interpreter] = new_interpreter if old_interpreter != new_interpreter
68+
return false if updated.empty?
6869

6970
file.patch!(interpreter: updated[:interpreter], rpath: updated[:rpath])
71+
require_relocation!
7072
true
7173
end
7274

Library/Homebrew/extend/os/mac/keg.rb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,11 @@ def must_be_writable_directories
3939
end
4040
end
4141

42-
sig { params(path: ::Pathname).void }
43-
def initialize(path)
44-
super
45-
46-
@require_relocation = T.let(false, T::Boolean)
47-
end
48-
4942
sig { params(id: String, file: MachOShim).returns(T::Boolean) }
5043
def change_dylib_id(id, file)
5144
return false if file.dylib_id == id
5245

53-
@require_relocation = true
46+
require_relocation!
5447
odebug "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}"
5548
file.change_dylib_id(id, strict: false)
5649
true
@@ -67,7 +60,7 @@ def change_dylib_id(id, file)
6760
def change_install_name(old, new, file)
6861
return false if old == new
6962

70-
@require_relocation = true
63+
require_relocation!
7164
odebug "Changing install name in #{file}\n from #{old}\n to #{new}"
7265
file.change_install_name(old, new, strict: false)
7366
true
@@ -84,7 +77,7 @@ def change_install_name(old, new, file)
8477
def change_rpath(old, new, file)
8578
return false if old == new
8679

87-
@require_relocation = true
80+
require_relocation!
8881
odebug "Changing rpath in #{file}\n from #{old}\n to #{new}"
8982
file.change_rpath(old, new, strict: false)
9083
true

Library/Homebrew/keg.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def initialize(path)
212212
@linked_keg_record = T.let(HOMEBREW_LINKED_KEGS/name, Pathname)
213213
@opt_record = T.let(HOMEBREW_PREFIX/"opt/#{name}", Pathname)
214214
@oldname_opt_records = T.let([], T::Array[Pathname])
215-
@require_relocation = false
215+
@require_relocation = T.let(false, T::Boolean)
216216
end
217217

218218
sig { returns(Pathname) }
@@ -259,6 +259,11 @@ def empty_installation?
259259
sig { returns(T::Boolean) }
260260
def require_relocation? = @require_relocation
261261

262+
sig { void }
263+
def require_relocation!
264+
@require_relocation = true
265+
end
266+
262267
sig { returns(T::Boolean) }
263268
def linked?
264269
linked_keg_record.symlink? &&

0 commit comments

Comments
 (0)