Merge pull request #11532 from nandahkrishna/bottle-install-fixes
formula_installer: restrict use of Formula from Keg
This commit is contained in:
commit
d391331026
@ -1076,12 +1076,33 @@ class FormulaInstaller
|
|||||||
#{HOMEBREW_LIBRARY_PATH}/postinstall.rb
|
#{HOMEBREW_LIBRARY_PATH}/postinstall.rb
|
||||||
]
|
]
|
||||||
|
|
||||||
args << if formula.local_bottle_path.present?
|
# Use the formula from the keg if:
|
||||||
formula.prefix/".brew/#{formula.name}.rb"
|
# * Installing from a local bottle, or
|
||||||
else
|
# * The formula doesn't exist in the tap (or the tap isn't installed), or
|
||||||
formula.path
|
# * The formula in the tap has a different pkg_version.
|
||||||
|
# In all other cases, including if the formula from the keg is unreadable
|
||||||
|
# (third-party taps may `require` some of their own libraries), use the
|
||||||
|
# formula from the tap.
|
||||||
|
formula_path = begin
|
||||||
|
keg_formula_path = formula.opt_prefix/".brew/#{formula.name}.rb"
|
||||||
|
tap_formula_path = formula.path
|
||||||
|
keg_formula = Formulary.factory(keg_formula_path)
|
||||||
|
tap_formula = Formulary.factory(tap_formula_path) if tap_formula_path.exist?
|
||||||
|
other_version_installed = (keg_formula.pkg_version != tap_formula&.pkg_version)
|
||||||
|
|
||||||
|
if formula.local_bottle_path.present? ||
|
||||||
|
!tap_formula_path.exist? ||
|
||||||
|
other_version_installed
|
||||||
|
keg_formula_path
|
||||||
|
else
|
||||||
|
tap_formula_path
|
||||||
|
end
|
||||||
|
rescue FormulaUnreadableError
|
||||||
|
tap_formula_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
args << formula_path
|
||||||
|
|
||||||
Utils.safe_fork do
|
Utils.safe_fork do
|
||||||
if Sandbox.available?
|
if Sandbox.available?
|
||||||
sandbox = Sandbox.new
|
sandbox = Sandbox.new
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user