File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,6 +154,9 @@ def stale_formula?(pathname, scrub)
154154
155155 formula = begin
156156 Formulary . from_rack ( HOMEBREW_CELLAR /formula_name )
157+ rescue Homebrew ::UntrustedTapError
158+ opoo "Skipping #{ formula_name } : tap formula is not trusted"
159+ nil
157160 rescue FormulaUnavailableError , TapFormulaAmbiguityError
158161 nil
159162 end
@@ -162,6 +165,9 @@ def stale_formula?(pathname, scrub)
162165 if formula . blank? && formula_name . delete_suffix! ( "_bottle_manifest" )
163166 formula = begin
164167 Formulary . from_rack ( HOMEBREW_CELLAR /formula_name )
168+ rescue Homebrew ::UntrustedTapError
169+ opoo "Skipping #{ formula_name } : tap formula is not trusted"
170+ nil
165171 rescue FormulaUnavailableError , TapFormulaAmbiguityError
166172 nil
167173 end
Original file line number Diff line number Diff line change 6969 expect ( lock_file ) . to exist
7070 end
7171
72+ it "doesn't load untrusted installed formulae while cleaning the cache" do
73+ cache_file = HOMEBREW_CACHE /"untrusted--1.0"
74+ cache_file . write "cached"
75+ ( HOMEBREW_CELLAR /"untrusted/1.0" ) . mkpath
76+
77+ expect ( Formulary ) . to receive ( :from_rack ) . with ( HOMEBREW_CELLAR /"untrusted" )
78+ . and_raise ( Homebrew ::UntrustedTapError )
79+
80+ expect { cleanup . cleanup_cache ( [ { path : cache_file , type : nil } ] ) }
81+ . to output ( /Skipping untrusted: tap formula is not trusted/ ) . to_stderr
82+ expect ( cache_file ) . to exist
83+ end
84+
7285 context "when it can't remove a keg" do
7386 let ( :formula_zero_dot_one ) { Class . new ( Testball ) { version "0.1" } . new }
7487 let ( :formula_zero_dot_two ) { Class . new ( Testball ) { version "0.2" } . new }
You can’t perform that action at this time.
0 commit comments