-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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: add rubocop for old bottle syntax #10453
Conversation
Review period will end on 2021-01-29 at 20:40:25 UTC. |
A few initial thoughts (haven't gone through the code at all). Is it possible/would it make sense to align the hashes? It would cause the bottle block to go from bottle do
sha256 cellar: :any, big_sur: "b95aa332dfc7c6dfb5e86fd30068f78e2cf87ee0232e5bef0adddae8215f543d"
sha256 cellar: :any, arm64_big_sur: "b480ed6baf10880f61b5a3097fb0921d44466857e1dde53a09e2ae4e378b1a8c"
sha256 cellar: :any, catalina: "8ec66cf6faa310712767efc3022fdd16568a79234439f64bf579acb628f893bc"
sha256 cellar: :any, mojave: "245a43a59c57f83848e7382974bb80a46eac1d53bcaefb1bdebd1f85107d4169"
sha256 cellar: :any, high_sierra: "30548658b43cf66979f2756680fbb32d3c19c967e478ceea22d07f536b22bbce"
sha256 cellar: :any, sierra: "f822b4dbab4a15b889316b89248c7b4d15d6af9dc460bf209b9425b0accb7fa3"
sha256 cellar: :any, el_capitan: "3f912f6f1ce6c586128ebde29756c883b89409e652ca7aa9a29a773c2d4d0915"
sha256 cellar: :any, yosemite: "5b969eb38b90a3e31869586df9d62e59d359212b16c6a270aee690dd67caa491"
end to bottle do
sha256 cellar: :any, big_sur: "b95aa332dfc7c6dfb5e86fd30068f78e2cf87ee0232e5bef0adddae8215f543d"
sha256 cellar: :any, arm64_big_sur: "b480ed6baf10880f61b5a3097fb0921d44466857e1dde53a09e2ae4e378b1a8c"
sha256 cellar: :any, catalina: "8ec66cf6faa310712767efc3022fdd16568a79234439f64bf579acb628f893bc"
sha256 cellar: :any, mojave: "245a43a59c57f83848e7382974bb80a46eac1d53bcaefb1bdebd1f85107d4169"
sha256 cellar: :any, high_sierra: "30548658b43cf66979f2756680fbb32d3c19c967e478ceea22d07f536b22bbce"
sha256 cellar: :any, sierra: "f822b4dbab4a15b889316b89248c7b4d15d6af9dc460bf209b9425b0accb7fa3"
sha256 cellar: :any, el_capitan: "3f912f6f1ce6c586128ebde29756c883b89409e652ca7aa9a29a773c2d4d0915"
sha256 cellar: :any, yosemite: "5b969eb38b90a3e31869586df9d62e59d359212b16c6a270aee690dd67caa491"
end I don't feel super strongly about this but it may add some uniformity if people like that. Separately, what's the plan for updating these? I have a bad feeling about doing a single commit that changes 5,465 files or even 5,465 commits that modify one file each. This means that the next |
I suppose #7867 provides a precedent: one commit for each formula |
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.
✅ Looks good to me. I do think we should have some tests for this if possible.
Library/Homebrew/rubocops/bottle.rb
Outdated
sha256_pair = sha256_pairs.first | ||
sha256_key = sha256_pair.key | ||
sha256_value = sha256_pair.value | ||
next unless sha256_value.is_a?(AST::SymbolNode) |
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.
next unless sha256_value.is_a?(AST::SymbolNode) | |
next unless sha256_value.sym_type? |
Are these equivalent? If so, I think I prefer sym_type?
(although either is fine)
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, I'm pretty sure they're equivalent. This specific file probably isn't affected, but generally Sorbet doesn't like the *_type?
methods. Somewhat off-topic, but it'd be really cool if they ever eventually add support for this (#sym_type?
being equivalent to #is_a?(SymbolNode)
)
Ah right, I keep forgetting to do this 😄 Even with the checklist |
One question: we reuse the cellar we had and put it on each line. This does not take into account cases like this: It's not a big deal because it does not change anything compared to the old situation, but reformatting everything does not improve this. You actually need to rebuild the whole formula to get the right output. |
For the tests, I believe you have split it so each |
This is really not nice to read: bottle do
sha256 big_sur: "cb2cb92999ff78e4f3ecfb57fca6782c481f6fe9abd5947e3f24569c3066c94b"
sha256 cellar: :any, arm64_big_sur: "5970413cf75bce3e0908c0bc02fafe96d83559eec80e618e264638b007673efd"
sha256 catalina: "dbdbf05a94e97c5acec62d09272dc407f42244a0d2546ac6f273843484142183"
sha256 mojave: "99139c8d3d78914799034b4ce56aeefa106be643eff5ab2952b06eeff98231db"
end Any thoughts on either (or both) of:
|
Fine with me, I'd suggest before.
I'm not opposed to aligning. I'm slightly opposed to |
By the way, you could also have |
I think this would be fine to do all in one commit, for a rare change, because it's affecting pretty much every single formula. I have no preference either way, though. For one-formula-per-commit you may find this useful: https://github.com/MikeMcQuaid/dotfiles/blob/master/bin/git-commit-each |
Also: if we change the style/indentation: let's also update the relevant |
Review period ended. |
Okay, so it looks like this is the general consensus:
So if we assume a theoretical macOS 12 is named Grand Canyon, this is how a bottle do
sha256 cellar: :any, arm64_grand_canyon: "eae6eb45b833a50f13c19bb07d55f1bfffa60da9dadb855433f54b75c63beaf2"
sha256 cellar: :any, arm64_big_sur: "5970413cf75bce3e0908c0bc02fafe96d83559eec80e618e264638b007673efd"
sha256 grand_canyon: "f2fec3bcae901be1a6607884ed095a133670f86fe601bdb9b5c27205e9755ea2"
sha256 big_sur: "cb2cb92999ff78e4f3ecfb57fca6782c481f6fe9abd5947e3f24569c3066c94b"
sha256 catalina: "dbdbf05a94e97c5acec62d09272dc407f42244a0d2546ac6f273843484142183"
sha256 mojave: "99139c8d3d78914799034b4ce56aeefa106be643eff5ab2952b06eeff98231db"
end Without checksums aligned: bottle do
sha256 cellar: :any, arm64_grand_canyon: "eae6eb45b833a50f13c19bb07d55f1bfffa60da9dadb855433f54b75c63beaf2"
sha256 cellar: :any, arm64_big_sur: "5970413cf75bce3e0908c0bc02fafe96d83559eec80e618e264638b007673efd"
sha256 grand_canyon: "f2fec3bcae901be1a6607884ed095a133670f86fe601bdb9b5c27205e9755ea2"
sha256 big_sur: "cb2cb92999ff78e4f3ecfb57fca6782c481f6fe9abd5947e3f24569c3066c94b"
sha256 catalina: "dbdbf05a94e97c5acec62d09272dc407f42244a0d2546ac6f273843484142183"
sha256 mojave: "99139c8d3d78914799034b4ce56aeefa106be643eff5ab2952b06eeff98231db"
end Also, considering that ARM will likely replace Intel, similar to how PowerPC was replaced, would it make sense to start adding a prefix like |
I think it should be okay to do multiple calls of
|
These all seem good to me 👍🏻
Can you elaborate on this? Is it that they are incorrectly marked as
To future macOS versions: yeh, perhaps. I think we should avoid changing the naming of bottles after we've started shipping them for a given OS. My thinking is/was also that in a few years (<5?) we'll probably see a new macOS version that doesn't support Intel at all. |
👍 from me as well on these. One other thing to do at some point (even if it's not in this PR) is to update the bottle docs. |
Yes Dealing with some personal issues, so if anyone would like to take over this PR please feel free to do so |
I'm happy to take this up, but I'll need to wait for tomorrow (it's too late here). I don't totally understand the arm bottle issue. Is it because the arm bottles have different cellars from the intel bottles, but since support for differing cellars is very new, the bottles may be incorrectly labeled? If so, that's not really a problem with this PR, right? That will require re-bottling. It sounds like moving forward with this (using the existing cellar line) and letting version-bump-bottling handle the updates is the best way to go? Alternatively, I guess we could label all arm bottles as having the default cellar (meaning not |
I saw that. Before, this was hidden by the
Yes, this is unrelated to this PR. Linux bottles might also have different cellar lines, so I am not surprised there are differences on Mac too.
It depends if the cellar line is legit or was wrongly generated due to a bug in brew. If you consider that a cellar line is wrong, you need to find out why and fix the bug in brew first, before starting to rebottle things. |
@SeekingMeaning Hope you're ok ❤️
@Rylan12 That'd be great!
Agreed 👍🏻 |
(Would like to land this for Homebrew 3.0.0) |
6e4bc20
to
a632cbc
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f67eef7
to
c6e8896
Compare
Pretty busy today but trying to help move this along. This currently fails if the bottle block only has a single, old-style bottle. bottle node (single bottle)
bottle node (multiple bottles)
|
c6e8896
to
fd65ada
Compare
Thanks. Should be fixed now. |
Here's the current status of this PR:
Currently, this is failing because homebrew/core and linuxbrew/core haven't been updated to use the new syntax. I believe that we should be able to change those over to the new syntax without breakage, but there will be a period of time where new bottles being added are still in an outdated style. It might be useful to either make this style rule a string rule (temporarily) until all formulae have been migrated. Or, the Running |
Why would this be the case? I thought once this pull request is merged all newly written bottle blocks should be in the new format.
The Linux merge shouldn't be too much of an issue since we have various merge conflict scripts that can be adapted to handle this. |
Ah, you're right. I forgot that the changes are applied during the merge not the test (i.e.
👍 That's good to hear |
Homebrew/core PR opened: Homebrew/homebrew-core#70283 Assuming this is deemed ready tomorrow, @jonchang and I will coordinate merging in homebrew/core, linuxbrew/core, and here to minimize the time for potential mixing of old and new bottle syntax. The good thing is that since this new syntax is fully supported already, a mistake in the merge procedure should only cause CI breakage temporarily and should not negatively affect users. |
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.
Great work here, thanks again all!
Co-authored-by: Rylan Polster <rslpolster@gmail.com> Co-authored-by: Seeker <meaningseeking@protonmail.com>
fd65ada
to
6e3011a
Compare
Thanks, everyone! |
brew style --fix ./Formula/* Homebrew/brew#10453
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?Part 3 of #9315
brew style --fix homebrew/core
: SeekingMeaning/homebrew-core@tmp-new-bottle-syntax5467 files inspected, 36416 offenses detected, 36416 offenses corrected
Before:
After: