-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Allow HOMEBREW_PREFIX replacement in external patches #18613
Allow HOMEBREW_PREFIX replacement in external patches #18613
Conversation
2ac23c3
to
01acd87
Compare
01acd87
to
a03d65b
Compare
I wonder if this will break existing patches: https://github.com/search?q=repo%3AHomebrew%2Fformula-patches+HOMEBREW_PREFIX&type=code. |
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.
Thanks so much @pkryger, this is a really great PR!
Would love some thoughts from other @Homebrew/maintainers and @homebrew/core on this as it'll affect them too.
Good point. I guess it will. Seems like these formulae needed that functionality after all (at least |
Co-authored-by: Mike McQuaid <[email protected]>
Yes, seems that way. Also seems like |
It can be only a documentation issue indeed. I updated the PR to use existing markers (i.e., with double |
It's not replaced as we follow up with
They (i.e. the corresponding formulae) will be affected anyways as |
Given the issues above I can see a few paths forward, each of them with slightly different outcome. I am happy to pursue any of them, but I lack of experience in Option 1: Use
|
Thanks for your patience and comprehensive spelling out of the options here @pkryger, I'm grateful and impressed ❤️
This is my preferred option, I think it's nicer to be consistent here, especially when, if it breaks anything, it will be both undocumented behaviour and seems more likely than not to achieve the desired result anyway.
This makes sense to me @cho-m and seems like the best balance. @pkryger hopefully this lets you move forward! Let me know if not and if you need any help. Thanks again! |
This is to allow migration of existing users of @@HOMEBREW_PREFIX@@ tag in external patches. Once the automatic replacement of the tag is in stable branch and existing users are fixed (inreplace calls removed), this commit can be reverted.
@MikeMcQuaid Thanks for following up! I have submitted the last commit to disable the Have very little experience with Homebrew development, and even less so with its release. Could you please advise me how can I know that the change made it to a stable |
This reverts commit f31e93a.
…PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
…_PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
…MEBREW_PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
…MEBREW_PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
…MEBREW_PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
…MEBREW_PREFIX Functionality of patch in Homebrew/brew has been updated to automatically update @@HOMEBREW_PREFIX@@ with a value of HOMEBREW_PREFIX in external patches. See Homebrew/brew#18613 for more information. Once the aforementioned PR is in a stable brew tag these lines can be removed.
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.
Thanks @pkryger, great work here!
…in functionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…in functionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…in functionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…in functionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…ctionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…tionality This is a follow up to #195569 and Homebrew/brew#18613. The latter has been available since 4.4.3.
…of built in functionality This is a follow up to #195569, #193855, and Homebrew/brew#18613. The latter has been available since 4.4.3.
This updates how external patches are applied, making them equivalent with embedded patches. That is, with this the "@@HOMEBREW_PREFIX@@" string in external patches will be updated to a value of
HOMEBREW_PREFIX
variable.I found an issue opened by @gaborbernat (#15925), and realised I have encountered the same problem before (IIRC, back then I ended up using embedded patch). But I think this is still a good feature to have.
@MikeMcQuaid has closed the issue, but indicated he was willing to accept a PR.
Technical detail: I followed what has been done for embedded patches, but avoided slurping the whole file into memory. Opted for falling back to line-by-line IO. This changes semantic slightly as now an
Errno::ENOENT
is thrown from the body when patch file is missing. I was not sure if it should be caught and translated toBuildError
. For the first cut I opted for test update. Note, there are tests forBuildError
.Please let me know if you have any comments.
This fixes #15925
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?