Skip to content
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

Warn developers when uninstalling a dependency #1498

Merged
merged 4 commits into from
Nov 15, 2016

Conversation

alyssais
Copy link
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally? Only with keg: don't rely on #to_formula #1497 merged.

Suggested by @MikeMcQuaid in #1082 (comment).

Tests will fail as a side effect of #1496. When #1497 is merged, run the CI here again. It should go green and this should then be ready to merge.

I fixed the existing error message for non-developers as part of this too, so that it's output entirely to stderr. Previously, the first line was sent to stderr and subsequent ones went to stdout.

msg << " currently installed."
msg << "\nYou can silence this warning with "
msg << "`brew uninstall --ignore-dependencies "
msg << "#{requireds.map(&:name).join(" ")}`."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge this as-is but would be nice to refactor this to use EOS.undent and a bunch of variables declared before instead. Similarly below.

@@ -376,6 +376,14 @@ def ignore_interrupts(opt = nil)
trap("INT", std_trap)
end

def capture_stderr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think you can use shutup here. Again, won't let it block this PR but for post-merge refactoring that'd be good if it's possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think shutup returns the captured output. Would you be open to it being refactored to return the captured stdout and stderr?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, consolidation there makes sense although might want to tweak the name if we do that too. Definitely one for another PR 👍

@@ -376,6 +376,14 @@ def ignore_interrupts(opt = nil)
trap("INT", std_trap)
end

def capture_stderr
old, $stderr = $stderr, StringIO.new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brew style complains about the double assignment.

@MikeMcQuaid
Copy link
Member

Unfortunately still some (different) failing tests after rerunning.

@alyssais
Copy link
Contributor Author

Will aim to get this fixed today so you can merge.

Suggested in Homebrew#1084.

Made the existing warning output entirely to STDERR, because
previously the first line went to STDERR and subsequent ones went
to STDOUT.
@MikeMcQuaid
Copy link
Member

Thanks @alyssais!

@alyssais
Copy link
Contributor Author

Looks like the failures went away after rebased. Thought CI would merge into latest master, but I guess not?

@MikeMcQuaid
Copy link
Member

It does normally. Maybe Something Weird Happened.

msg << "`brew uninstall --ignore-dependencies "
msg << "#{requireds.map(&:name).join(" ")}`."
opoo msg
class DependentsMessage
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put all the shared stuff between the two messages into a class so it can be re-used between both of them. It's a bit longer, but I think much cleaner now.

@ilovezfs
Copy link
Contributor

Can we have an environment variable to make these warnings go away?

@alyssais
Copy link
Contributor Author

@ilovezfs could do. What's the motivation?

@ilovezfs
Copy link
Contributor

To not have a regression where I'm spammed with warnings.

@alyssais
Copy link
Contributor Author

@ilovezfs If you're getting spammed with warnings where you shouldn't be, should we not be fixing that rather than hiding it under an environment variable?

We've already had one bug (#1496) that went undetected for longer than it should have because developers had different functionality than non-developers, and I'd like to stop something like that happening again.

Can you clarify if there's an actual regression where Homebrew is warning you where it shouldn't be, or if you just consider the fact that there's a warning in the first place to be a regression?

@ilovezfs
Copy link
Contributor

the fact that there's a warning in the first place to be a regression

this.

Works around Rubycop not liking method names that start with `is_`
by changing convention from singular to plural.

I think it's better that way anyway.
@alyssais
Copy link
Contributor Author

That cask-tests failure looks unrelated but I'll investigate a little bit.

@MikeMcQuaid
Copy link
Member

Can we have an environment variable to make these warnings go away?

No.

@ilovezfs
Copy link
Contributor

Because ...

@MikeMcQuaid
Copy link
Member

MikeMcQuaid commented Nov 14, 2016

Because ...

I'd like to see far more than one person request such a thing before we add it.

We've already had one bug (#1496) that went undetected for longer than it should have because developers had different functionality than non-developers, and I'd like to stop something like that happening again.

This is a good argument.

@ilovezfs
Copy link
Contributor

The original feature was said to be disabled for developers. This makes it no longer disabled, and annoying in a novel way.

@MikeMcQuaid
Copy link
Member

Quoting myself:

In the interests of actually getting this 🚢d we'll disable it on HOMEBREW_DEVELOPER at first but longer-term we're going to figure out something better than just adding HOMEBREW_DEVELOPER to things a few maintainers don't like. Every other package manager does things this way and it's a good idea. If you have a flag to override and don't like typing it: you can create an alias.

@ilovezfs
Copy link
Contributor

Not cool.

@alyssais
Copy link
Contributor Author

Yep, I don't think the cask-tests failure is related to this.

@MikeMcQuaid
Copy link
Member

@alyssais Have trigged a rebuild. CC @reitermarkus or @jawshooah if this is still broken afterwards.

@MikeMcQuaid
Copy link
Member

@alyssais 💚 Will merge later, nice work!

@MikeMcQuaid MikeMcQuaid merged commit 484e3e0 into Homebrew:master Nov 15, 2016
@alyssais alyssais deleted the uninstall_developer_warning branch November 15, 2016 11:12
@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants