diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index a1b70812ac69f0..0321810bd11335 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2119,6 +2119,8 @@ def to_hash "uses_from_macos" => uses_from_macos_elements.uniq, "requirements" => [], "conflicts_with" => conflicts.map(&:name), + "conflicts_with_reasons" => conflicts.map(&:reason), + "link_overwrite" => self.class.link_overwrite_paths.to_a, "caveats" => caveats&.gsub(HOMEBREW_PREFIX, HOMEBREW_PREFIX_PLACEHOLDER), "installed" => [], "linked_keg" => linked_version&.to_s, diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index c906b4ea9709cb..fa7adbf86f33f8 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -244,6 +244,14 @@ def self.load_formula_from_api(name, flags:) depends_on req_name => req_tags end + json_formula["conflicts_with"].each_with_index do |conflict, index| + conflicts_with conflict, because: json_formula.dig("conflicts_with_reasons", index) + end + + json_formula["link_overwrite"]&.each do |overwrite_path| + link_overwrite overwrite_path + end + def install raise "Cannot build from source from abstract formula." end