-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
formula_installer: avoid cyclic dependency on Linux #4622
Conversation
Just to clarify:
It would be nice to see a message when a cyclic dependency is detected/prevented. Alternative way to silently remove cyclic dependencies would be to add
before the |
Note that this issue arrises if diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index d9565ddd7..2c7846ad9 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -506,6 +506,7 @@ class FormulaInstaller
bottle_deps = Keg.relocation_formulae
.map { |formula| Dependency.new(formula) }
.reject do |dep|
+ next true if dep.name == formula.name
inherited_options[dep.name] |= inherited_options_for(dep)
dep.satisfied? inherited_options[dep.name]
end @iMichka If you agree, would you update this PR? |
I think this should perhaps handle |
Yes, my first attempt was to safeguard this only for the "patchelf" formula, because I think it will only be needed for the case. Something like this (untested) ?:
|
Take a look at It uses |
I think something like |
This special case occurs only when the requested formula to be installed ( diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index d9565ddd7..23380d043 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -503,7 +503,7 @@ class FormulaInstaller
end
if pour_bottle
- bottle_deps = Keg.relocation_formulae
+ bottle_deps = (Keg.relocation_formulae - [formula.name])
.map { |formula| Dependency.new(formula) }
.reject do |dep|
inherited_options[dep.name] |= inherited_options_for(dep) In my opinion, the patch should not specifically mention @MikeMcQuaid Do you have a preference between these two patches? As above or #4622 (comment) |
I'd suggest something that avoids that logic entirely if |
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index d9565ddd7..66a44a9cd 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -502,7 +502,7 @@ class FormulaInstaller
end
end
- if pour_bottle
+ if pour_bottle && !Keg.relocation_formulae.include?(formula.name)
bottle_deps = Keg.relocation_formulae
.map { |formula| Dependency.new(formula) }
.reject do |dep| @iMichka Could you please update this PR? |
@sjackman Looks good. You can edit this PR yourself though, too 😎 |
I'll do it. Just want to have a closer look at the code and run it locally, so I can learn a little bit more here :) |
Fixes: ==> Installing patchelf dependency: patchelf ==> Installing dependencies for patchelf: patchelf ==> Installing patchelf dependency: patchelf ==> Installing dependencies for patchelf: patchelf ==> Installing patchelf dependency: patchelf ==> Installing dependencies for patchelf: patchelf ...
Good to go for me. |
I have a feeling that this is not the right fix (it probably works but in a weird way). brew/Library/Homebrew/formula_installer.rb Lines 547 to 557 in bb49b50
If we look at line 413, brew/Library/Homebrew/formula_installer.rb Lines 412 to 415 in bb49b50
we'll see that brew/Library/Homebrew/formula_installer.rb Lines 392 to 398 in bb49b50
Assuming that |
@maxim-belkin I believe the problem is this line: brew/Library/Homebrew/formula_installer.rb Line 512 in 7ed3be5
On Linux |
You're right. |
Thanks all! |
brew style
with your changes locally?brew tests
with your changes locally?Fixes:
==> Installing patchelf dependency: patchelf
==> Installing dependencies for patchelf: patchelf
==> Installing patchelf dependency: patchelf
==> Installing dependencies for patchelf: patchelf
==> Installing patchelf dependency: patchelf
==> Installing dependencies for patchelf: patchelf
...