Skip to content

Commit a132a78

Browse files
authored
Merge pull request #20992 from Homebrew/source-build-postinstall-from-keg
formula_installer: use formula from keg when post-installing source builds
2 parents 71bf64f + 52d9561 commit a132a78

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Library/Homebrew/formula_installer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ def post_install_formula_path
13131313
# Use the formula from the keg when any of the following is true:
13141314
# * We're installing from the JSON API
13151315
# * We're installing a local bottle file
1316+
# * We're building from source
13161317
# * The formula doesn't exist in the tap (or the tap isn't installed)
13171318
# * The formula in the tap has a different `pkg_version``.
13181319
#
@@ -1323,6 +1324,7 @@ def post_install_formula_path
13231324
keg_formula_path = formula.opt_prefix/".brew/#{formula.name}.rb"
13241325
return keg_formula_path if formula.loaded_from_api?
13251326
return keg_formula_path if formula.local_bottle_path.present?
1327+
return keg_formula_path if build_from_source?
13261328

13271329
tap_formula_path = T.must(formula.specified_path)
13281330
return keg_formula_path unless tap_formula_path.exist?

Library/Homebrew/utils/path.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ def self.loadable_package_path?(path, package_type)
2424
else
2525
"#{Cask::Caskroom.path}/"
2626
end
27-
unless Homebrew::EnvConfig.no_install_from_api?
28-
require "api"
29-
allowed_paths << "#{Homebrew::API::HOMEBREW_CACHE_API_SOURCE}/"
30-
end
3127

3228
return true if !path_realpath.end_with?(".rb") && !path_string.end_with?(".rb")
3329
return true if allowed_paths.any? { |path| path_realpath.start_with?(path) }

0 commit comments

Comments
 (0)