mariadb-common: Drop package and adjust configuration
authorMichal Hrusecky <michal.hrusecky@turris.com>
Fri, 29 Oct 2021 14:46:44 +0000 (16:46 +0200)
committerRosen Penev <rosenp@gmail.com>
Mon, 29 Nov 2021 09:47:45 +0000 (01:47 -0800)
The raison d'ĂȘtre of package mariadb-common was to provide common my.cnf
config file that was being used to include subdirectories and then to
push utf-8 as default everywhere. Let's make this file part of the
server package as there we actually set other options as well and drop
it from all clients. Instead let's set utf-8 as default in server,
client and client libraries. While at it also set socket to the more
common path and drop mysqld_safe script from the list of configuration
files and do other minor tweaks.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
libs/libmariadb/Makefile
libs/libmariadb/conf/50-client.cnf [deleted file]
utils/mariadb-common/Makefile [deleted file]
utils/mariadb-common/conf/my.cnf [deleted file]
utils/mariadb/Makefile
utils/mariadb/conf/50-mysql-clients.cnf [deleted file]
utils/mariadb/conf/my.cnf [new file with mode: 0644]

index 88ffb6e722944493e3695acce1d40a1becf1d680..74fcf0d2cf770b9c65aeb8d52889edb677fdc96f 100644 (file)
@@ -29,7 +29,7 @@ MARIADB_CONF_DIR:=/etc/mysql
 MARIADB_PLUGIN_DIR:=/usr/lib/mariadb/plugin
 
 MARIADB_PORT=3306
-MARIADB_SOCKET=/var/run/mysqld/mysqld.sock
+MARIADB_SOCKET=/var/run/mysql/mysql.sock
 
 MARIADB_CLIENT_PLUGINS := \
        auth_gssapi_client \
@@ -67,7 +67,7 @@ endef
 
 define Package/$(PKG_NAME)
   $(call Package/$(PKG_NAME)/Default)
-  DEPENDS:=+mariadb-common \
+  DEPENDS:= \
          $(ICONV_DEPENDS) \
          +libopenssl \
          +zlib
@@ -77,10 +77,6 @@ define Package/$(PKG_NAME)
   ABI_VERSION:=3
 endef
 
-define Package/$(PKG_NAME)/conffiles
-$(MARIADB_CONF_DIR)/conf.d/50-client.cnf
-endef
-
 define Package/$(PKG_NAME)/description
 $(call Package/$(PKG_NAME)/description/Default)
 
@@ -95,6 +91,8 @@ CMAKE_OPTIONS += -DWITH_UNIT_TESTS=0
 CMAKE_OPTIONS += -DCMAKE_CROSSCOMPILING=1
 
 CMAKE_OPTIONS += \
+       -DDEFAULT_CHARSET=utf8 \
+       -DDEFAULT_COLLATION=utf8_general_ci \
        -DINSTALL_INCLUDEDIR=include/mysql \
        -DINSTALL_LIBDIR=lib \
        -DINSTALL_PLUGINDIR=lib/mariadb/plugin \
@@ -155,7 +153,6 @@ define Package/$(PKG_NAME)/install
                $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/sha256_password.so \
                $(1)$(MARIADB_PLUGIN_DIR)
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libmariadb.so.$(ABI_VERSION) $(1)/usr/lib
-       $(INSTALL_DATA) conf/50-client.cnf $(1)$(MARIADB_CONF_DIR)/conf.d
 endef
 
 define BuildPlugin
