Merge pull request #20442 from HuaDeity/fix-head-install-with-forbid-packages-from-paths
Fix HEAD installations with HOMEBREW_FORBID_PACKAGES_FROM_PATHS
This commit is contained in:
commit
023bbfdf5c
@ -617,7 +617,8 @@ module Formulary
|
||||
return unless path.expand_path.exist?
|
||||
|
||||
return if Homebrew::EnvConfig.forbid_packages_from_paths? &&
|
||||
!path.realpath.to_s.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/")
|
||||
!path.realpath.to_s.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/",
|
||||
"#{HOMEBREW_CACHE}/")
|
||||
|
||||
if (tap = Tap.from_path(path))
|
||||
# Only treat symlinks in taps as aliases.
|
||||
|
@ -141,6 +141,21 @@ RSpec.describe Formulary do
|
||||
end.to raise_error(FormulaUnavailableError)
|
||||
end
|
||||
|
||||
it "allows cache paths even when paths are disabled" do
|
||||
ENV["HOMEBREW_FORBID_PACKAGES_FROM_PATHS"] = "1"
|
||||
cache_dir = HOMEBREW_CACHE/"test_formula_cache"
|
||||
cache_dir.mkpath
|
||||
cache_formula_path = cache_dir/formula_path.basename
|
||||
FileUtils.cp formula_path, cache_formula_path
|
||||
begin
|
||||
formula = described_class.factory(cache_formula_path)
|
||||
expect(formula).to be_a(Formula)
|
||||
ensure
|
||||
cache_formula_path.unlink if cache_formula_path.exist?
|
||||
cache_dir.rmdir if cache_dir.exist?
|
||||
end
|
||||
end
|
||||
|
||||
context "when given a bottle" do
|
||||
subject(:formula) { described_class.factory(bottle) }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user