There's enough of these now that we should move them into requirements.rb:
git grep -l -i "(my|postgre)s(ql)?installed" | wc -l
So that we can just tell contributors to add depends_on MysqlInstalled.new or depends_on :mysql rather than explain requirements and have them copy/paste the class from another formula.
Agreed; should use symbol form, or at least, not something that requires .new on the end.
This looks interesting. I wonder whether other commonly used and CPU-eating packages can be handled the same way, such as QT, cmake, etc. to name a few.
Agreed on symbol form but disagree on implementation; I think these should just install the package by default if the dependency isn't there. Can we do something similar with Fortran?
The many times I have had to install something that depends on Fortran and it stops and tells me to install my own fortran or Homebrew's I have every time felt it ridiculous that a package manager is asking me if I should install its package of fortran or not.
Install the package.
Well with MySQL some time shit only needs a client library to connect to any MySQL instance (say, the one I run in a VM), not a fucking full on MySQL database sitting there.
In which case we just pull in the client library?
I'm confused. There is zero behavior change here, it's just code cleanup.
Aye, it's not your change that's a problem. It just seems a good place to whinge about requirements being used like this.
Could something like :mysql_clib, :postgresql_clib work for these, that would if no mysql installed, install mysql-connector-c/mysql-connector-c++/libpq and then recommends you brew mysql or official same as before. Everything should be compatible with these libraries right ? I'm gonna try it now
depends_on :mysql => :client
The problem is that the decision between them is basically user configuration. For what it's worth I think we should just default to the connector when it's e.g. a library like Qt and the server if it's anything where they'd want it on their machine (e.g. Ruby on Rails or something similar).
postgresql does not provide libpq source separately (I have sent them email if they'd be interested in providing it separately). Would it be possible for :postgresql and :mysql to show with brew deps ? Is there option to link symlinks for formula ? and maybe disable libmysqlclient in mysql formula ?
For it to work seamlessly connector formula should link symlinks in lib folder. not everyone detects libmysql.
That would segregate these two into pure server and pure connector formulas and nothing would depend on server formulas.
As it is, the user has complete control over how they want to manage their mysql/postgres installation. Nobody has complained. I don't see any reason to try and make decisions for the user at this point.
Let's just keep what we have and move the repeated classes to symbols. Then open a new Issue to mess with the impl, if someone really wants to do that. (Note, if someone really wants to do that, submit code, not just a suggestion.)
I'm complaining and I've had people complain to me in-person about this. I'll submit code.
That already exists in #14456, is being codified using => :optional and => :recommended, and is solving a different problem than what is being discussed.
Pushed my patch; tweaks to the actual implementation or semantics can come later.
It doesn't quite work: Error: No available formula for pg_top :-/
Error: No available formula for pg_top
I typo'd it, fixed in 84cc549
It would be nice that brew deps would later on be able to recognize these cases and maybe print them:
mysql (through homebrew or official installer)
postgresql (through homebrew or official installer)