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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

formulary: use formula path when loading from bottle #8531

Merged

Conversation

SeekingMeaning
Copy link
Contributor

@SeekingMeaning SeekingMeaning commented Aug 29, 2020

  • 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 tests with your changes locally?

This makes a small but significant change to Formulary::BottleLoader - the call to Formulary.from_contents should be given the path to the formula instead of the bottle file path. This allows the formula tap to be properly determined as it uses the path argument to make this determination.

As far as I can tell, passing @bottle_filename was having no effect as usually this would be an arbitrary filepath that would make Tap.from_path return nil

For example,

  • path could be /usr/local/Homebrew/Library/Taps/myorg/mytap2/myformula.rb, and
  • @bottle_filename could be ~/Downloads/bottles/myformula--0.0.1.catalina.bottle.tar.gz

This patch allows a formula that has the same name as another formula in a different tap to be installed from a bottle file.

Before:

$ brew install myformula--0.0.1.catalina.bottle.tar.gz
Error: Formulae found in multiple taps: 
       * myorg/mytap1/myformula
       * myorg/mytap2/myformula

Please use the fully-qualified name (e.g. myorg/mytap1/myformula) to refer to the formula.

After:

$ brew install myformula--0.0.1.catalina.bottle.tar.gz
==> Installing myformula from myorg/mytap2/myformula
馃嵑  /usr/local/Cellar/myformula/0.0.1: 42 files, 123.4KB

@SeekingMeaning SeekingMeaning changed the title formulary: use formula path when installing bottle formulary: use formula path when loading from bottle Aug 29, 2020
@MikeMcQuaid MikeMcQuaid merged commit d6d0e32 into Homebrew:master Aug 31, 2020
@MikeMcQuaid
Copy link
Member

Very nice, thanks @SeekingMeaning!

@SeekingMeaning SeekingMeaning deleted the formulary/bottle-formula-path branch August 31, 2020 16:04
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 14, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants