formula_installer: add fallback to use tap formula
The keg formula isn't present in some old bottles. Use the tap formula as a fallback when this is the case.
This commit is contained in:
		
							parent
							
								
									04e09de1d8
								
							
						
					
					
						commit
						35e5c8a612
					
				@ -1056,9 +1056,11 @@ class FormulaInstaller
 | 
				
			|||||||
    # * Installing from a local bottle, or
 | 
					    # * Installing from a local bottle, or
 | 
				
			||||||
    # * The formula doesn't exist in the tap (or the tap isn't installed), or
 | 
					    # * The formula doesn't exist in the tap (or the tap isn't installed), or
 | 
				
			||||||
    # * The formula in the tap has a different pkg_version.
 | 
					    # * The formula in the tap has a different pkg_version.
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
    # In all other cases, including if the formula from the keg is unreadable
 | 
					    # 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
 | 
					    # (third-party taps may `require` some of their own libraries) or if there
 | 
				
			||||||
    # formula from the tap.
 | 
					    # is no formula present in the keg (as is the case with old bottles), use
 | 
				
			||||||
 | 
					    # the formula from the tap.
 | 
				
			||||||
    formula_path = begin
 | 
					    formula_path = begin
 | 
				
			||||||
      keg_formula_path = formula.opt_prefix/".brew/#{formula.name}.rb"
 | 
					      keg_formula_path = formula.opt_prefix/".brew/#{formula.name}.rb"
 | 
				
			||||||
      tap_formula_path = formula.path
 | 
					      tap_formula_path = formula.path
 | 
				
			||||||
@ -1073,7 +1075,7 @@ class FormulaInstaller
 | 
				
			|||||||
      else
 | 
					      else
 | 
				
			||||||
        tap_formula_path
 | 
					        tap_formula_path
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    rescue FormulaUnreadableError
 | 
					    rescue FormulaUnavailableError, FormulaUnreadableError
 | 
				
			||||||
      tap_formula_path
 | 
					      tap_formula_path
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user