Skip to content

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?

Rather than calling Formula#recursive_requirements, which doesn't allow the block passed to Formula#recursive_dependencies to be overridden, and thus causes TapFormulaUnavailableErrors, we can use the list of dependencies that were just worked out and check all of those (plus the root formula) for dependencies.

This also fixes #1776, because Formula#recursive_dependents by default (as called in Formula#recursive_requirements) prunes all optional dependencies — with no way for the caller to override this.

Fixes Homebrew#1848 by sharing recursive dependency resolution between
dependencies and requirements.

Coincidentally, this also fixes the errors introduced by Homebrew#1784 that
necessitated it being reverted in Homebrew#1797.
alyssais added a commit to alyssais/brew that referenced this pull request Jan 16, 2017
This is a temporary measure until:

- Homebrew#1862 is merged
- I can a test on `brew uses` against every formula in the official
  taps to verify that exceptions are no longer raised.
@MikeMcQuaid
Copy link
Member

This seems reasonable, thanks 👍 Can you provide some test cases for verifying this?

@MikeMcQuaid
Copy link
Member

Sorry, manual test cases to run brew uses.

@alyssais
Copy link
Contributor Author

Can you provide some test cases for verifying this?

Sorry, manual test cases to run brew uses.

Sure. Here's my example from #1848.

brew tap homebrew/science
brew uses --recursive --include-optional gcc

Currently, this doesn't include homebrew/science/dlib. With this change, it will.

Another example:

brew tap homebrew/science
brew untap homebrew/apache
brew uses --recursive adam

Previously, this would raise an exception. Now it doesn't. You can verify whether an exception is raised by adding a puts to the no-op rescue block in uses.rb.

@MikeMcQuaid MikeMcQuaid merged commit 1497dfa into Homebrew:master Jan 17, 2017
@MikeMcQuaid
Copy link
Member

Tested, worked, nice work again @alyssais!

@alyssais alyssais deleted the uses_include_optional branch January 17, 2017 20:32
@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.

brew uses with --include-optional doesn't return used formula

2 participants