-
-
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
Keep info/#{f.name}/dir
files in cleaner
#13215
Keep info/#{f.name}/dir
files in cleaner
#13215
Conversation
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 so far!
Library/Homebrew/cleaner.rb
Outdated
@@ -31,7 +31,11 @@ def clean | |||
# Get rid of any info 'dir' files, so they don't conflict at the link stage | |||
Dir.glob(@f.info/"**/dir").each do |f| | |||
info_dir_file = Pathname(f) | |||
observe_file_removal info_dir_file if info_dir_file.file? && [email protected]_clean?(info_dir_file) | |||
next if info_dir_file == Pathname("#{@f.info}/#{@f.name}/dir") |
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.
Can this get a new comment? It's not clear why this is fine to not remove.
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 if info_dir_file == Pathname("#{@f.info}/#{@f.name}/dir") | |
next if info_dir_file == @f.info/@f.name/"dir" |
I think we can also simplify it to 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 but: I still don't understand the "why" from this 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.
Oh, I agree with adding a comment explaining why. I'm just allergic to unnecessary interpolation, since they're harder to read and makes code less compact.
it "removes 'info/**/dir' files except for 'info/<name>/dir'" do | ||
file = f.info/"dir" | ||
arch_file = f.info/"i686-elf/dir" | ||
name_file = f.info/"#{f.name}/dir" |
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.
name_file = f.info/"#{f.name}/dir" | |
name_file = f.info/f.name/"dir" |
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 guess it shows that I'm neither a Ruby hacker nor a Homebrew dev. xD
I'll try these suggestions out. :)
|
||
f.info.mkpath | ||
(f.info/"i686-elf").mkpath | ||
(f.info/ + f.name.to_s).mkpath |
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.
(f.info/ + f.name.to_s).mkpath | |
(f.info/f.name).mkpath |
(f.info/"i686-elf").mkpath | ||
(f.info/ + f.name.to_s).mkpath |
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.
Or, maybe more simply:
(f.info/"i686-elf").mkpath | |
(f.info/ + f.name.to_s).mkpath | |
arch_file.dirname.mkpath | |
name_file.dirname.mkpath |
# | ||
# [1]: https://github.com/Homebrew/brew/pull/11597 | ||
# [2]: https://github.com/Homebrew/homebrew-core/issues/100190 | ||
# [3]: https://github.com/Homebrew/brew/pull/13215 |
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.
@MikeMcQuaid What do you think? It doesn't seems like we try to stay overly concise in most of the comments in this file but maybe this is a bit too flowery for what you were going for?
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.
No, this is absolutely wonderful, nice work.
@@ -96,7 +96,7 @@ | |||
it "removes '.la' files" do | |||
file = f.lib/"foo.la" | |||
|
|||
f.lib.mkpath | |||
file.dirname.mkpath |
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.
@carlocab I liked your suggestion so much I ported it over to the other tests that I cargo culted the original test from. :)
Still cleans `info/dir` and `info/<arch>/dir` files. Fixes Homebrew/homebrew-core#100190
ca7954c
to
0d81864
Compare
# | ||
# [1]: https://github.com/Homebrew/brew/pull/11597 | ||
# [2]: https://github.com/Homebrew/homebrew-core/issues/100190 | ||
# [3]: https://github.com/Homebrew/brew/pull/13215 |
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.
No, this is absolutely wonderful, nice work.
Thanks so much for your incredible first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @timvisher! |
@MikeMcQuaid @carlocab Thanks for the feedback and the merge! FWIW I was never able to actually test that this actually fixes the upstream issue with including the |
You can try doing |
@carlocab Looks good on my end then! :D What's the release process for bottles? If I'm reading things correctly it looks like they only get generated on a new changeset to the formula. I'm not finding any examples of this (where there's literally no change to the Formula other than that it should be rebuilt) but maybe the best way to approach that would be a change to the Emacs formula that adds a Edit: Maybe Homebrew/homebrew-core#100400?
|
Still cleans
info/dir
andinfo/<arch>/dir
files.Fixes Homebrew/homebrew-core#100190