From 4de44c771d57a2a3c0d2e21016ddde4aa6d1fe99 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Wed, 9 Jun 2021 13:57:14 -0400 Subject: [PATCH] formula: improve `to_recursive_bottle_hash` --- Library/Homebrew/formula.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b22336f8ac..b52826e2c3 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1919,17 +1919,19 @@ class Formula [tag.to_s, info] end.to_h - return bottles unless top_level + hash = { + "name" => name, + "pkg_version" => pkg_version, + "rebuild" => bottle["rebuild"], + "bottles" => bottles, + } - dependencies = declared_runtime_dependencies.map do |dep| + return hash unless top_level + + hash["dependencies"] = declared_runtime_dependencies.map do |dep| dep.to_formula.to_recursive_bottle_hash(top_level: false) end - - { - "name" => name, - "bottles" => bottles, - "dependencies" => dependencies, - } + hash end # Returns the bottle information for a formula