Merge pull request #12552 from Bo98/hash-keg_only_reason

formula: add keg_only_reason to formula hash
This commit is contained in:
Mike McQuaid 2021-12-14 11:02:12 +00:00 committed by GitHub
commit 2eaa34e3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -1942,6 +1942,7 @@ class Formula
"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?)

View File

@ -60,6 +60,19 @@ class KegOnlyReason
@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.