diff --git a/libs/libmariadb/conf/50-client.cnf b/libs/libmariadb/conf/50-client.cnf
deleted file mode 100644 (file)
index de2b89f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# This group is read by the client library
-# Use it for options that affect all clients, but not the server
-#
-
-[client]
-# Default is Latin1, if you need UTF-8 set this (also in server section)
-default-character-set = utf8mb4
-
-# Example of client certificate usage
-# ssl-cert=/etc/mysql/client-cert.pem
-# ssl-key=/etc/mysql/client-key.pem
-#
-# Allow only TLS encrypted connections
-# ssl-verify-server-cert=on
-
-# This group is *never* read by mysql client library
-# If you use the same .cnf file for MySQL and MariaDB, use it for
-# MariaDB-only client options
-[client-mariadb]
-
diff --git a/utils/mariadb-common/Makefile b/utils/mariadb-common/Makefile
deleted file mode 100644 (file)
index 1c125b5..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Copyright (C) 2019 Sebastian Kemper <sebastian_ml@gmx.net>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=mariadb-common
-PKG_VERSION:=1.0
-PKG_RELEASE:=2
-
-PKG_MAINTAINER:=
-PKG_LICENSE:=GPL-2.0
-
-CONF_DIR:=/etc/mysql
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/mariadb-common
-  SECTION:=utils
-  CATEGORY:=Utilities
-  URL:=https://mariadb.org/
-  SUBMENU:=Database
-  TITLE:=MariaDB database common files
-  DEPENDS:=
-endef
-
-define Package/mariadb-common/conffiles
-$(CONF_DIR)/my.cnf
-endef
-
-define Package/mariadb-common/description
-MariaDB is a very fast and robust SQL database server.
-
-This package includes shared files, for example $(CONF_DIR)/my.cnf.
-
-endef
-
-define Package/mariadb-common/install
-       $(INSTALL_DIR) $(1)$(CONF_DIR)
-       $(INSTALL_DATA) conf/my.cnf $(1)$(CONF_DIR)
-endef
-
-define Build/Compile
-endef
-
-$(eval $(call BuildPackage,mariadb-common))
diff --git a/utils/mariadb-common/conf/my.cnf b/utils/mariadb-common/conf/my.cnf
deleted file mode 100644 (file)
index 7583c7c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# The MariaDB configuration file
-#
-# The MariaDB/MySQL tools read configuration files in the following order:
-# 1. "/etc/mysql/my.cnf" (this file) to set global defaults,
-# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
-# 3. "~/.my.cnf" to set user-specific options.
-#
-# If the same option is defined multiple times, the last one will apply.
-#
-# One can use all long options that the program supports.
-# Run program with --help to get a list of available options and with
-# --print-defaults to see which it would actually understand and use.
-
-#
-# This group is read both both by the client and the server
-# use it for options that affect everything
-#
-[client-server]
-
-# Import all .cnf files from configuration directory
-!includedir /etc/mysql/conf.d/
-
index a9c9eca937b17ee79406856f247c778473002508..d2f21dbad6452e8e6c03efe31b7a677518349a4f 100644 (file)
@@ -32,7 +32,7 @@ CONF_DIR:=/etc/mysql
 PLUGIN_DIR:=/usr/lib/mariadb/plugin
 SHARE_DIR:=/usr/share/mariadb
 
-MARIADB_SOCKET=/var/run/mysqld/mysqld.sock
+MARIADB_SOCKET=/var/run/mysql/mysql.sock
 
 MARIADB_DISABLE_ENGINES := \
        cassandra \
@@ -213,7 +213,8 @@ define Package/mariadb-client
   $(call Package/mariadb/Default)
   TITLE:=MariaDB database client
   MENU:=1
-  DEPENDS:=mariadb-client-base
+  DEPENDS:=$(MARIADB_COMMON_DEPENDS) \
+         +libedit
 endef
 
 define Package/mariadb-client/description
@@ -225,26 +226,6 @@ $(subst $(space),$(newline),$(MARIADB_CLIENT))
 
 endef
 
-define Package/mariadb-client-base
-  $(call Package/mariadb/Default)
-  TITLE:=MariaDB database client base
-  DEPENDS:=mariadb-common \
-         $(MARIADB_COMMON_DEPENDS) \
-         +libedit
-endef
-
-define Package/mariadb-client-base/conffiles
-$(CONF_DIR)/conf.d/50-mysql-clients.cnf
-endef
-
-define Package/mariadb-client-base/description
-$(call Package/mariadb/description/Default)
-
-This package provides the foundation for mariadb-client. It installs the
-configuration and the dependencies.
-
-endef
-
 define Package/mariadb-client-extra
   $(call Package/mariadb/Default)
   TITLE:=MariaDB database client extra
@@ -268,10 +249,6 @@ define Package/mariadb-server
   PROVIDES:=mysql-server
 endef
 
-define Package/mariadb-server/conffiles
-/usr/bin/mysqld_safe
-endef
-
 define Package/mariadb-server/description
 $(call Package/mariadb/description/Default)
 
@@ -283,7 +260,7 @@ endef
 
 define Package/mariadb-server-base
   $(call Package/mariadb/Default)
-  DEPENDS:=mariadb-common \
+  DEPENDS:= \
          $(MARIADB_COMMON_DEPENDS) \
          +!KERNEL_IO_URING:libaio \
          +KERNEL_IO_URING:liburing \
@@ -295,6 +272,7 @@ define Package/mariadb-server-base
 endef
 
 define Package/mariadb-server-base/conffiles
