-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
tap: run readall when tapping. #396
Conversation
@@ -221,10 +221,11 @@ def install(options = {}) | |||
|
|||
begin | |||
safe_system "git", *args | |||
safe_system "brew", "readall", name |
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.
We should use HOMEBREW_BREW_FILE
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 doesn't hurt to check the aliases of the to-be-installed tap, too. Thus, I'd suggest:
safe_system HOMEBREW_BREW_FILE, "readall", "--aliases", name
Have addressed feedback. |
I guess this is the first time an integration test tries to run a |
|
Bundler.with_original_env do | ||
ENV["HOMEBREW_BREW_FILE"] = HOMEBREW_PREFIX/"bin/brew" | ||
ENV["HOMEBREW_BREW_FILE"] = cmd_exec.join " " |
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 don't think this is going to work and, more importantly, I don't think we want to do this. HOMEBREW_BREW_FILE
should be a path to the bin/brew
script, not a loose collection of arguments to be interpreted by a shell. I think fixing nested brew
invocations in integration tests definitely needs some more thought and likely a separate PR.
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.
It does work. Given it's affecting only the integration tests and they pass I personally don't see the problem. Do you have a suggestion for another approach?
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.
(note tests are now 💚)
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.
One problem is that these instances re-use the same test identifier and thus overwrite each other's coverage data when running with --coverage
. There might be more issues, but to be honest, I haven't spent much time thinking about 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.
Assuming this is what cmd_id_from_args
/HOMEBREW_INTEGRATION_TEST
are doing: the arguments here will be handled correctly.
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.
And the coverage looks correct from local inspection.
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, that's what cmd_id_from_args
is for. The nested brew readall
spawned from brew tap
doesn't go through this code again (unless I'm missing something). Thus it re-uses the same ID and gets its result overwritten by the brew tap
process that finishes later.
If this worked as it probably should, I'd expect brew tests --coverage --only=integration_cmds/tap
to have nonzero coverage for cmd/readall.rb
, but that's not something I can observe locally.
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 see what you mean, will check this out further.
Reworked this so it doesn't run a |
|
||
module Readall | ||
class << self | ||
def valid_ruby_syntax?(ruby_files) |
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.
Would you mind adding a check that ruby_files
is a Queue
instance or alternatively convert it to a queue if it isn't already one? I think it's not obvious on the call site that a Queue
needs to be supplied and if an Array
is used, then the code will try to use it (which is not thread-safe), will fortunately fail, but with a rather cryptic error message:
TypeError: no implicit conversion of true into Integer
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.
Sure.
Big 👍 on the
|
Addressed all commits, split into two commits. |
Spotted one minor style issue (didn't notice any others, but maybe RuboCop sees more), thus a final re-run of RuboCop on the modified files before pulling this would be appreciated. Other than that, it looks good to me. Thanks for addressing everything! 👍 when 🍏. |
This will prevent tapping an tap with syntax errors from causing issues for users. Fixes #58.
On systems prior to 10.9, formulae that use CVS as a download source check whether the installed Xcode already provides CVS to avoid adding a dependency on the `cvs` formula. Unfortunately, if no Xcode is installed the check fails with undefined method `<' for nil:NilClass causing the formula to become unloadable. This in turn causes some taps to be untappable since #396 added the `readall` check on `tap`. Closes #508.
* readall: move readall logic to new class. * tap: run readall when tapping. This will prevent tapping an tap with syntax errors from causing issues for users. Fixes Homebrew#58.
On systems prior to 10.9, formulae that use CVS as a download source check whether the installed Xcode already provides CVS to avoid adding a dependency on the `cvs` formula. Unfortunately, if no Xcode is installed the check fails with undefined method `<' for nil:NilClass causing the formula to become unloadable. This in turn causes some taps to be untappable since Homebrew#396 added the `readall` check on `tap`. Closes Homebrew#508.
brew tests
with your changes locally?This will prevent tapping an tap with syntax errors from causing issues
for users.
Fixes #58.