Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formula: add keg_only_reason to formula hash #12552

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,7 @@ def to_hash
"version_scheme" => version_scheme,
"bottle" => {},
"keg_only" => keg_only?,
"keg_only_reason" => keg_only_reason&.to_hash,
"bottle_disabled" => bottle_disabled?,
"options" => [],
"build_dependencies" => dependencies.select(&:build?)
Expand Down
13 changes: 13 additions & 0 deletions Library/Homebrew/formula_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ def to_s
@reason
end.strip
end

def to_hash
reason_string = if @reason.is_a?(Symbol)
@reason.inspect
else
@reason.to_s
end

{
"reason" => reason_string,
"explanation" => @explanation,
}
end
end

# Used to annotate formulae that don't require compiling or cannot build a bottle.
Expand Down