+$(CONF_DIR)/my.cnf
 $(CONF_DIR)/conf.d/50-server.cnf
 $(CONF_DIR)/conf.d/60-galera.cnf
 /etc/config/mysqld
@@ -359,6 +337,8 @@ CMAKE_OPTIONS += \
        -DCONNECT_WITH_MONGO=NO \
        -DCONNECT_WITH_ODBC=NO \
        -DDISABLE_SHARED=NO \
+       -DDEFAULT_CHARSET=utf8mb4 \
+       -DDEFAULT_COLLATION=utf8mb4_general_ci \
        -DENABLED_PROFILING=OFF \
        -DENABLE_STATIC_LIBS=OFF \
        -DINSTALL_DOCDIR=share/doc/mariadb \
@@ -370,6 +350,7 @@ CMAKE_OPTIONS += \
        -DINSTALL_PAMDATADIR="/etc/security" \
        -DINSTALL_PAMDIR="/lib/security" \
        -DINSTALL_PLUGINDIR=lib/mariadb/plugin \
+       -DINSTALL_PREFIX="/usr" \
        -DINSTALL_SBINDIR=bin \
        -DINSTALL_SCRIPTDIR=bin \
        -DINSTALL_SQLBENCHDIR="" \
@@ -482,11 +463,6 @@ define Package/mariadb-client/install
        cd $(1)/usr/bin; $(LN) mysqlcheck mysqloptimize
 endef
 
-define Package/mariadb-client-base/install
-       $(INSTALL_DIR) $(1)$(CONF_DIR)/conf.d
-       $(INSTALL_DATA) conf/50-mysql-clients.cnf $(1)$(CONF_DIR)/conf.d
-endef
-
 define Package/mariadb-client-extra/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(foreach b,$(MARIADB_CLIENT_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
@@ -507,6 +483,7 @@ define Package/mariadb-server-base/install
        $(SED) '/^[a-z]/s/^/#/' $(PKG_INSTALL_DIR)$(SHARE_DIR)/wsrep.cnf
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/wsrep.cnf $(1)$(CONF_DIR)/conf.d/60-galera.cnf
        $(INSTALL_DATA) conf/50-server.cnf $(1)$(CONF_DIR)/conf.d
+       $(INSTALL_DATA) conf/my.cnf $(1)$(CONF_DIR)
        $(INSTALL_CONF) files/mysqld.config $(1)/etc/config/mysqld
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/charsets/* $(1)$(SHARE_DIR)/charsets
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/english/errmsg.sys $(1)$(SHARE_DIR)/english
@@ -567,7 +544,6 @@ endef
 
 $(eval $(call HostBuild))
 $(eval $(call BuildPackage,mariadb-client))
-$(eval $(call BuildPackage,mariadb-client-base))
 $(eval $(call BuildPackage,mariadb-client-extra))
 $(eval $(call BuildPackage,mariadb-server))
 $(eval $(call BuildPackage,mariadb-server-base))
diff --git a/utils/mariadb/conf/50-mysql-clients.cnf b/utils/mariadb/conf/50-mysql-clients.cnf
deleted file mode 100644 (file)
index b762a76..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# These groups are read by MariaDB command-line tools
-# Use it for options that affect only one utility
-#
-
-[mysql]
-# Default is Latin1, if you need UTF-8 set this (also in server section)
-default-character-set = utf8mb4
-
-[mysql_upgrade]
-
-[mysqladmin]
-
-[mysqlbinlog]
-
-[mysqlcheck]
-
-[mysqldump]
-
-[mysqlimport]
-
-[mysqlshow]
-
-[mysqlslap]
-
diff --git a/utils/mariadb/conf/my.cnf b/utils/mariadb/conf/my.cnf
new file mode 100644 (file)
index 0000000..7583c7c
--- /dev/null
@@ -0,0 +1,22 @@
+# The MariaDB configuration file
+#
+# The MariaDB/MySQL tools read configuration files in the following order:
+# 1. "/etc/mysql/my.cnf" (this file) to set global defaults,
+# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
+# 3. "~/.my.cnf" to set user-specific options.
+#
+# If the same option is defined multiple times, the last one will apply.
+#
+# One can use all long options that the program supports.
+# Run program with --help to get a list of available options and with
+# --print-defaults to see which it would actually understand and use.
+
+#
+# This group is read both both by the client and the server
+# use it for options that affect everything
+#
+[client-server]
+
+# Import all .cnf files from configuration directory
+!includedir /etc/mysql/conf.d/
+