formula_installer: write tab when pouring local --only-json-tab bottles
This commit is contained in:
parent
b7782c670f
commit
33e1255f65
@ -1142,21 +1142,9 @@ class FormulaInstaller
|
|||||||
downloader.stage
|
downloader.stage
|
||||||
end
|
end
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
|
|
||||||
tab = if (tab_attributes = formula.bottle_tab_attributes.presence)
|
tab = Utils::Bottles.load_tab(formula)
|
||||||
Tab.from_file_content(tab_attributes.to_json, keg/Tab::FILENAME)
|
|
||||||
else
|
|
||||||
Tab.for_keg(keg)
|
|
||||||
end
|
|
||||||
|
|
||||||
skip_linkage = formula.bottle_specification.skip_relocation?
|
|
||||||
# TODO: Remove `with_env` when bottles are built with RPATH relocation enabled
|
|
||||||
# https://github.com/Homebrew/brew/issues/11329
|
|
||||||
with_env(HOMEBREW_RELOCATE_RPATHS: "1") do
|
|
||||||
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
|
|
||||||
end
|
|
||||||
|
|
||||||
# fill in missing/outdated parts of the tab
|
# fill in missing/outdated parts of the tab
|
||||||
# keep in sync with Tab#to_bottle_json
|
# keep in sync with Tab#to_bottle_json
|
||||||
@ -1175,6 +1163,14 @@ class FormulaInstaller
|
|||||||
tab.source["tap_git_head"] = formula.tap&.git_head
|
tab.source["tap_git_head"] = formula.tap&.git_head
|
||||||
tab.tap = formula.tap
|
tab.tap = formula.tap
|
||||||
tab.write
|
tab.write
|
||||||
|
|
||||||
|
keg = Keg.new(formula.prefix)
|
||||||
|
skip_linkage = formula.bottle_specification.skip_relocation?
|
||||||
|
# TODO: Remove `with_env` when bottles are built with RPATH relocation enabled
|
||||||
|
# https://github.com/Homebrew/brew/issues/11329
|
||||||
|
with_env(HOMEBREW_RELOCATE_RPATHS: "1") do
|
||||||
|
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(output: T.nilable(String)).void }
|
sig { params(output: T.nilable(String)).void }
|
||||||
|
|||||||
@ -92,6 +92,23 @@ module Utils
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_tab(formula)
|
||||||
|
keg = Keg.new(formula.prefix)
|
||||||
|
tabfile = keg/Tab::FILENAME
|
||||||
|
bottle_json_path = formula.local_bottle_path&.sub(/\.tar\.gz$/, ".json")
|
||||||
|
|
||||||
|
if (tab_attributes = formula.bottle_tab_attributes.presence)
|
||||||
|
Tab.from_file_content(tab_attributes.to_json, tabfile)
|
||||||
|
elsif !tabfile.exist? && bottle_json_path&.exist?
|
||||||
|
_, tag, = Utils::Bottles.extname_tag_rebuild(formula.local_bottle_path)
|
||||||
|
bottle_hash = JSON.parse(File.read(bottle_json_path))
|
||||||
|
tab_json = bottle_hash[formula.full_name]["bottle"]["tags"][tag]["tab"].to_json
|
||||||
|
Tab.from_file_content(tab_json, tabfile)
|
||||||
|
else
|
||||||
|
Tab.for_keg(keg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def bottle_file_list(bottle_file)
|
def bottle_file_list(bottle_file)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user