Improve test for bottling
This commit is contained in:
parent
6457770a59
commit
c9060c3242
@ -4,7 +4,7 @@
|
|||||||
require "compilers"
|
require "compilers"
|
||||||
|
|
||||||
class Keg
|
class Keg
|
||||||
def relocate_dynamic_linkage(relocation)
|
def relocate_dynamic_linkage(relocation, skip_protodesc_cold: false)
|
||||||
# Patching the dynamic linker of glibc breaks it.
|
# Patching the dynamic linker of glibc breaks it.
|
||||||
return if name.match? Version.formula_optionally_versioned_regex(:glibc)
|
return if name.match? Version.formula_optionally_versioned_regex(:glibc)
|
||||||
|
|
||||||
@ -12,20 +12,18 @@ class Keg
|
|||||||
|
|
||||||
elf_files.each do |file|
|
elf_files.each do |file|
|
||||||
file.ensure_writable do
|
file.ensure_writable do
|
||||||
change_rpath!(file, old_prefix, new_prefix)
|
change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_rpath!(file, old_prefix, new_prefix)
|
def change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold: false)
|
||||||
return false if !file.elf? || !file.dynamic_elf?
|
return false if !file.elf? || !file.dynamic_elf?
|
||||||
|
|
||||||
bottling = old_prefix.to_s.start_with?(HOMEBREW_PREFIX.to_s)
|
|
||||||
bottling &&= !new_prefix.to_s.start_with?(HOMEBREW_PREFIX.to_s)
|
|
||||||
# Skip relocation of files with `protodesc_cold` sections because patchelf.rb seems to break them,
|
# Skip relocation of files with `protodesc_cold` sections because patchelf.rb seems to break them,
|
||||||
# but only when bottling (as we don't want to break existing bottles that require relocation).
|
# but only when bottling (as we don't want to break existing bottles that require relocation).
|
||||||
# https://github.com/Homebrew/homebrew-core/pull/232490#issuecomment-3161362452
|
# https://github.com/Homebrew/homebrew-core/pull/232490#issuecomment-3161362452
|
||||||
return false if bottling && file.section_names.include?("protodesc_cold")
|
return false if skip_protodesc_cold && file.section_names.include?("protodesc_cold")
|
||||||
|
|
||||||
updated = {}
|
updated = {}
|
||||||
old_rpath = file.rpath
|
old_rpath = file.rpath
|
||||||
|
|||||||
@ -20,7 +20,7 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def relocate_dynamic_linkage(relocation)
|
def relocate_dynamic_linkage(relocation, skip_protodesc_cold: false)
|
||||||
mach_o_files.each do |file|
|
mach_o_files.each do |file|
|
||||||
file.ensure_writable do
|
file.ensure_writable do
|
||||||
modified = T.let(false, T::Boolean)
|
modified = T.let(false, T::Boolean)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def relocate_dynamic_linkage(_relocation)
|
def relocate_dynamic_linkage(_relocation, skip_protodesc_cold: false)
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class Keg
|
|||||||
|
|
||||||
def replace_locations_with_placeholders
|
def replace_locations_with_placeholders
|
||||||
relocation = prepare_relocation_to_placeholders.freeze
|
relocation = prepare_relocation_to_placeholders.freeze
|
||||||
relocate_dynamic_linkage(relocation)
|
relocate_dynamic_linkage(relocation, skip_protodesc_cold: true)
|
||||||
replace_text_in_files(relocation)
|
replace_text_in_files(relocation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user