Merge pull request #12100 from Bo98/fi-fix-no-bottle
formula_installer: fix error if a compatible bottle was not found
This commit is contained in:
		
						commit
						91acec50f9
					
				@ -63,7 +63,7 @@ module Homebrew
 | 
				
			|||||||
  sig { params(formula: Formula, args: CLI::Args).void }
 | 
					  sig { params(formula: Formula, args: CLI::Args).void }
 | 
				
			||||||
  def print_formula_cache(formula, args:)
 | 
					  def print_formula_cache(formula, args:)
 | 
				
			||||||
    if fetch_bottle?(formula, args: args)
 | 
					    if fetch_bottle?(formula, args: args)
 | 
				
			||||||
      puts formula.bottle_for_tag(args.bottle_tag).cached_download
 | 
					      puts formula.bottle_for_tag(args.bottle_tag&.to_sym).cached_download
 | 
				
			||||||
    elsif args.HEAD?
 | 
					    elsif args.HEAD?
 | 
				
			||||||
      puts formula.head.cached_download
 | 
					      puts formula.head.cached_download
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
				
			|||||||
@ -93,7 +93,7 @@ module Homebrew
 | 
				
			|||||||
          begin
 | 
					          begin
 | 
				
			||||||
            f.clear_cache if args.force?
 | 
					            f.clear_cache if args.force?
 | 
				
			||||||
            f.fetch_bottle_tab
 | 
					            f.fetch_bottle_tab
 | 
				
			||||||
            fetch_formula(f.bottle_for_tag(args.bottle_tag), args: args)
 | 
					            fetch_formula(f.bottle_for_tag(args.bottle_tag&.to_sym), args: args)
 | 
				
			||||||
          rescue Interrupt
 | 
					          rescue Interrupt
 | 
				
			||||||
            raise
 | 
					            raise
 | 
				
			||||||
          rescue => e
 | 
					          rescue => e
 | 
				
			||||||
 | 
				
			|||||||
@ -371,7 +371,7 @@ class Formula
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # The Bottle object for given tag.
 | 
					  # The Bottle object for given tag.
 | 
				
			||||||
  # @private
 | 
					  # @private
 | 
				
			||||||
  sig { params(tag: T.nilable(String)).returns(T.nilable(Bottle)) }
 | 
					  sig { params(tag: T.nilable(Symbol)).returns(T.nilable(Bottle)) }
 | 
				
			||||||
  def bottle_for_tag(tag = nil)
 | 
					  def bottle_for_tag(tag = nil)
 | 
				
			||||||
    Bottle.new(self, bottle_specification, tag) if bottled?(tag)
 | 
					    Bottle.new(self, bottle_specification, tag) if bottled?(tag)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
				
			|||||||
@ -150,8 +150,10 @@ class FormulaInstaller
 | 
				
			|||||||
      return false
 | 
					      return false
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bottle = formula.bottle
 | 
					    bottle = formula.bottle_for_tag(Utils::Bottles.tag.to_sym)
 | 
				
			||||||
    if bottle && !bottle.compatible_locations?
 | 
					    return false if bottle.nil?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    unless bottle.compatible_locations?
 | 
				
			||||||
      if output_warning
 | 
					      if output_warning
 | 
				
			||||||
        prefix = Pathname(bottle.cellar).parent
 | 
					        prefix = Pathname(bottle.cellar).parent
 | 
				
			||||||
        opoo <<~EOS
 | 
					        opoo <<~EOS
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user