Multiple Versions of Ports?

CoryG

Member

Reaction score: 8
Messages: 83

My current issue revolves around apache24 and gitea and a few other ports requiring postgresql12-client as a connector, which blocks the installation of postgresql14-client needed by postgresql14-server to play around with some of the newer features in my home lab, and I'd be curious about a recommended solution to that (my current workaround is uninstalling postgresql12-client along with dependencies, installing postgresql14-server, then attempting the reinstall of everything else and seeing if it works out, though this has been a pretty frequent issue over the years with various ports and packages and it got me thinking on if a more generalized solution might exist.

Would it be possible to do something like (using a random example just because I know the directory structure offhand)

  1. apache23 and apache24 installed side-by-side
  2. directory tree:
    1. config files
      1. /usr/local/etc/apache/default/ - symlink to current version
      2. /usr/local/etc/apache/23/
      3. /usr/local/etc/apache/24/
    2. binary files
      1. /usr/local/sbin/httpd - symlink to current version
      2. /usr/local/sbin/httpd-23
      3. /usr/local/sbin/httpd-24
when making/installing ports using the existing ports system without the need to modify every individual package, preserving the dependencies by pointing them at different target locations?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,365

The ports tree allows you to set defaults for various things, like the postgresql version. See /usr/ports/Mk/bsd.default-versions.mk. If you want to switch to a different version add to /etc/make.conf: DEFAULT_VERSIONS+= postgresql=14. But the ports tree is treated as a whole, switching back and forth between these two will inevitably break dependency chains and you'll end up in dependency hell. Especially if you try to do this "in-place" by building from ports.

You can actually solve this relatively easy by setting up your own repository with ports-mgmt/poudriere. Just build two repositories, one based on PostgreSQL 12 and one based on 14. Then on your client you can switch between the repositories by switching active repositories. I've done this for a client that's in a transition period between Ruby 2.5, 2.6 and 2.7 (yes, I ended up with 3 repositories).

Code:
repo12: {
  enabled: yes
  url: http://myrepo.server/packages/repo12
}
repo14: {
  enabled: no
  url: http://myrepo.server/packages/repo14
}
Then only enable the one you need, a pkg upgrade on the client will take care of the switching for you. This will ensure your dependencies all correctly line up.
 
OP
C

CoryG

Member

Reaction score: 8
Messages: 83

Is it possible to get the postgresql12-client used by apache and gitea and others to be used/available at the same time as postgresql14-server? The 14-server port screams about not having the ability to install 14-client because 12-client is already installed. It could definitely be hacked around as described but I'd prefer a way that doesn't involve manually editing ports which depend on a client library if at all possible.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,365

Is it possible to get the postgresql12-client used by apache and gitea and others to be used/available at the same time as postgresql14-server?
No, they're going to conflict because postgresqlXX-server depends on postgresqlXX-client. With XX being the version number. And you can't have version XX and version YY of the client installed at the same time (they're going to overwrite each other's files).

Apache24 doesn't depend on Postgresql client by the way. Not sure why you have that pulled in. Did you enable some module that requires it? As far as I can tell Gitea doesn't depend on Postgresql client either.
 

covacat

Aspiring Daemon

Reaction score: 335
Messages: 683

probably you can install with another PREFIX and do some LD_LIBRARY_PATH magic
or use jails or a combination of both
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,365

Or just remove the dependency of the postgresql client if it's not required to be used.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,365

Uses multiple instances of the same version. Not multiple, different versions of PostgreSQL.
 

fraxamo

Member

Reaction score: 65
Messages: 78

Uses multiple instances of the same version. Not multiple, different versions of PostgreSQL.
That's not what the OP was asking for though is it? If you look at the original post, the OP asked for the following:

My current issue revolves around apache24 and gitea and a few other ports requiring postgresql12-client as a connector, which blocks the installation of postgresql14-client needed by postgresql14-server to play around with some of the newer features in my home lab
 
Top