-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Formulary: map formula names to local bottle paths #11534
Conversation
Review period will end on 2021-06-15 at 16:07:27 UTC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this functionality being included and merged but it feels a bit generic to me. If this is for cached bottles specifically: let's make the naming and example documentation reference those specifically. A generic map function seems both undesirable and potentially dangerous/insecure.
Is this better? |
Library/Homebrew/formulary.rb
Outdated
# Map a formula name to a bottle archive. This mapping will be used by {Formulary::factory} | ||
# to allow formulae to be loaded automatically from their bottle archive without | ||
# needing to exist in a tap or be passed as a complete filepath. For example, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be used now if an environment variable is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used how? What would the environment variable do? Right now there's no place where it makes sense to set up the mapping outside of Homebrew/json. So I don't think adding an environment variable would do much here. As soon as this and https://github.com/Homebrew/homebrew-json/pull/7 are merged, anyone using Homebrew/json would use this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, much better naming etc. 👏🏻
Review period ended. |
Ah, I see. Those suggestions make sense to me. Just thinking ahead a bit, is this the same env variable you're anticipating will be used to control whether homebrew/core is allowed to be untapped? |
Co-authored-by: Mike McQuaid <[email protected]>
::map
to map formula refs
It could be, yes, so feel rename to rename it accordingly 👍🏻 |
I think I'll go ahead and merge for now. I have a work-in-progress PR for untapping homebrew/core, so we can figure out the env var name there. Since its all undocumented and unsupported I'm fine changing it. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This PR adds some new functionality to
Formulary
to allow for refs to be mapped to each other. This mapping is set up usingFormulary::map
and is then used to substitute the reference passed toFormulary::factory
. For example:At the moment, this is not used anywhere internally, but would be used in Homebrew/json if merged. Originally, I had opted to monkey patch
Formulary
to look for cached bottles and was a bit unwilling to add it to Homebrew/brew because it felt too specific to that tap. However, I rethought the process a bit over the weekend and am now planning on monkey patching the changes from this PR (essentially). Since these changes feel more general and don't need to be specific to Homebrew/json, I feel okay including them here.If the consensus is that we don't want it to be added here unless we're using it internally, that's okay.