-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
rubocops/patches: GitLab patches should use .diff #10760
Conversation
Review period will end on 2021-03-03 at 08:16:56 UTC. |
Would be good to wait for Homebrew/homebrew-core#70826, as I really don't want to re-run CI again on it. |
Review period ended. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Resolved the merge conflicts for you. |
Homebrew/homebrew-core#74023 The tricky part here is that it looks like the tap_syntax test will prevent the {home,linux}brew/core PRs from being tested until this PR is merged. |
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 for resolving the conflicts, @carlocab!
Being able to auto-correct patch URLs was a little useful, but it would've been nice if we could get an updated checksum with that too. I realised that while opening the {homebrew,linuxbrew}/core PRs. |
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.
You might be able to do something like this:
correct = patch_url_node.source.gsub(/\.patch/, ".diff")
patch = Resource.new "patch"
patch.url correct
patch.downloader.fetch
patch.clear_cache
# The checksum can be accessed using:
patch.cached_download.sha256
This would probably need to be done in an audit rather than a rubocop, though, as robocops don't have access to the rest of the Homebrew infrastructure (and probably shouldn't). It's probably not a great idea to have rubocop -a
start downloading resources, too.
Agree. Though there's probably a more generic audit possible here: one that checks a URL's declared |
Thinking about this a little more: in what situations would a checksum not match but the install would still succeed? As far as I know the only time How often would you use something like this? It could be a |
This never happens. The install fails as soon as there is a checksum mismatch.
You can use it when you've used a |
How about a Maybe |
Maybe, but I'm thinking there are still circumstances you'd want to verify the sources even without needing to install a formula. For instance, I think regularly checking whether our sources still exist and have matching checksums might be useful, instead of discovering them in PRs that test lots of formulae (e.g. Go, Python, Rust). It would need to be a non-failing test, because these tarballs disappear / get retagged all the time. But knowing ahead of time could be helpful. Though I guess it's also not a good idea to download 6000+ tarballs and check them in a single CI run, so maybe just waiting till we have to install something is fine. |
Just thinking out loud, maybe this command could have a Could also have a It doesn't feel like the kind of thing that needs to or should happen on every PR run which is why I'm kind of pushing for a command like this rather than an audit. I wouldn't be opposed to an audit though if it seems like that makes more sense. Also, we could have this command run once a day or once a week and post updates to an issue of all checksum mismatches to help us stay on top of things. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Any new thoughts on such a command? Either way, I think this can be merged if we remove the autocorrection, right? |
Hadn't really had the chance to think about it 😅
And deactivate the audit temporarily so that the PRs in {home,linux}brew/core can be merged. |
e7219f8
Thanks @Rylan12. Will update my core PRs. |
(Oops, more merge conflicts from #11170) |
Only `.diff` URLs return output comparable to the diffs from `git diff --full-index`. While the extra metadata from `.patch` is nice, the instability of the patch contents is undesirable. Co-Authored-By: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Great! I've updated this branch to fix the conflicts. I've also commented this audit out with a |
Follow-up in #11191 |
Only
.diff
URLs return output comparable to the diffs fromgit diff --full-index
. While the extra metadata from.patch
is nice, the instability of the patch contents is undesirable. This has caused issues with patch contents changing over time, for example in Homebrew/homebrew-core#43156 and Homebrew/homebrew-core#72297.I'll coordinate getting this into homebrew/core and linuxbrew/core but it will take a little while.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?