
While it may suffice to merge string and non-reserved tags by forming a union of all tags of dependencies of the same name, this approach fails to work for the reserved tags. These are now merged such that the most restrictive tag (meaning sometimes an empty tag) is preserved. The previous behavior caused essential dependencies to be omitted and builds to fail in response. E.g., multiple `:fortran` dependencies with tags `[]`, `[:recommended]`, and `[:optional]` would have been expanded and merged to `"gcc"` with tags `[:recommended, :optional]`, causing it to be no longer seen as a required dependency. Closes Homebrew/homebrew#47040. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
36 lines
617 B
Ruby
36 lines
617 B
Ruby
require "options"
|
|
|
|
module Dependable
|
|
RESERVED_TAGS = [:build, :optional, :recommended, :run]
|
|
|
|
def build?
|
|
tags.include? :build
|
|
end
|
|
|
|
def optional?
|
|
tags.include? :optional
|
|
end
|
|
|
|
def recommended?
|
|
tags.include? :recommended
|
|
end
|
|
|
|
def run?
|
|
tags.include? :run
|
|
end
|
|
|
|
def required?
|
|
# FIXME: Should `required?` really imply `!build?`? And if so, why doesn't
|
|
# any of `optional?` and `recommended?` equally imply `!build?`?
|
|
!build? && !optional? && !recommended?
|
|
end
|
|
|
|
def option_tags
|
|
tags - RESERVED_TAGS
|
|
end
|
|
|
|
def options
|
|
Options.create(option_tags)
|
|
end
|
|
end
|