formula: add keg_only_reason to formula hash

This commit is contained in:
Bo Anderson 2021-12-11 23:30:06 +00:00
parent 3373a82d22
commit 00b588068f
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 14 additions and 0 deletions

View File

@ -1942,6 +1942,7 @@ class Formula
"version_scheme" => version_scheme, "version_scheme" => version_scheme,
"bottle" => {}, "bottle" => {},
"keg_only" => keg_only?, "keg_only" => keg_only?,
"keg_only_reason" => keg_only_reason&.to_hash,
"bottle_disabled" => bottle_disabled?, "bottle_disabled" => bottle_disabled?,
"options" => [], "options" => [],
"build_dependencies" => dependencies.select(&:build?) "build_dependencies" => dependencies.select(&:build?)

View File

@ -60,6 +60,19 @@ class KegOnlyReason
@reason @reason
end.strip end.strip
end 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 end
# Used to annotate formulae that don't require compiling or cannot build a bottle. # Used to annotate formulae that don't require compiling or cannot build a bottle.