Page MenuHomeFreeBSD

Simplify and improve the mysql/mariadb ports and packages.
Needs ReviewPublic

Authored by arrowd on Feb 16 2024, 11:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 27, 7:42 AM
Unknown Object (File)
Sun, Jan 25, 11:46 AM
Unknown Object (File)
Wed, Jan 7, 9:09 PM
Unknown Object (File)
Wed, Dec 31, 1:27 AM
Unknown Object (File)
Dec 30 2025, 3:06 PM
Unknown Object (File)
Dec 16 2025, 12:37 AM
Unknown Object (File)
Dec 8 2025, 6:47 AM
Unknown Object (File)
Nov 27 2025, 1:14 PM
Subscribers

Details

Reviewers
joneum
brnrd
tcberner
Group Reviewers
portmgr
Summary

Changes:

  • only one client port for each provider:
    • databases/mysql-client
    • databases/mariadb-client
  • servers install to ${LOCALBASE}/${provider}${version}
  • new default version MYSQL_CLIENT_DEFAULT=mysql|mariadb
  • mysql.mk only adds run or build depends on ${MYSQL_CLIENT_DEFAULT}

The greatest benefit of this is, that one can have multiple
mysql/mariadb servers installed at once; which makes migrations
to never server versions finally easier.

The respective client ports should be kept at the version of the latest
provided server package. So if there is a databases/mysql82-server port
in the future, databases/mysql-client should be updated to use that one.

Note: the clients are backwards compatible.

This is following the idea proposed back in 2015 [1] for the postgresql ports.
I plan to implement the same "one client-port, multiple-server ports in prefix"
for them as well after this change is finished.

[1] https://lists.freebsd.org/pipermail/freebsd-ports/2015-July/099842.html

TODO:

  1. Test the change ;-) -- ideally by someone who has actually some DBs
  2. Remove IGNORE_WITH_MYSQL -- as the packages no longer pull in a server this becomse meaning less. You just installl the package and a compatible server backend.
  3. Cleanup dependencies -- there are ports that have specific server options. They should be removed, as servers should be chosen by the administrators.
  4. Double-check the RC scripts that they make sense this way.
  5. Fix up plists in the server ports (they stage, but maybe could need some love :D) [...] n) Bump revision of all ports with USES=mysql

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 56071
Build 52960: arc lint + arc unit

Event Timeline

tcberner created this revision.

Made a first round of review, looking great!
I'll try to apply this to one of my machines running MySQL server to see how transition works.

databases/mariadb1011-server/files/mariadb1011-server.in
30

Is this a typo (mysql1011 != mariadb1011) ?

databases/mariadb1011-server/pkg-plist
2

Why comment these files?

Anyways, they should be placed at appropriate lines, to make future make makeplist easier to merge.

247

I'm a bit confused that -server package installs client libraries. Is this because this port is reused for client too?

databases/mysql-client/Makefile
13

This one should also be ?= to allow user to override.

  • Fix mariadb1011-server.in
databases/mariadb1011-server/pkg-plist
2

I have no clue :) -- they come from line 273 from the original plist

247

afair there was a sed call in the Makefie to @comment the files from the client port in the server plist... but it does not seem to be present in all versions :D

${SED} '/%%/d;/^@comment /d;s/^/@comment /' ${PORTSDIR}/${CATEGORIES:[1]}/${PORTNAME}-client/pkg-plist \
        >> ${TMPPLIST}
tcberner added inline comments.
databases/mysql-client/Makefile
13

that wouldn't work as then PREFIX would be set from the -server port.

@joneum and @brnrd -- what are your opinions? :)

@joneum and @brnrd -- what are your opinions? :)

okay for me, even if I have to rewrite MySQL 82 and 83 :-)

This revision is now accepted and ready to land.Mar 4 2024, 8:28 PM
  • Rebase and bring to a committable state
This revision now requires review to proceed.Wed, Jan 28, 12:07 PM

To ease reviewing separate commits, here's a GitHub PR: https://github.com/arrowd/freebsd-ports/pull/9

arrowd added a reviewer: tcberner.

Next to mysql:server and mysql:client there should be a mysql:lib. Many ports depending on client actually need the library only.

Complicating here is that then you have even more conflicts between those. You even have to maintain multiple mariadb-connector-c versions for various MariaDB versions. Likely in MySQL too.
This involves a level of cmake skill, knowledge and experience I simply do not have.

The number of @comment lines in MariaDB plist is because the MariaDB CMake stuff does not allow for the way FreeBSD ports work. Building SERVER without CLIENT is not a thing. The SERVER and CLIENT options are broken; not all files are properly put in either.

Looong ago I have taken maintainership so the ports would actually be updated timely. If anyone with more CMake skillz wants to take over, I'd happily hand over or participate in a mariadb or mysql team.
New versions take considerable effort to port, some of the engines are broken (COKLUMNSTORE, ...).

Next to mysql:server and mysql:client there should be a mysql:lib.

This change is about removing both mysql:server and mysql;client.

Many ports depending on client actually need the library only.

You're talking about splitting mysql-client into executables and library itself? I don't think we should do that in this change, rather wait for subpackages to arrive and then reconsider.

You even have to maintain multiple mariadb-connector-c versions for various MariaDB versions.

Why? Right now the port doesn't seem to depend on anything server-ish.

One thing that I'm unsure about is the need to migrate /usr/local/etc/mysql/my.cnf to /usr/local/${SERVER}/etc/mysql/my.cnf. While I mention this in UPDATING it still feels like there is a high chance that end users would just do pkg upgrade without reading anything.

But this may be not that bad at all, because problem would arise only if a user made changes /usr/local/etc/mysql/my.cnf.

Another approach would be making mysql clients use /usr/local/etc/mysql/client.cnf as a default config file and then make the /usr/local/etc/mysql/my.cnf location deprecated, like we already did for /usr/local/etc/my.cnf.