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

cmd/install: fail when pkg not found #14397

Merged

Conversation

apainintheneck
Copy link
Contributor

@apainintheneck apainintheneck commented Jan 21, 2023

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This resolves #14361.

The idea here is to facilitate scripting by always failing whenever a package is not installed successfully. This is
how the upgrade and reinstall commands work but not install because we also search for similar package names before terminating.

The only thing to consider here is if anyone relies on the current behavior which would return success if the package didn't exist but a package with a similar name does exist. I can't see how this behavior would be useful for scripting or something you could consistently rely on so I think it's probably fine to change that behavior.

New Behavior

/u/l/Homebrew (fail-on-pkg-not-found-in-install|✔) $ HOMEBREW_NO_AUTO_UPDATE=1 brew install -n virtualsox
Warning: No available formula with the name "virtualsox". Did you mean virtualpg, virtuoso or virtualenv?
==> Searching for similarly named formulae and casks...
==> Formulae
virtualpg                              virtuoso                               virtualenv ✔

To install virtualpg, run:
  brew install virtualpg

==> Casks
virtual-ii         virtualbox ✔       virtualbox6        virtualc64         virtualgl          virtualhostx

To install virtual-ii, run:
  brew install --cask virtual-ii
/u/l/Homebrew (fail-on-pkg-not-found-in-install|✔) [1]$ echo $status
1

The idea here is to facilitate scripting
by always failing whenever a package
is not installed successfully. This is
how the upgrade and reinstall commands
work but not install because we also
search for similar package names before
terminating.
@BrewTestBot
Copy link
Member

Review period will end on 2023-01-24 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Jan 21, 2023
@apainintheneck apainintheneck marked this pull request as ready for review January 21, 2023 18:55
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Makes sense to me, thanks again @apainintheneck!

@MikeMcQuaid MikeMcQuaid added the critical Critical change which should be shipped as soon as possible. label Jan 23, 2023
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Jan 23, 2023
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@MikeMcQuaid MikeMcQuaid merged commit 7d599ea into Homebrew:master Jan 23, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Feb 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2023
@apainintheneck apainintheneck deleted the fail-on-pkg-not-found-in-install branch March 24, 2023 03:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a strict flag to the installation command
3 participants