diff options
author | CoprDistGit <infra@openeuler.org> | 2023-08-20 10:47:28 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-08-20 10:47:28 +0000 |
commit | f0b08fdbf2ac1c6bbbeba9a96babfae8277ed3ef (patch) | |
tree | eeb9a49118267c48caeefb2bbfa3f9f8ba1e3658 | |
parent | de830acca23eae53159e3721fc648ce8a86427b7 (diff) |
automatic import of mariadbopeneuler23.03openeuler22.03_LTS_SP2openeuler22.03_LTSopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | LICENSE.clustercheck | 27 | ||||
-rw-r--r-- | README.mariadb-docs | 9 | ||||
-rw-r--r-- | clustercheck.sh | 89 | ||||
-rw-r--r-- | mariadb-check-socket.sh | 39 | ||||
-rw-r--r-- | mariadb-check-upgrade.sh | 39 | ||||
-rw-r--r-- | mariadb-logrotate.patch | 51 | ||||
-rw-r--r-- | mariadb-ownsetup.patch | 31 | ||||
-rw-r--r-- | mariadb-pcdir.patch | 19 | ||||
-rw-r--r-- | mariadb-prepare-db-dir.sh | 137 | ||||
-rw-r--r-- | mariadb-scripts-common.sh | 68 | ||||
-rw-r--r-- | mariadb-scripts.patch | 41 | ||||
-rw-r--r-- | mariadb-server-galera.te | 23 | ||||
-rw-r--r-- | mariadb-ssl-cipher-tests.patch | 13 | ||||
-rw-r--r-- | mariadb.spec | 1563 | ||||
-rw-r--r-- | mariadb.tmpfiles.d.in | 3 | ||||
-rw-r--r-- | my.cnf.in | 18 | ||||
-rw-r--r-- | mysql.service.in | 64 | ||||
-rw-r--r-- | mysql@.service.in | 85 | ||||
-rw-r--r-- | mysql_config_multilib.sh | 26 | ||||
-rw-r--r-- | skipped-tests-arm.list | 5 | ||||
-rw-r--r-- | skipped-tests-base.list | 54 | ||||
-rw-r--r-- | sources | 1 |
23 files changed, 2406 insertions, 0 deletions
@@ -0,0 +1 @@ +/mariadb-10.5.22.tar.gz diff --git a/LICENSE.clustercheck b/LICENSE.clustercheck new file mode 100644 index 0000000..609015d --- /dev/null +++ b/LICENSE.clustercheck @@ -0,0 +1,27 @@ +Copyright (c) 2012-2014, Olaf van Zandwijk +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.mariadb-docs b/README.mariadb-docs new file mode 100644 index 0000000..bff53eb --- /dev/null +++ b/README.mariadb-docs @@ -0,0 +1,9 @@ +MariaDB haven't yet made a document package available for offline. + +You can create your own copy with the instructions here: + +https://mariadb.com/kb/en/meta/mirroring-the-mariadb-knowledge-base/ + +You can find view the on-line documentation at: + +https://mariadb.com/kb/en/documentation/ diff --git a/clustercheck.sh b/clustercheck.sh new file mode 100644 index 0000000..3b405dc --- /dev/null +++ b/clustercheck.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# Script to make a proxy (ie HAProxy) capable of monitoring Galera cluster nodes properly +# +# Author: Olaf van Zandwijk <olaf.vanzandwijk@nedap.com> +# Author: Raghavendra Prabhu <raghavendra.prabhu@percona.com> +# Author: Ryan O'Hara <rohara@redhat.com> +# +# Documentation and download: https://github.com/olafz/percona-clustercheck +# +# Based on the original script from Unai Rodriguez +# + +if [ -f /etc/sysconfig/clustercheck ]; then + . /etc/sysconfig/clustercheck +fi + +MYSQL_USERNAME="${MYSQL_USERNAME-clustercheckuser}" +MYSQL_PASSWORD="${MYSQL_PASSWORD-clustercheckpassword!}" +MYSQL_HOST="${MYSQL_HOST:-127.0.0.1}" +MYSQL_PORT="${MYSQL_PORT:-3306}" +ERR_FILE="${ERR_FILE:-/dev/null}" +AVAILABLE_WHEN_DONOR=${AVAILABLE_WHEN_DONOR:-0} +AVAILABLE_WHEN_READONLY=${AVAILABLE_WHEN_READONLY:-1} +DEFAULTS_EXTRA_FILE=${DEFAULTS_EXTRA_FILE:-/etc/my.cnf} + +#Timeout exists for instances where mysqld may be hung +TIMEOUT=10 + +if [[ -r $DEFAULTS_EXTRA_FILE ]];then + MYSQL_CMDLINE="mysql --defaults-extra-file=$DEFAULTS_EXTRA_FILE -nNE \ + --connect-timeout=$TIMEOUT \ + --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} \ + --host=${MYSQL_HOST} --port=${MYSQL_PORT}" +else + MYSQL_CMDLINE="mysql -nNE --connect-timeout=$TIMEOUT \ + --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} \ + --host=${MYSQL_HOST} --port=${MYSQL_PORT}" +fi +# +# Perform the query to check the wsrep_local_state +# +WSREP_STATUS=$($MYSQL_CMDLINE -e "SHOW STATUS LIKE 'wsrep_local_state';" \ + 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) + +if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]] +then + # Check only when set to 0 to avoid latency in response. + if [[ $AVAILABLE_WHEN_READONLY -eq 0 ]];then + READ_ONLY=$($MYSQL_CMDLINE -e "SHOW GLOBAL VARIABLES LIKE 'read_only';" \ + 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) + + if [[ "${READ_ONLY}" == "ON" ]];then + # Galera cluster node local state is 'Synced', but it is in + # read-only mode. The variable AVAILABLE_WHEN_READONLY is set to 0. + # => return HTTP 503 + # Shell return-code is 1 + echo -en "HTTP/1.1 503 Service Unavailable\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 35\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is read-only.\r\n" + sleep 0.1 + exit 1 + fi + fi + # Galera cluster node local state is 'Synced' => return HTTP 200 + # Shell return-code is 0 + echo -en "HTTP/1.1 200 OK\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 32\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is synced.\r\n" + sleep 0.1 + exit 0 +else + # Galera cluster node local state is not 'Synced' => return HTTP 503 + # Shell return-code is 1 + echo -en "HTTP/1.1 503 Service Unavailable\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 36\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is not synced.\r\n" + sleep 0.1 + exit 1 +fi diff --git a/mariadb-check-socket.sh b/mariadb-check-socket.sh new file mode 100644 index 0000000..5c2b639 --- /dev/null +++ b/mariadb-check-socket.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# We check if there is already a process using the socket file, +# since otherwise the systemd service file could report false +# positive result when starting and mysqld_safe could remove +# a socket file, which is actually being used by a different daemon. + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +if test -e "$socketfile" ; then + echo "Socket file $socketfile exists." >&2 + + # no write permissions + if ! test -w "$socketfile" ; then + echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # not a socket file + if ! test -S "$socketfile" ; then + echo "The file $socketfile is not a socket file, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # some process uses the socket file + response=`/usr/bin/mariadb-admin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER --connect-timeout="${CHECKSOCKETTIMEOUT:-10}" ping 2>&1` + if [ $? -eq 0 ] || echo "$response" | grep -q "Access denied for user" ; then + echo "Is another MariaDB daemon already running with the same unix socket?" >&2 + echo "Please, stop the process using the socket $socketfile or remove the file manually to start the service." >&2 + exit 1 + fi + + # socket file is a garbage + echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2 +fi + +exit 0 diff --git a/mariadb-check-upgrade.sh b/mariadb-check-upgrade.sh new file mode 100644 index 0000000..740e4be --- /dev/null +++ b/mariadb-check-upgrade.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +upgrade_info_file="$datadir/mysql_upgrade_info" +version=0 +# get version as integer from mysql_upgrade_info file +if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then + version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/') + version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/') + if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then + version=$((version_major*100+version_minor)) + fi +fi + +# compute current version as integer +thisversion=$((10*100+5)) + +# provide warning in cases we should run mysql_upgrade +if [ $version -ne $thisversion ] ; then + + # give extra warning if some version seems to be skipped + if [ $version -gt 0 ] && [ $version -lt 505 ] ; then + echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2 + fi + + cat <<EOF >&2 +The datadir located at $datadir needs to be upgraded using 'mariadb-upgrade' tool. This can be done using the following steps: + + 1. Back-up your data before with 'mariadb-upgrade' + 2. Start the database daemon using 'systemctl start mariadb.service' + 3. Run 'mariadb-upgrade' with a database user that has sufficient privileges + +Read more about 'mariadb-upgrade' usage at: +https://mariadb.com/kb/en/mysql_upgrade/ +EOF +fi + +exit 0 diff --git a/mariadb-logrotate.patch b/mariadb-logrotate.patch new file mode 100644 index 0000000..f436a9d --- /dev/null +++ b/mariadb-logrotate.patch @@ -0,0 +1,51 @@ +diff -Naur mariadb-10.5.15/support-files/mysql-log-rotate.sh mariadb-10.5.15_patched/support-files/mysql-log-rotate.sh +--- mariadb-10.5.15/support-files/mysql-log-rotate.sh 2022-02-10 20:11:35.000000000 +0000 ++++ mariadb-10.5.15_patched/support-files/mysql-log-rotate.sh 2022-04-14 11:31:55.344000000 +0000 +@@ -3,36 +3,24 @@ + # in the [mysqld] section as follows: + # + # [mysqld] +-# log-error=@localstatedir@/mysqld.log +-# +-# If the root user has a password you have to create a +-# /root/.my.cnf configuration file with the following +-# content: +-# +-# [mysqladmin] +-# password = <secret> +-# user= root +-# +-# where "<secret>" is the password. +-# +-# ATTENTION: This /root/.my.cnf should be readable ONLY +-# for root ! ++# log-error=@LOG_LOCATION@ + +-@localstatedir@/mysqld.log { +- # create 600 mysql mysql ++@LOG_LOCATION@ { ++ create 600 mysql mysql + su mysql mysql + notifempty + daily + rotate 3 + missingok + compress ++ delaycompress ++ sharedscripts ++ + postrotate +- # just if mariadbd is really running +- if test -x @bindir@/mysqladmin && \ +- @bindir@/mysqladmin ping &>/dev/null +- then +- @bindir@/mysqladmin --local flush-error-log \ +- flush-engine-log flush-general-log flush-slow-log +- fi ++ # just if mariadbd is really running ++ if [ -e @PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ] ++ then ++ kill -1 $(<@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid) ++ fi + endscript + } diff --git a/mariadb-ownsetup.patch b/mariadb-ownsetup.patch new file mode 100644 index 0000000..7728cf1 --- /dev/null +++ b/mariadb-ownsetup.patch @@ -0,0 +1,31 @@ +--- mariadb-10.4.14/support-files/CMakeLists.txt 2020-08-06 17:28:28.000000000 +0200 ++++ mariadb-10.4.14/support-files/CMakeLists.txt_patched 2020-09-03 13:21:07.826658279 +0200 +@@ -187,6 +187,7 @@ IF(UNIX) + COMPONENT SharedLibraries) + INSTALL(FILES rpm/mysql-clients.cnf DESTINATION ${INSTALL_SYSCONF2DIR} + COMPONENT Client) ++ CONFIGURE_FILE(rpm/server.cnf ${CMAKE_CURRENT_SOURCE_DIR}/rpm/server.cnf @ONLY) + INSTALL(FILES rpm/server.cnf DESTINATION ${INSTALL_SYSCONF2DIR} + COMPONENT IniFiles) + INSTALL(FILES rpm/enable_encryption.preset DESTINATION ${INSTALL_SYSCONF2DIR} + +diff -up mariadb-10.0.15/support-files/rpm/server.cnf.ownsetup mariadb-10.0.15/support-files/rpm/server.cnf +--- mariadb-10.0.15/support-files/rpm/server.cnf.ownsetup 2015-01-24 23:55:55.110063592 +0100 ++++ mariadb-10.0.15/support-files/rpm/server.cnf 2015-01-24 23:57:42.308114387 +0100 +@@ -9,7 +9,16 @@ + [server] + + # this is only for the mysqld standalone daemon ++# Settings user and group are ignored when systemd is used. ++# If you need to run mysqld under a different user or group, ++# customize your systemd unit file for mysqld/mariadb according to the ++# instructions in http://fedoraproject.org/wiki/Systemd + [mysqld] ++datadir=@MYSQL_DATADIR@ ++socket=@MYSQL_UNIX_ADDR@ ++log-error=@LOG_LOCATION@ ++pid-file=@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ++ + + # + # * Galera-related settings diff --git a/mariadb-pcdir.patch b/mariadb-pcdir.patch new file mode 100644 index 0000000..117273a --- /dev/null +++ b/mariadb-pcdir.patch @@ -0,0 +1,19 @@ +Use PCDIR CMake option, if configured + +Upstream install the server pkgconfig file into arch-independent directory +Reported to upstream as: https://jira.mariadb.org/browse/MDEV-14340 + +--- mariadb-10.5.5/support-files/CMakeLists.txt.old 2020-09-30 10:36:08.582490318 +0200 ++++ mariadb-10.5.5/support-files/CMakeLists.txt 2020-09-30 10:38:58.079710848 +0200 +@@ -91,7 +91,11 @@ + ENDIF() + + CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY) ++IF(INSTALL_PCDIR) ++ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_PCDIR} COMPONENT Development) ++ELSE() + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_LIBDIR}/pkgconfig COMPONENT Development) ++ENDIF() + + INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development) + diff --git a/mariadb-prepare-db-dir.sh b/mariadb-prepare-db-dir.sh new file mode 100644 index 0000000..ada8ac2 --- /dev/null +++ b/mariadb-prepare-db-dir.sh @@ -0,0 +1,137 @@ +#!/bin/sh + +# This script creates the MariaDB data directory during first service start. +# In subsequent starts, it does nothing much. + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +export LC_ALL=C + +# Returns content of the specified directory +# If listing files fails, fake-file is returned so which means +# we'll behave like there was some data initialized +# Some files or directories are fine to be there, so those are +# explicitly removed from the listing +# @param <dir> datadir +list_datadir () +{ + ( ls -1A "$1" 2>/dev/null || echo "fake-file" ) | grep -v \ + -e '^lost+found$' \ + -e '\.err$' \ + -e '^.bash_history$' +} + +# Checks whether datadir should be initialized +# @param <dir> datadir +should_initialize () +{ + test -z "$(list_datadir "$1")" +} + +# If two args given first is user, second is group +# otherwise the arg is the systemd service file +if [ "$#" -eq 2 ] +then + myuser="$1" + mygroup="$2" +else + # Absorb configuration settings from the specified systemd service file, + # or the default service if not specified + SERVICE_NAME="$1" + if [ x"$SERVICE_NAME" = x ] + then + SERVICE_NAME=mariadb.service + fi + + myuser=`systemctl show -p User "${SERVICE_NAME}" | + sed 's/^User=//'` + if [ x"$myuser" = x ] + then + myuser=mysql + fi + + mygroup=`systemctl show -p Group "${SERVICE_NAME}" | + sed 's/^Group=//'` + if [ x"$mygroup" = x ] + then + mygroup=mysql + fi +fi + +# Set up the errlogfile with appropriate permissions +if [ ! -e "$errlogfile" -a ! -h "$errlogfile" -a x$(dirname "$errlogfile") = "x/var/log" ]; then + case $(basename "$errlogfile") in + mysql*.log|mariadb*.log) install /dev/null -m0640 -o$myuser -g$mygroup "$errlogfile" ;; + *) ;; + esac +else + # Provide some advice if the log file cannot be created by this script + errlogdir=$(dirname "$errlogfile") + if ! [ -d "$errlogdir" ] ; then + echo "The directory $errlogdir does not exist." >&2 + exit 1 + elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then + echo "The log file $errlogfile cannot be written, please, fix its permissions." >&2 + echo "The daemon will be run under $myuser:$mygroup" >&2 + exit 1 + fi +fi + +# Make the data directory if doesn't exist or empty +if should_initialize "$datadir" ; then + # First, make sure $datadir is there with correct permissions + # (note: if it's not, and we're not root, this'll fail ...) + if [ ! -e "$datadir" -a ! -h "$datadir" ] + then + mkdir -p "$datadir" || exit 1 + fi + chown "$myuser:$mygroup" "$datadir" + chmod 0755 "$datadir" + [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" + + # Now create the database + echo "Initializing MariaDB database" >&2 + # Avoiding deletion of files not created by mysql_install_db is + # guarded by time check and sleep should help work-arounded + # potential issues on systems with 1 second resolution timestamps + # https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19 + INITDB_TIMESTAMP=`LANG=C date -u` + sleep 1 + /usr/bin/mariadb-install-db --rpm --datadir="$datadir" --user="$myuser" --skip-test-db >&2 + ret=$? + if [ $ret -ne 0 ] ; then + echo "Initialization of MariaDB database failed." >&2 + echo "Perhaps /etc/my.cnf is misconfigured or there is some problem with permissions of $datadir." >&2 + # Clean up any partially-created database files + if [ ! -e "$datadir/mysql/user.frm" ] && [ -d "$datadir" ] ; then + echo "Initialization of MariaDB database was not finished successfully." >&2 + echo "Files created so far will be removed." >&2 + find "$datadir" -mindepth 1 -maxdepth 1 -newermt "$INITDB_TIMESTAMP" \ + -not -name "lost+found" -exec rm -rf {} + + if [ $? -ne 0 ] ; then + echo "Removing of created files was not successfull." >&2 + echo "Please, clean directory $datadir manually." >&2 + fi + else + echo "However, part of data has been initialized and those will not be removed." >&2 + echo "Please, clean directory $datadir manually." >&2 + fi + exit $ret + fi + # upgrade does not need to be run on a fresh datadir + echo "10.5.15-MariaDB" >"$datadir/mysql_upgrade_info" +else + if [ -d "$datadir/mysql/" ] ; then + # mysql dir exists, it seems data are initialized properly + echo "Database MariaDB is probably initialized in $datadir already, nothing is done." + echo "If this is not the case, make sure the $datadir is empty before running `basename $0`." + else + # if the directory is not empty but mysql/ directory is missing, then + # print error and let user to initialize manually or empty the directory + echo "Database MariaDB is not initialized, but the directory $datadir is not empty, so initialization cannot be done." >&2 + echo "Make sure the $datadir is empty before running `basename $0`." >&2 + exit 1 + fi +fi + +exit 0 diff --git a/mariadb-scripts-common.sh b/mariadb-scripts-common.sh new file mode 100644 index 0000000..cb2dad0 --- /dev/null +++ b/mariadb-scripts-common.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# Some useful functions used in other MariaDB helper scripts +# This scripts defines variables datadir, errlogfile, socketfile + +export LC_ALL=C + +# extract value of a MariaDB option from config files +# Usage: get_mysql_option VARNAME DEFAULT SECTION [ SECTION, ... ] +# result is returned in $result +# We use my_print_defaults which prints all options from multiple files, +# with the more specific ones later; hence take the last match. +get_mysql_option(){ + if [ $# -ne 3 ] ; then + echo "get_mysql_option requires 3 arguments: section option default_value" + return + fi + sections="$1" + option_name="$2" + default_value="$3" + result=`/usr/bin/my_print_defaults $my_print_defaults_extra_args $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` + if [ -z "$result" ]; then + # not found, use default + result="${default_value}" + fi +} + +# For the case of running more instances via systemd, scripts that source +# this file can get --default-group-suffix or similar option as the first +# argument. The utility my_print_defaults needs to use it as well, so the +# scripts sourcing this file work with the same options as the daemon. +my_print_defaults_extra_args='' +while echo "$1" | grep -q '^--defaults' ; do + my_print_defaults_extra_args="${my_print_defaults_extra_args} $1" + shift +done + +# Defaults here had better match what mariadbd-safe will default to +# The option values are generally defined on three important places +# on the default installation: +# 1) default values are hardcoded in the code of mariadbd daemon or +# mariadbd-safe script +# 2) configurable values are defined in /etc/my.cnf +# 3) default values for helper scripts are specified bellow +# So, in case values are defined in my.cnf, we need to get that value. +# In case they are not defined in my.cnf, we need to get the same value +# in the daemon, as in the helper scripts. Thus, default values here +# must correspond with values defined in mariadbd-safe script and source +# code itself. + +server_sections="mysqld_safe mysqld server mysqld-10.5 mariadb mariadb-10.5 mariadbd mariadbd-10.5 client-server galera" + +get_mysql_option "$server_sections" datadir "/var/lib/mysql" +datadir="$result" + +# if there is log_error in the my.cnf, my_print_defaults still +# returns log-error +# log-error might be defined in mysqld_safe and mysqld sections, +# the former has bigger priority +get_mysql_option "$server_sections" log-error "$datadir/`uname -n`.err" +errlogfile="$result" + +get_mysql_option "$server_sections" socket "/var/lib/mysql/mysql.sock" +socketfile="$result" + +get_mysql_option "$server_sections" pid-file "$datadir/`uname -n`.pid" +pidfile="$result" + diff --git a/mariadb-scripts.patch b/mariadb-scripts.patch new file mode 100644 index 0000000..3b6dc16 --- /dev/null +++ b/mariadb-scripts.patch @@ -0,0 +1,41 @@ +We have some downstream patches and other scripts that include variables to +be expanded by cmake. Cmake needs to know about them, so adding them manually. + + # Install libgcc as mylibgcc.a +--- mariadb-10.5.5/scripts/CMakeLists.txt.old 2020-09-24 10:13:35.272589689 +0200 ++++ mariadb-10.5.5/scripts/CMakeLists.txt 2020-09-24 10:17:31.428985798 +0200 +@@ -377,6 +377,34 @@ + INSTALL_LINK(${file} ${binname} ${INSTALL_BINDIR} ${${file}_COMPONENT}) + ENDIF() + ENDFOREACH() ++ ++ # files for systemd ++ SET(SYSTEMD_SCRIPTS ++ mariadb.tmpfiles.d ++ mysql.service ++ mysql@.service ++ mariadb-prepare-db-dir ++ mariadb-check-socket ++ mariadb-check-upgrade ++ mariadb-scripts-common ++ mysql_config_multilib ++ clustercheck ++ galera_new_cluster ++ my.cnf ++ ) ++ FOREACH(file ${SYSTEMD_SCRIPTS}) ++ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh) ++ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh ++ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY) ++ ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in) ++ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.in ++ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY) ++ ELSE() ++ MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file}.in in " ++ "${CMAKE_CURRENT_SOURCE_DIR}" ) ++ ENDIF() ++ ENDFOREACH() ++ + ENDIF() + + # Install libgcc as mylibgcc.a diff --git a/mariadb-server-galera.te b/mariadb-server-galera.te new file mode 100644 index 0000000..bdce127 --- /dev/null +++ b/mariadb-server-galera.te @@ -0,0 +1,23 @@ + +module mariadb-server-galera 1.0; + +require { + type mysqld_t; + type rsync_exec_t; + type anon_inodefs_t; + type proc_net_t; + type kerberos_port_t; + class file { read execute execute_no_trans getattr open }; + class tcp_socket { name_bind name_connect }; + class process { setpgid siginh rlimitinh noatsecure }; +} + +# allow mysqld to run rsyncd +allow mysqld_t self:process setpgid; +allow mysqld_t rsync_exec_t:file { read execute execute_no_trans getattr open }; +allow mysqld_t anon_inodefs_t:file getattr; +allow mysqld_t proc_net_t:file { read open }; + +# allow rsyncd to listen on port 4444 +allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect }; + diff --git a/mariadb-ssl-cipher-tests.patch b/mariadb-ssl-cipher-tests.patch new file mode 100644 index 0000000..b860cec --- /dev/null +++ b/mariadb-ssl-cipher-tests.patch @@ -0,0 +1,13 @@ +diff -up mariadb-10.5.22/mysql-test/main/ssl_cipher.test.fixtest mariadb-10.3.9/mysql-test/main/ssl_cipher.test +--- mariadb-10.5.22/mysql-test/main/ssl_cipher.test 2019-02-20 08:59:09.000000000 +0100 ++++ mariadb-10.5.22/mysql-test/main/ssl_cipher.test_patched 2019-02-22 11:22:01.250256060 +0100 +@@ -97,7 +97,9 @@ drop user mysqltest_1@localhost; + let $restart_parameters=--ssl-cipher=AES128-SHA; + source include/restart_mysqld.inc; + connect (ssl_con,localhost,root,,,,,SSL); ++--replace_regex /TLS_AES_.*/AES128-SHA/ + SHOW STATUS LIKE 'Ssl_cipher'; ++--replace_regex /TLS_AES_.*/AES128-SHA/ + SELECT VARIABLE_VALUE like '%AES128-SHA%' FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher_list'; + disconnect ssl_con; + connection default; diff --git a/mariadb.spec b/mariadb.spec new file mode 100644 index 0000000..6937617 --- /dev/null +++ b/mariadb.spec @@ -0,0 +1,1563 @@ +%global pkg_name %{name} +%global pkgnamepatch mariadb +%{!?runselftest:%global runselftest 0} +%global ignore_testsuite_result 0 +%global last_tested_version 10.5.15 +%global force_run_testsuite 0 +%global require_mysql_selinux 1 + +%global _pkgdocdirname %{pkg_name}%{!?_pkgdocdir:-%{version}} +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{pkg_name}-%{version}} + +%global _default_patch_flags --no-backup-if-mismatch + +%ifarch x86_64 +%bcond_with mroonga +%bcond_with rocksdb +%endif +%ifarch aarch64 +%bcond_without mroonga +%bcond_without rocksdb +%endif + +%bcond_without oqgraph +%bcond_without pam + +# S3 storage engine +%bcond_with cracklib +%bcond_with connect +%bcond_with sphinx +%bcond_with s3 +%bcond_with clibrary + +%bcond_without gssapi +%bcond_without embedded +%bcond_without devel +%bcond_without client +%bcond_without common +%bcond_without errmsg +%bcond_without test +%bcond_without galera +%bcond_without backup + +%bcond_without config + +%bcond_with debug +%bcond_without lz4 + +%bcond_without unbundled_pcre + +%global python_path /usr/bin/python3 + +# Include systemd files +%global daemon_name %{name} +%global daemon_no_prefix %{pkg_name} +%global mysqld_pid_dir mariadb + +# We define some system's well known locations here so we can use them easily +# later when building to another location (like SCL) +%global logrotateddir %{_sysconfdir}/logrotate.d +%global logfiledir %{_localstatedir}/log/%{daemon_name} +%global logfile %{logfiledir}/%{daemon_name}.log +# Directory for storing pid file +%global pidfiledir %{_rundir}/%{mysqld_pid_dir} +# Defining where database data live +%global dbdatadir %{_localstatedir}/lib/mysql +# Home directory of mysql user should be same for all packages that create it +%global mysqluserhome /var/lib/mysql + +%bcond_with mysql_names + + +# Make long macros shorter +%global sameevr %{epoch}:%{version}-%{release} + +Name: mariadb +Version: 10.5.22 +Release: 1 +Epoch: 4 + +Summary: A very fast and robust SQL database server +URL: http://mariadb.org +License: GPLv2 and LGPLv2 + +Source0: https://downloads.mariadb.org/interstitial/mariadb-%{version}/source/mariadb-%{version}.tar.gz + +Source2: mysql_config_multilib.sh +Source3: my.cnf.in +Source6: README.mariadb-docs +Source10: mariadb.tmpfiles.d.in +Source11: mysql.service.in +Source12: mariadb-prepare-db-dir.sh +Source14: mariadb-check-socket.sh +Source15: mariadb-scripts-common.sh +Source16: mariadb-check-upgrade.sh +Source18: mysql@.service.in +Source50: skipped-tests-base.list +Source51: skipped-tests-arm.list + +Source70: clustercheck.sh +Source71: LICENSE.clustercheck + +Source72: mariadb-server-galera.te + +# Patch4: yum distributions specific logrotate fix +# it would be big unexpected change, if we start shipping it now. Better wait for MariaDB 10.2 +Patch4: %{pkgnamepatch}-logrotate.patch +# Patch7: add to the CMake file all files where we want macros to be expanded +Patch7: %{pkgnamepatch}-scripts.patch +# Patch9: pre-configure to comply with guidelines +Patch9: %{pkgnamepatch}-ownsetup.patch +# Patch10: Fix cipher name in the SSL Cipher name test +Patch10: %{pkgnamepatch}-ssl-cipher-tests.patch +# Patch11: Use PCDIR CMake option, if configured +Patch11: %{pkgnamepatch}-pcdir.patch + +BuildRequires: make +BuildRequires: cmake gcc-c++ +BuildRequires: multilib-rpm-config +BuildRequires: selinux-policy-devel +BuildRequires: systemd systemd-devel + +# Page compression algorithms for InnoDB & XtraDB +BuildRequires: zlib-devel +%{?with_lz4:BuildRequires: lz4-devel} + +# asynchornous operations stuff; needed also for wsrep API +BuildRequires: libaio-devel +# commands history features +BuildRequires: libedit-devel +# CLI graphic; needed also for wsrep API +BuildRequires: ncurses-devel +# debugging stuff +BuildRequires: systemtap-sdt-devel +# Bison SQL parser; needed also for wsrep API +BuildRequires: bison bison-devel + +%{?with_debug:BuildRequires: valgrind-devel} + +# use either new enough version of pcre2 or provide bundles(pcre2) +%{?with_unbundled_pcre:BuildRequires: pcre2-devel pkgconf} +%{!?with_unbundled_pcre:Provides: bundled(pcre2) = %{pcre_bundled_version}} +# Few utilities needs Perl +BuildRequires: perl-interpreter +BuildRequires: perl-generators +# Some tests requires python +BuildRequires: python3 +# Tests requires time and ps and some perl modules +BuildRequires: procps +BuildRequires: time +BuildRequires: perl(base) +BuildRequires: perl(Cwd) +BuildRequires: perl(Data::Dumper) +BuildRequires: perl(English) +BuildRequires: perl(Env) +BuildRequires: perl(Errno) +BuildRequires: perl(Exporter) +BuildRequires: perl(Fcntl) +BuildRequires: perl(File::Basename) +BuildRequires: perl(File::Copy) +BuildRequires: perl(File::Find) +BuildRequires: perl(File::Spec) +BuildRequires: perl(File::Spec::Functions) +BuildRequires: perl(File::Temp) +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(IO::File) +BuildRequires: perl(IO::Handle) +BuildRequires: perl(IO::Select) +BuildRequires: perl(IO::Socket) +BuildRequires: perl(IO::Socket::INET) +BuildRequires: perl(IPC::Open3) +BuildRequires: perl(lib) +BuildRequires: perl(Memoize) +BuildRequires: perl(POSIX) +BuildRequires: perl(Socket) +BuildRequires: perl(strict) +BuildRequires: perl(Symbol) +BuildRequires: perl(Sys::Hostname) +BuildRequires: perl(Term::ANSIColor) +BuildRequires: perl(Test::More) +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(Time::localtime) +BuildRequires: perl(warnings) +# for running some openssl tests rhbz#1189180 +BuildRequires: openssl openssl-devel + +%if %{with debug} +BuildRequires: valgrind-devel +%endif + +Requires: bash coreutils grep + +Requires: %{name}-common%{?_isa} = %{sameevr} + +%if %{with clibrary} +# Explicit EVR requirement for -libs is needed for RHBZ#1406320 +Requires: %{name}-libs%{?_isa} = %{sameevr} +%else +# If not built with client library in this package, use connector-c +Requires: mariadb-connector-c >= 3.0 +%endif + +%if %{with mysql_names} +Provides: mysql = %{sameevr} +Provides: mysql%{?_isa} = %{sameevr} +Provides: mysql-compat-client = %{sameevr} +Provides: mysql-compat-client%{?_isa} = %{sameevr} +%endif + +Suggests: %{name}-server%{?_isa} = %{sameevr} + +Conflicts: community-mysql + +%global __requires_exclude ^perl\\((hostnames|lib::mtr|lib::v1|mtr_|My::|wsrep) +%global __provides_exclude_from ^(%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/%{pkg_name}/plugin/.*\\.so)$ + +%{!?_licensedir:%global license %doc} + +%description +MariaDB is a community developed fork from MySQL - a multi-user, multi-threaded +SQL database server. It is a client/server implementation consisting of +a server daemon (mariadbd) and many different client programs and libraries. +The base package contains the standard MariaDB/MySQL client programs and +utilities. + + +%if %{with clibrary} +%package libs +Summary: The shared libraries required for MariaDB/MySQL clients +Requires: %{name}-common%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-libs = %{sameevr} +Provides: mysql-libs%{?_isa} = %{sameevr} +%endif + +%description libs +The mariadb-libs package provides the essential shared libraries for any +MariaDB/MySQL client program or interface. You will need to install this +package to use any other MariaDB package or any clients that need to connect +to a MariaDB/MySQL server. +%endif + + +# At least main config file /etc/my.cnf is shared for client and server part +# Since we want to support combination of different client and server +# implementations (e.g. mariadb library and community-mysql server), +# we need the config file(s) to be in a separate package, so no extra packages +# are pulled, because these would likely conflict. +# More specifically, the dependency on the main configuration file (/etc/my.cnf) +# is supposed to be defined as Requires: /etc/my.cnf rather than requiring +# a specific package, so installer app can choose whatever package fits to +# the transaction. +%if %{with config} +%package config +Summary: The config files required by server and client + +%description config +The package provides the config file my.cnf and my.cnf.d directory used by any +MariaDB or MySQL program. You will need to install this package to use any +other MariaDB or MySQL package if the config files are not provided in the +package itself. +%endif + + +%if %{with common} +%package common +Summary: The shared files required by server and client +Requires: %{_sysconfdir}/my.cnf + + +%if %{without clibrary} +Obsoletes: %{name}-libs <= %{sameevr} +%endif + +%description common +The package provides the essential shared files for any MariaDB program. +You will need to install this package to use any other MariaDB package. +%endif + + +%if %{with errmsg} +%package errmsg +Summary: The error messages files required by server and embedded +Requires: %{name}-common%{?_isa} = %{sameevr} + +%description errmsg +The package provides error messages files for the MariaDB daemon and the +embedded server. You will need to install this package to use any of those +MariaDB packages. +%endif + + +%if %{with galera} +%package server-galera +Summary: The configuration files and scripts for galera replication +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-server%{?_isa} = %{sameevr} +Requires: galera >= 25.3.3 +Requires(post): libselinux-utils +Requires(post): policycoreutils-python-utils +# wsrep requirements +Requires: lsof +# Default wsrep_sst_method +Requires: rsync + +%description server-galera +MariaDB is a multi-user, multi-threaded SQL database server. It is a +client/server implementation consisting of a server daemon (mariadbd) +and many different client programs and libraries. This package contains +added files to allow MariaDB server to operate as a Galera cluster +member. MariaDB is a community developed fork originally from MySQL. +%endif + + +%package server +Summary: The MariaDB server and related files + +# note: no version here = %%{version}-%%{release} +%if %{with mysql_names} +Requires: mysql-compat-client%{?_isa} +Requires: mysql%{?_isa} +Recommends: %{name}%{?_isa} +%else +Requires: %{name}%{?_isa} +%endif +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-errmsg%{?_isa} = %{sameevr} +Recommends: %{name}-server-utils%{?_isa} = %{sameevr} +Recommends: %{name}-backup%{?_isa} = %{sameevr} +%{?with_cracklib:Recommends: %{name}-cracklib-password-check%{?_isa} = %{sameevr}} +%{?with_gssapi:Recommends: %{name}-gssapi-server%{?_isa} = %{sameevr}} +%{?with_rocksdb:Suggests: %{name}-rocksdb-engine%{?_isa} = %{sameevr}} +%{?with_sphinx:Suggests: %{name}-sphinx-engine%{?_isa} = %{sameevr}} +%{?with_oqgraph:Suggests: %{name}-oqgraph-engine%{?_isa} = %{sameevr}} +%{?with_connect:Suggests: %{name}-connect-engine%{?_isa} = %{sameevr}} +%{?with_pam:Suggests: %{name}-pam%{?_isa} = %{sameevr}} + +Suggests: mytop +Suggests: logrotate + +Requires: %{_sysconfdir}/my.cnf +Requires: %{_sysconfdir}/my.cnf.d + +%if %require_mysql_selinux +Requires: (mysql-selinux if selinux-policy-targeted) +%endif + +# for fuser in mysql-check-socket +Requires: psmisc + +Requires: coreutils +Requires(pre): /usr/sbin/useradd +# We require this to be present for %%{_tmpfilesdir} +Requires: systemd +# Make sure it's there when scriptlets run, too +%{?systemd_requires} +# RHBZ#1496131; use 'iproute' instead of 'net-tools' +Requires: iproute +%if %{with mysql_names} +Provides: mysql-server = %{sameevr} +Provides: mysql-server%{?_isa} = %{sameevr} +Provides: mysql-compat-server = %{sameevr} +Provides: mysql-compat-server%{?_isa} = %{sameevr} +%endif +Conflicts: community-mysql-server + +# Bench subpackage has been deprecated in F32 +Obsoletes: %{name}-bench <= %{sameevr} + +Obsoletes: %{name}-tokudb-engine <= %{sameevr} + +%description server +MariaDB is a multi-user, multi-threaded SQL database server. It is a +client/server implementation consisting of a server daemon (mariadbd) +and many different client programs and libraries. This package contains +the MariaDB server and some accompanying files and directories. +MariaDB is a community developed fork from MySQL. + + +%if %{with oqgraph} +%package oqgraph-engine +Summary: The Open Query GRAPH engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +# boost and Judy required for oograph +BuildRequires: boost-devel Judy-devel + +%description oqgraph-engine +The package provides Open Query GRAPH engine (OQGRAPH) as plugin for MariaDB +database server. OQGRAPH is a computation engine allowing hierarchies and more +complex graph structures to be handled in a relational fashion. In a nutshell, +tree structures and friend-of-a-friend style searches can now be done using +standard SQL syntax, and results joined onto other tables. +%endif + + +%if %{with connect} +%package connect-engine +Summary: The CONNECT storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} + +# As per https://jira.mariadb.org/browse/MDEV-21450 +BuildRequires: libxml2-devel + +%description connect-engine +The CONNECT storage engine enables MariaDB to access external local or +remote data (MED). This is done by defining tables based on different data +types, in particular files in various formats, data extracted from other DBMS +or products (such as Excel), or data retrieved from the environment +(for example DIR, WMI, and MAC tables). +%endif + + +%if %{with backup} +%package backup +Summary: The mariabackup tool for physical online backups +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: libarchive-devel + +%description backup +MariaDB Backup is an open source tool provided by MariaDB for performing +physical online backups of InnoDB, Aria and MyISAM tables. +For InnoDB, "hot online" backups are possible. +%endif + + +%if %{with rocksdb} +%package rocksdb-engine +Summary: The RocksDB storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +Provides: bundled(rocksdb) + +%description rocksdb-engine +The RocksDB storage engine is used for high performance servers on SSD drives. +%endif + + +%if %{with cracklib} +%package cracklib-password-check +Summary: The password strength checking plugin +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: cracklib-dicts cracklib-devel +Requires: cracklib-dicts + +%description cracklib-password-check +CrackLib is a password strength checking library. It is installed by default +in many Linux distributions and is invoked automatically (by pam_cracklib.so) +whenever the user login password is modified. +Now, with the cracklib_password_check password validation plugin, one can +also use it to check MariaDB account passwords. +%endif + + +%if %{with gssapi} +%package gssapi-server +Summary: GSSAPI authentication plugin for server +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: krb5-devel + +%description gssapi-server +GSSAPI authentication server-side plugin for MariaDB for passwordless login. +This plugin includes support for Kerberos on Unix. +%endif + + +%if %{with pam} +%package pam +Summary: PAM authentication plugin for the MariaDB server + +Requires: %{name}-server%{?_isa} = %{sameevr} +# This subpackage NEED the 'mysql' user/group (created during mariadb-server %%pre) to be available prior installation +Requires(pre): %{name}-server%{?_isa} = %{sameevr} + +BuildRequires: pam-devel + +%description pam +PAM authentication server-side plugin for MariaDB. +%endif + + +%if %{with sphinx} +%package sphinx-engine +Summary: The Sphinx storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: sphinx libsphinxclient libsphinxclient-devel +Requires: sphinx libsphinxclient + +%description sphinx-engine +The Sphinx storage engine for MariaDB. +%endif + + +%if %{with s3} +%package s3-engine +Summary: The S3 storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} + +BuildRequires: curl-devel + +%description s3-engine +The S3 read only storage engine allows archiving MariaDB tables in Amazon S3, +or any third-party public or private cloud that implements S3 API, +but still have them accessible for reading in MariaDB. +%endif + + +%package server-utils +Summary: Non-essential server utilities for MariaDB/MySQL applications +Requires: %{name}-server%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-perl = %{sameevr} +%endif +Conflicts: community-mysql-server +# mysqlhotcopy needs DBI/DBD support +Requires: perl(DBI) perl(DBD::MariaDB) + +%description server-utils +This package contains all non-essential server utilities and scripts for +managing databases. It also contains all utilities requiring Perl and it is +the only MariaDB sub-package, except test subpackage, that depends on Perl. + + +%if %{with devel} +%package devel +Summary: Files for development of MariaDB/MySQL applications +%{?with_clibrary:Requires: %{name}-libs%{?_isa} = %{sameevr}} +Requires: openssl-devel +%if %{without clibrary} +Requires: mariadb-connector-c-devel >= 3.0 +%endif +%if %{with mysql_names} +Provides: mysql-devel = %{sameevr} +Provides: mysql-devel%{?_isa} = %{sameevr} +%endif +Conflicts: community-mysql-devel + +%description devel +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed branch of MySQL. +%if %{with clibrary} +This package contains everything needed for developing MariaDB/MySQL client +and server plugins and applications. +%else +This package contains everything needed for developing MariaDB/MySQL server +plugins and applications. For developing client applications, use +mariadb-connector-c package. +%endif +%endif + + +%if %{with embedded} +%package embedded +Summary: MariaDB as an embeddable library +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-errmsg%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-embedded = %{sameevr} +Provides: mysql-embedded%{?_isa} = %{sameevr} +%endif + +%description embedded +MariaDB is a multi-user, multi-threaded SQL database server. This +package contains a version of the MariaDB server that can be embedded +into a client application instead of running as a separate process. +MariaDB is a community developed fork from MySQL. + + +%package embedded-devel +Summary: Development files for MariaDB as an embeddable library +Requires: %{name}-embedded%{?_isa} = %{sameevr} +Requires: %{name}-devel%{?_isa} = %{sameevr} +# embedded-devel should require libaio-devel (rhbz#1290517) +Requires: libaio-devel +%if %{with mysql_names} +Provides: mysql-embedded-devel = %{sameevr} +Provides: mysql-embedded-devel%{?_isa} = %{sameevr} +%endif +Conflicts: community-mysql-embedded-devel + +%description embedded-devel +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed fork from MySQL. +This package contains files needed for developing and testing with +the embedded version of the MariaDB server. +%endif + + +%if %{with test} +%package test +Summary: The test suite distributed with MariaDB +Requires: %{name}%{?_isa} = %{sameevr} +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-server%{?_isa} = %{sameevr} +Requires: patch +Requires: perl(Env) +Requires: perl(Exporter) +Requires: perl(Fcntl) +Requires: perl(File::Temp) +Requires: perl(Data::Dumper) +Requires: perl(Getopt::Long) +Requires: perl(IPC::Open3) +Requires: perl(Socket) +Requires: perl(Sys::Hostname) +Requires: perl(Test::More) +Requires: perl(Time::HiRes) +Conflicts: %{?fedora:community-}mysql-test +%if %{with mysql_names} +Provides: mysql-test = %{sameevr} +Provides: mysql-test%{?_isa} = %{sameevr} +%endif + +%description test +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed fork from MySQL. +This package contains the regression test suite distributed with the MariaDB +sources. +%endif + + +%prep +%setup -q -n mariadb-%{version} + +%patch -P4 -p1 +%patch -P7 -p1 +%patch -P9 -p1 +%patch -P10 -p1 +%patch -P11 -p1 + +# Remove JAR files that upstream puts into tarball +find . -name "*.jar" -type f -exec rm --verbose -f {} \; +# Remove testsuite for the mariadb-connector-c +rm -rf libmariadb/unittest +%if %{without rocksdb} +rm -r storage/rocksdb/ +%endif + +# generate a list of tests that fail, but are not disabled by upstream +cat %{SOURCE50} | tee -a mysql-test/unstable-tests + +# disable some tests failing on different architectures +%ifarch %{arm} aarch64 +cat %{SOURCE51} | tee -a mysql-test/unstable-tests +%endif + +cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ + %{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE18} %{SOURCE70} scripts + +%if %{with galera} +mkdir selinux +sed 's/mariadb-server-galera/%{name}-server-galera/' %{SOURCE72} > selinux/%{name}-server-galera.te +%endif + + +# Get version of PCRE, that upstream use +pcre_version=`grep -e "ftp.pcre.org/pub/pcre/pcre2" cmake/pcre.cmake | sed -r "s;[^0123456789]*2-([[:digit:]]+\.[[:digit:]]+)\.[^0123456789]*;\1;"` + +# Check if the PCRE version in macro 'pcre_bundled_version', used in Provides: bundled(...), is the same version as upstream actually bundles +%if %{without unbundled_pcre} +if [ %{pcre_bundled_version} != "$pcre_version" ] ; then + echo "\n Error: Bundled PCRE version is not correct. \n\tBundled version number:%{pcre_bundled_version} \n\tUpstream version number: $pcre_version\n" + exit 1 +fi +%else +# Check if the PCRE version that upstream use, is the same as the one present in system +pcre_system_version=`pkgconf %{_libdir}/pkgconfig/libpcre2-*.pc --modversion 2>/dev/null | head -n 1` + +if [ "$pcre_system_version" != "$pcre_version" ] ; then + echo "\n Warning: Error: Bundled PCRE version is not correct. \n\tSystem version number:$pcre_system_version \n\tUpstream version number: $pcre_version\n" +fi +%endif + + + +%build +# This package has static probe points which do not currently +# work with LTO and result in undefined symbols at link time. +# This is being worked on in upstream GCC +%define _lto_cflags %{nil} + +# fail quickly and obviously if user tries to build as root +%if %runselftest + if [ x"$(id -u)" = "x0" ]; then + echo "mysql's regression tests fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--nocheck to skip the regression tests." + exit 1 + fi +%endif + +# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX +# so we can't use %%{_datadir} and so forth here. +%cmake . \ + -DBUILD_CONFIG=mysql_release \ + -DFEATURE_SET="community" \ + -DINSTALL_LAYOUT=RPM \ + -DDAEMON_NAME="%{daemon_name}" \ + -DDAEMON_NO_PREFIX="%{daemon_no_prefix}" \ + -DLOG_LOCATION="%{logfile}" \ + -DPID_FILE_DIR="%{pidfiledir}" \ + -DNICE_PROJECT_NAME="MariaDB" \ + -DRPM="openeuler1" \ + -DCMAKE_INSTALL_PREFIX="%{_prefix}" \ + -DINSTALL_SYSCONFDIR="%{_sysconfdir}" \ + -DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \ + -DINSTALL_DOCDIR="share/doc/%{_pkgdocdirname}" \ + -DINSTALL_DOCREADMEDIR="share/doc/%{_pkgdocdirname}" \ + -DINSTALL_INCLUDEDIR=include/mysql \ + -DINSTALL_INFODIR=share/info \ + -DINSTALL_LIBDIR="%{_lib}" \ + -DINSTALL_MANDIR=share/man \ + -DINSTALL_MYSQLSHAREDIR=share/%{pkg_name} \ + -DINSTALL_MYSQLTESTDIR=%{?with_test:share/mysql-test}%{!?with_test:} \ + -DINSTALL_PLUGINDIR="%{_lib}/%{pkg_name}/plugin" \ + -DINSTALL_SBINDIR=libexec \ + -DINSTALL_SCRIPTDIR=bin \ + -DINSTALL_SUPPORTFILESDIR=share/%{pkg_name} \ + -DINSTALL_PCDIR=%{_lib}/pkgconfig \ + -DMYSQL_DATADIR="%{dbdatadir}" \ + -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \ + -DTMPDIR=/var/tmp \ + -DGRN_DATA_DIR=share/%{name}-server/groonga \ + -DGROONGA_NORMALIZER_MYSQL_PROJECT_NAME=%{name}-server/groonga-normalizer-mysql \ + -DENABLED_LOCAL_INFILE=ON \ + -DENABLE_DTRACE=ON \ + -DSECURITY_HARDENED=ON \ + -DWITH_WSREP=%{?with_galera:ON}%{!?with_galera:OFF} \ + -DWITH_INNODB_DISALLOW_WRITES=%{?with_galera:ON}%{!?with_galera:OFF} \ + -DWITH_EMBEDDED_SERVER=%{?with_embedded:ON}%{!?with_embedded:OFF} \ + -DWITH_MARIABACKUP=%{?with_backup:ON}%{!?with_backup:NO} \ + -DWITH_UNIT_TESTS=%{?with_test:ON}%{!?with_test:NO} \ + -DCONC_WITH_SSL=%{?with_clibrary:ON}%{!?with_clibrary:NO} \ + -DWITH_SSL=system \ + -DWITH_ZLIB=system \ + -DLZ4_LIBS=%{_libdir}/liblz4.so \ + -DLZ4_LIBS=%{?with_lz4:%{_libdir}/liblz4.so}%{!?with_lz4:} \ + -DWITH_INNODB_LZ4=%{?with_lz4:ON}%{!?with_lz4:OFF} \ + -DWITH_ROCKSDB_LZ4=%{?with_lz4:ON}%{!?with_lz4:OFF} \ + -DPLUGIN_MROONGA=%{?with_mroonga:DYNAMIC}%{!?with_mroonga:NO} \ + -DPLUGIN_OQGRAPH=%{?with_oqgraph:DYNAMIC}%{!?with_oqgraph:NO} \ + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=%{?with_cracklib:DYNAMIC}%{!?with_cracklib:NO} \ + -DPLUGIN_ROCKSDB=%{?with_rocksdb:DYNAMIC}%{!?with_rocksdb:NO} \ + -DPLUGIN_SPHINX=%{?with_sphinx:DYNAMIC}%{!?with_sphinx:NO} \ + -DPLUGIN_CONNECT=%{?with_connect:DYNAMIC}%{!?with_connect:NO} \ + -DPLUGIN_S3=%{?with_s3:DYNAMIC}%{!?with_s3:NO} \ + -DPLUGIN_COLUMNSTORE=NO \ + -DPLUGIN_CLIENT_ED25519=OFF \ + -DPYTHON_SHEBANG=%{python_path} \ + -DPLUGIN_CACHING_SHA2_PASSWORD=%{?with_clibrary:DYNAMIC}%{!?with_clibrary:OFF} \ + -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ + -DCONNECT_WITH_MONGO=OFF \ + -DCONNECT_WITH_JDBC=OFF \ +%{?with_debug: -DCMAKE_BUILD_TYPE=Debug -DWITH_ASAN=OFF -DWITH_INNODB_EXTRA_DEBUG=ON -DWITH_VALGRIND=ON} + + +CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" +# force PIC mode so that we can build libmysqld.so +CFLAGS="$CFLAGS -fPIC" + +%if %{with debug} +# Override all optimization flags when making a debug build +# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify. +CFLAGS=`echo "$CFLAGS" | sed -r 's/-D_FORTIFY_SOURCE=[012]/-D_FORTIFY_SOURCE=0/'` +CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'` + +CFLAGS="$CFLAGS -O0 -g -D_FORTIFY_SOURCE=0" +%endif # debug + +CXXFLAGS="$CFLAGS" +CPPFLAGS="$CFLAGS" +export CFLAGS CXXFLAGS CPPFLAGS + +cmake -B . -LAH +cmake --build . %{?_smp_mflags} --verbose + +# build selinux policy +%if %{with galera} +pushd selinux +make -f /usr/share/selinux/devel/Makefile %{name}-server-galera.pp +%endif + + + +%install +DESTDIR="%{buildroot}" cmake --install "." + +# multilib header support #1625157 +for header in mysql/server/my_config.h mysql/server/private/config.h; do +%multilib_fix_c_header --file %{_includedir}/$header +done + +ln -s mysql_config.1.gz %{buildroot}%{_mandir}/man1/mariadb_config.1.gz + +# multilib support for shell scripts +# we only apply this to known Red Hat multilib arches, per bug #181335 +if [ %multilib_capable ] +then +mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} +install -p -m 0755 %{_builddir}/mariadb-%{version}/scripts/mysql_config_multilib.sh %{buildroot}%{_bindir}/mysql_config +# Copy manual page for multilib mysql_config; https://jira.mariadb.org/browse/MDEV-11961 +ln -s mysql_config.1 %{buildroot}%{_mandir}/man1/mysql_config-%{__isa_bits}.1 +fi + +%if %{without clibrary} +# Client part should be included in package 'mariadb-connector-c' +rm %{buildroot}%{_libdir}/pkgconfig/libmariadb.pc +%endif + +# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, +# but that's pretty wacko --- see also %%{name}-file-contents.patch) +install -p -m 644 %{_builddir}/mariadb-%{version}/Docs/INFO_SRC %{buildroot}%{_libdir}/%{pkg_name}/ +install -p -m 644 %{_builddir}/mariadb-%{version}/Docs/INFO_BIN %{buildroot}%{_libdir}/%{pkg_name}/ +rm -r %{buildroot}%{_datadir}/doc/%{_pkgdocdirname}/MariaDB-server-%{version}/ + +# Logfile creation +mkdir -p %{buildroot}%{logfiledir} +chmod 0750 %{buildroot}%{logfiledir} +touch %{buildroot}%{logfile} + +# current setting in my.cnf is to use /var/run/mariadb for creating pid file, +# however since my.cnf is not updated by RPM if changed, we need to create mysqld +# as well because users can have odd settings in their /etc/my.cnf +mkdir -p %{buildroot}%{pidfiledir} +install -p -m 0755 -d %{buildroot}%{dbdatadir} + +%if %{with config} +install -D -p -m 0644 %{_builddir}/mariadb-%{version}/scripts/my.cnf.in %{buildroot}%{_sysconfdir}/my.cnf +%else +rm %{_builddir}/mariadb-%{version}/scripts/my.cnf.in +%endif + +# use different config file name for each variant of server (mariadb / mysql) +mv %{buildroot}%{_sysconfdir}/my.cnf.d/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf + +# Remove upstream SysV init script and a symlink to that, we use systemd +rm %{buildroot}%{_libexecdir}/rcmysql +# Remove upstream Systemd service files +rm -r %{buildroot}%{_datadir}/%{pkg_name}/systemd +# Our downstream Systemd service file have set aliases to the "mysql" names in the [Install] section. +# They can be enabled / disabled by "systemctl enable / diable <service_name>" +rm %{buildroot}%{_unitdir}/{mysql,mysqld}.service + +# install systemd unit files and scripts for handling server startup +install -D -p -m 644 %{_builddir}/mariadb-%{version}/scripts/mysql.service.in %{buildroot}%{_unitdir}/%{daemon_name}.service +install -D -p -m 644 %{_builddir}/mariadb-%{version}/scripts/mysql@.service.in %{buildroot}%{_unitdir}/%{daemon_name}@.service + +# helper scripts for service starting +install -p -m 755 %{_builddir}/mariadb-%{version}/scripts/mariadb-prepare-db-dir.sh %{buildroot}%{_libexecdir}/mariadb-prepare-db-dir +install -p -m 755 %{_builddir}/mariadb-%{version}/scripts/mariadb-check-socket.sh %{buildroot}%{_libexecdir}/mariadb-check-socket +install -p -m 755 %{_builddir}/mariadb-%{version}/scripts/mariadb-check-upgrade.sh %{buildroot}%{_libexecdir}/mariadb-check-upgrade +install -p -m 644 %{_builddir}/mariadb-%{version}/scripts/mariadb-scripts-common.sh %{buildroot}%{_libexecdir}/mariadb-scripts-common + +# Install downstream version of tmpfiles +install -D -p -m 0644 %{_builddir}/mariadb-%{version}/scripts/mariadb.tmpfiles.d.in %{buildroot}%{_tmpfilesdir}/%{name}.conf +%if 0%{?mysqld_pid_dir:1} +echo "d %{pidfiledir} 0755 mysql mysql -" >>%{buildroot}%{_tmpfilesdir}/%{name}.conf +%endif + +# install additional galera selinux policy +%if %{with galera} +install -p -m 644 -D selinux/%{name}-server-galera.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp +%endif + +%if %{with test} +# mysql-test includes one executable that doesn't belong under /usr/share, so move it and provide a symlink +mv %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir} +ln -s ../../../../../bin/my_safe_process %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process +# Provide symlink expected by RH QA tests +ln -s unstable-tests %{buildroot}%{_datadir}/mysql-test/rh-skipped-tests.list +%endif + + +# Client that uses libmysqld embedded server. +# Pretty much like normal mysql command line client, but it doesn't require a running mariadb server. +%{?with_embedded:rm %{buildroot}%{_bindir}/{mariadb-,mysql_}embedded} +rm %{buildroot}%{_mandir}/man1/{mysql_,mariadb-}embedded.1* +# Static libraries +rm %{buildroot}%{_libdir}/*.a +rm %{buildroot}%{_datadir}/%{pkg_name}/binary-configure +rm %{buildroot}%{_datadir}/%{pkg_name}/magic +rm %{buildroot}%{_datadir}/%{pkg_name}/mysql.server +rm %{buildroot}%{_datadir}/%{pkg_name}/mysqld_multi.server + +# Binary for monitoring MySQL performance +# Shipped as a standalone package in Fedora +rm %{buildroot}%{_bindir}/mytop +rm %{buildroot}%{_mandir}/man1/mytop.1* + +# Should be shipped with mariadb-connector-c +rm %{buildroot}%{_mandir}/man1/mariadb_config.1* + +# put logrotate script where it needs to be +mkdir -p %{buildroot}%{logrotateddir} +mv %{buildroot}%{_datadir}/%{pkg_name}/mysql-log-rotate %{buildroot}%{logrotateddir}/%{daemon_name} +chmod 644 %{buildroot}%{logrotateddir}/%{daemon_name} + +# for compatibility with upstream RPMs, create mysqld symlink in sbin +mkdir -p %{buildroot}%{_sbindir} +ln -s %{_libexecdir}/mysqld %{buildroot}%{_sbindir}/mysqld +ln -s %{_libexecdir}/mariadbd %{buildroot}%{_sbindir}/mariadbd + +# copy additional docs into build tree so %%doc will find them +install -p -m 0644 %{SOURCE6} %{basename:%{SOURCE6}} +install -p -m 0644 %{SOURCE16} %{basename:%{SOURCE16}} +install -p -m 0644 %{SOURCE71} %{basename:%{SOURCE71}} + +# install galera config file +%if %{with galera} +sed -i -r 's|^wsrep_provider=none|wsrep_provider=%{_libdir}/galera/libgalera_smm.so|' %{_builddir}/mariadb-%{version}/support-files/wsrep.cnf +install -p -m 0644 %{_builddir}/mariadb-%{version}/support-files/wsrep.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/galera.cnf +%endif +# install the clustercheck script +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +touch %{buildroot}%{_sysconfdir}/sysconfig/clustercheck +install -p -m 0755 %{_builddir}/mariadb-%{version}/scripts/clustercheck.sh %{buildroot}%{_bindir}/clustercheck + +# remove duplicate logrotate script +rm %{buildroot}%{logrotateddir}/mysql +# Remove AppArmor files +rm -r %{buildroot}%{_datadir}/%{pkg_name}/policy/apparmor + +# Buildroot does not have symlink /lib64 --> /usr/lib64 +mv %{buildroot}/%{_lib}/security %{buildroot}%{_libdir} + +# Disable plugins +%if %{with gssapi} +sed -i 's/^plugin-load-add/#plugin-load-add/' %{buildroot}%{_sysconfdir}/my.cnf.d/auth_gssapi.cnf +%endif +%if %{with cracklib} +sed -i 's/^plugin-load-add/#plugin-load-add/' %{buildroot}%{_sysconfdir}/my.cnf.d/cracklib_password_check.cnf +%endif + +# Fix Galera Replication config file +# The replication requires cluster address upon startup (which is end-user specific). +# Disable it entirely, rather than have it failing out-of-the-box. +%if %{with galera} +sed -i 's/^wsrep_on=1/wsrep_on=0/' %{buildroot}%{_sysconfdir}/my.cnf.d/galera.cnf +%endif + +%if %{without embedded} +rm %{buildroot}%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1* +rm %{buildroot}%{_mandir}/man1/{mariadb-client-test-embedded,mariadb-test-embedded}.1* +%endif + + +%if %{without clibrary} +rm %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf +# Client library and links +rm %{buildroot}%{_libdir}/libmariadb.so.* +unlink %{buildroot}%{_libdir}/libmysqlclient.so +unlink %{buildroot}%{_libdir}/libmysqlclient_r.so +unlink %{buildroot}%{_libdir}/libmariadb.so +# Client plugins +rm %{buildroot}%{_libdir}/%{pkg_name}/plugin/{dialog.so,mysql_clear_password.so,sha256_password.so} +%if %{with gssapi} +rm %{buildroot}%{_libdir}/%{pkg_name}/plugin/auth_gssapi_client.so +%endif +%endif + +%if %{without clibrary} || %{without devel} +rm %{buildroot}%{_bindir}/mysql_config* +rm %{buildroot}%{_bindir}/mariadb_config +rm %{buildroot}%{_bindir}/mariadb-config +rm %{buildroot}%{_mandir}/man1/mysql_config*.1* +%endif + +%if %{without clibrary} && %{with devel} +# This files are already included in mariadb-connector-c +rm %{buildroot}%{_includedir}/mysql/mysql_version.h +rm %{buildroot}%{_includedir}/mysql/{errmsg.h,ma_list.h,ma_pvio.h,mariadb_com.h,\ +mariadb_ctype.h,mariadb_dyncol.h,mariadb_stmt.h,mariadb_version.h,ma_tls.h,mysqld_error.h,mysql.h,mariadb_rpl.h} +rm -r %{buildroot}%{_includedir}/mysql/{mariadb,mysql} +%endif + +%if %{without devel} +rm -r %{buildroot}%{_includedir}/mysql +rm %{buildroot}%{_datadir}/aclocal/mysql.m4 +rm %{buildroot}%{_libdir}/pkgconfig/mariadb.pc +%if %{with clibrary} +rm %{buildroot}%{_libdir}/libmariadb*.so +unlink %{buildroot}%{_libdir}/libmysqlclient.so +unlink %{buildroot}%{_libdir}/libmysqlclient_r.so +%endif +%endif + +%if %{without client} +rm %{buildroot}%{_bindir}/msql2mysql +rm %{buildroot}%{_bindir}/{mysql,mariadb} +rm %{buildroot}%{_bindir}/mysql{access,admin,binlog,check,dump,_find_rows,import,_plugin,show,slap,_waitpid} +rm %{buildroot}%{_bindir}/mariadb-{access,admin,binlog,check,dump,find-rows,import,plugin,show,slap,waitpid} + +rm %{buildroot}%{_mandir}/man1/msql2mysql.1* +rm %{buildroot}%{_mandir}/man1/{mysql,mariadb}.1* +rm %{buildroot}%{_mandir}/man1/mysql{access,admin,binlog,check,dump,_find_rows,import,_plugin,show,slap,_waitpid}.1* +rm %{buildroot}%{_mandir}/man1/mariadb-{access,admin,binlog,check,dump,find-rows,import,plugin,show,slap,waitpid}.1* +%endif + +%if %{without config} +rm %{buildroot}%{_sysconfdir}/my.cnf +%endif + +%if %{without common} +rm -r %{buildroot}%{_datadir}/%{pkg_name}/charsets +%endif + +%if %{without errmsg} +rm %{buildroot}%{_datadir}/%{pkg_name}/errmsg-utf8.txt +rm -r %{buildroot}%{_datadir}/%{pkg_name}/{english,czech,danish,dutch,estonian,\ +french,german,greek,hungarian,italian,japanese,korean,norwegian,norwegian-ny,\ +polish,portuguese,romanian,russian,serbian,slovak,spanish,swedish,ukrainian,hindi} +%endif + +%if %{without test} +%if %{with embedded} +rm %{buildroot}%{_bindir}/{mysql_client_test_embedded,mysqltest_embedded} +rm %{buildroot}%{_bindir}/{mariadb-client-test-embedded,mariadb-test-embedded} +rm %{buildroot}%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1* +rm %{buildroot}%{_mandir}/man1/{mariadb-client-test-embedded,mariadb-test-embedded}.1* +%endif # embedded +rm %{buildroot}%{_bindir}/{mysql_client_test,mysqltest} +rm %{buildroot}%{_bindir}/{mariadb-client-test,mariadb-test} +rm %{buildroot}%{_mandir}/man1/{mysql_client_test,mysqltest,my_safe_process}.1* +rm %{buildroot}%{_mandir}/man1/{mariadb-client-test,mariadb-test}.1* +rm %{buildroot}%{_mandir}/man1/{mysql-test-run,mysql-stress-test}.pl.1* +rm %{buildroot}/suite/plugins/pam/mariadb_mtr +rm %{buildroot}/suite/plugins/pam/pam_mariadb_mtr.so +%endif + +%if %{without galera} +rm %{buildroot}%{_sysconfdir}/sysconfig/clustercheck +rm %{buildroot}%{_bindir}/{clustercheck,galera_new_cluster} +rm %{buildroot}%{_bindir}/galera_recovery +rm %{buildroot}%{_datadir}/%{pkg_name}/systemd/use_galera_new_cluster.conf +%endif + +%if %{without rocksdb} +rm %{buildroot}%{_mandir}/man1/{mysql_,mariadb-}ldb.1* +rm %{buildroot}%{_mandir}/man1/myrocks_hotbackup.1* +%endif + +%if %{without backup} +rm %{buildroot}%{_mandir}/man1/maria{,db-}backup.1* +rm %{buildroot}%{_mandir}/man1/mbstream.1* +%endif + +%if %{without s3} +rm %{buildroot}%{_mandir}/man1/aria_s3_copy.1* +%endif + +%check +%if %{with test} +%if %runselftest +# hack to let 32- and 64-bit tests run concurrently on same build machine +export MTR_PARALLEL=1 +export MTR_BUILD_THREAD=$(( $(date +%s) % 1100 )) + +( + set -ex + cd %{buildroot}%{_datadir}/mysql-test + + export common_testsuite_arguments=" --parallel=auto --force --retry=2 --suite-timeout=900 --testcase-timeout=30 --mysqld=--binlog-format=mixed --force-restart --shutdown-timeout=60 --max-test-fail=5 " + + # If full testsuite has already been run on this version and we don't explicitly want the full testsuite to be run + if [[ "%{last_tested_version}" == "%{version}" ]] && [[ %{force_run_testsuite} -eq 0 ]] + then + # in further rebuilds only run the basic "main" suite (~800 tests) + echo "running only base testsuite" + perl ./mysql-test-run.pl $common_testsuite_arguments --ssl --suite=main --mem --skip-test-list=unstable-tests + fi + + # If either this version wasn't marked as tested yet or I explicitly want to run the testsuite, run everything we have (~4000 test) + if [[ "%{last_tested_version}" != "%{version}" ]] || [[ %{force_run_testsuite} -ne 0 ]] + then + echo "running advanced testsuite" + perl ./mysql-test-run.pl $common_testsuite_arguments --ssl --big-test --skip-test=spider \ + %if %{ignore_testsuite_result} + --max-test-fail=9999 || : + %else + --skip-test-list=unstable-tests + %endif + # Second run for the SPIDER suites that fail with SCA (ssl self signed certificate) + perl ./mysql-test-run.pl $common_testsuite_arguments --skip-ssl --big-test --mem --suite=spider,spider/bg,spider/bugfix,spider/handler \ + %if %{ignore_testsuite_result} + --max-test-fail=999 || : + %endif + # blank line + fi + + # There might be a dangling symlink left from the testing, remove it to not be installed + rm -rf ./var +) + +# NOTE: the Spider SE has 2 more hidden testsuites "oracle" and "oracle2". +# however, all of the tests fail with: "failed: 12521: Can't use wrapper 'oracle' for SQL connection" + +%endif +%endif + + + +%pre server +/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : +/usr/sbin/useradd -M -N -g mysql -o -r -d %{mysqluserhome} -s /sbin/nologin \ + -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : + +%if %{with galera} +%post server-galera +# Allow ports needed for the replication: +# https://mariadb.com/kb/en/library/configuring-mariadb-galera-cluster/#network-ports +# Galera Replication Port +semanage port -a -t mysqld_port_t -p tcp 4567 >/dev/null 2>&1 || : +semanage port -a -t mysqld_port_t -p udp 4567 >/dev/null 2>&1 || : +# IST Port +semanage port -a -t mysqld_port_t -p tcp 4568 >/dev/null 2>&1 || : +# SST Port +semanage port -a -t mysqld_port_t -p tcp 4444 >/dev/null 2>&1 || : + +semodule -i %{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp >/dev/null 2>&1 || : +%endif + +%post server +%systemd_post %{daemon_name}.service + +%preun server +%systemd_preun %{daemon_name}.service + +%if %{with galera} +%postun server-galera +if [ $1 -eq 0 ]; then + semodule -r %{name}-server-galera 2>/dev/null || : +fi +%endif + +%postun server +%systemd_postun_with_restart %{daemon_name}.service + + + +%if %{with client} +%files +%{_bindir}/msql2mysql +%{_bindir}/{mysql,mariadb} +%{_bindir}/mysql{access,admin,binlog,check,dump,_find_rows,import,_plugin,show,slap,_waitpid} +%{_bindir}/mariadb-{access,admin,binlog,check,dump,find-rows,import,plugin,show,slap,waitpid} + +%{_mandir}/man1/msql2mysql.1* +%{_mandir}/man1/{mysql,mariadb}.1* +%{_mandir}/man1/mysql{access,admin,binlog,check,dump,_find_rows,import,_plugin,show,slap,_waitpid}.1* +%{_mandir}/man1/mariadb-{access,admin,binlog,check,dump,find-rows,import,plugin,show,slap,waitpid}.1* + +%config(noreplace) %{_sysconfdir}/my.cnf.d/mysql-clients.cnf +%endif + +%if %{with clibrary} +%files libs +%exclude %{_libdir}/{libmysqlclient.so.18,libmariadb.so,libmysqlclient.so,libmysqlclient_r.so} +%{_libdir}/libmariadb.so* +%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf +%endif + +%if %{with config} +%files config +# although the default my.cnf contains only server settings, we put it in the +# common package because it can be used for client settings too. +%dir %{_sysconfdir}/my.cnf.d +%config(noreplace) %{_sysconfdir}/my.cnf +%endif + +%if %{with common} +%files common +%doc %{_datadir}/doc/%{_pkgdocdirname} +%dir %{_datadir}/%{pkg_name} +%{_datadir}/%{pkg_name}/charsets +%if %{with clibrary} +%{_libdir}/%{pkg_name}/plugin/dialog.so +%{_libdir}/%{pkg_name}/plugin/mysql_clear_password.so +%endif +%endif + +%if %{with errmsg} +%files errmsg +%{_datadir}/%{pkg_name}/errmsg-utf8.txt +%{_datadir}/%{pkg_name}/english +%lang(cs) %{_datadir}/%{pkg_name}/czech +%lang(da) %{_datadir}/%{pkg_name}/danish +%lang(nl) %{_datadir}/%{pkg_name}/dutch +%lang(et) %{_datadir}/%{pkg_name}/estonian +%lang(fr) %{_datadir}/%{pkg_name}/french +%lang(de) %{_datadir}/%{pkg_name}/german +%lang(el) %{_datadir}/%{pkg_name}/greek +%lang(hi) %{_datadir}/%{pkg_name}/hindi +%lang(hu) %{_datadir}/%{pkg_name}/hungarian +%lang(it) %{_datadir}/%{pkg_name}/italian +%lang(ja) %{_datadir}/%{pkg_name}/japanese +%lang(ko) %{_datadir}/%{pkg_name}/korean +%lang(no) %{_datadir}/%{pkg_name}/norwegian +%lang(no) %{_datadir}/%{pkg_name}/norwegian-ny +%lang(pl) %{_datadir}/%{pkg_name}/polish +%lang(pt) %{_datadir}/%{pkg_name}/portuguese +%lang(ro) %{_datadir}/%{pkg_name}/romanian +%lang(ru) %{_datadir}/%{pkg_name}/russian +%lang(sr) %{_datadir}/%{pkg_name}/serbian +%lang(sk) %{_datadir}/%{pkg_name}/slovak +%lang(es) %{_datadir}/%{pkg_name}/spanish +%lang(sv) %{_datadir}/%{pkg_name}/swedish +%lang(uk) %{_datadir}/%{pkg_name}/ukrainian +%{_datadir}/%{pkg_name}/bulgarian +%{_datadir}/%{pkg_name}/chinese +%endif + +%if %{with galera} +%files server-galera +%doc Docs/README-wsrep +%license LICENSE.clustercheck +%{_bindir}/clustercheck +%{_bindir}/galera_new_cluster +%{_bindir}/galera_recovery +%config(noreplace) %{_sysconfdir}/my.cnf.d/galera.cnf +%attr(0640,root,root) %ghost %config(noreplace) %{_sysconfdir}/sysconfig/clustercheck +%{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp +%endif + +%files server + +%{_bindir}/aria_{chk,dump_log,ftdump,pack,read_log} +%{_bindir}/mariadb-service-convert +%{_bindir}/myisamchk +%{_bindir}/myisam_ftdump +%{_bindir}/myisamlog +%{_bindir}/myisampack +%{_bindir}/my_print_defaults + +%{_bindir}/mariadb-conv + +%{_bindir}/mysql_{install_db,secure_installation,tzinfo_to_sql} +%{_bindir}/mariadb-{install-db,secure-installation,tzinfo-to-sql} +%{_bindir}/{mysqld_,mariadbd-}safe +%{_bindir}/{mysqld_safe_helper,mariadbd-safe-helper} + +%{_bindir}/innochecksum +%{_bindir}/replace +%{_bindir}/resolve_stack_dump +%{_bindir}/resolveip +%if %{with galera} +# wsrep_sst_common should be moved to /usr/share/mariadb: https://jira.mariadb.org/browse/MDEV-14296 +%{_bindir}/wsrep_* +%endif + +%config(noreplace) %{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf +%config(noreplace) %{_sysconfdir}/my.cnf.d/enable_encryption.preset +%config(noreplace) %{_sysconfdir}/my.cnf.d/spider.cnf + +%{_sbindir}/mysqld +%{_sbindir}/mariadbd +%{_libexecdir}/{mysqld,mariadbd} + +%{_libdir}/%{pkg_name}/INFO_SRC +%{_libdir}/%{pkg_name}/INFO_BIN +%if %{without common} +%dir %{_datadir}/%{pkg_name} +%endif + +%dir %{_libdir}/%{pkg_name} +%dir %{_libdir}/%{pkg_name}/plugin + +%{_libdir}/%{pkg_name}/plugin/* +%{?with_oqgraph:%exclude %{_libdir}/%{pkg_name}/plugin/ha_oqgraph.so} +%{?with_connect:%exclude %{_libdir}/%{pkg_name}/plugin/ha_connect.so} +%{?with_cracklib:%exclude %{_libdir}/%{pkg_name}/plugin/cracklib_password_check.so} +%{?with_rocksdb:%exclude %{_libdir}/%{pkg_name}/plugin/ha_rocksdb.so} +%{?with_gssapi:%exclude %{_libdir}/%{pkg_name}/plugin/auth_gssapi.so} +%{?with_sphinx:%exclude %{_libdir}/%{pkg_name}/plugin/ha_sphinx.so} +%{?with_s3:%exclude %{_libdir}/%{pkg_name}/plugin/ha_s3.so} +%if %{with clibrary} +%exclude %{_libdir}/%{pkg_name}/plugin/dialog.so +%exclude %{_libdir}/%{pkg_name}/plugin/mysql_clear_password.so +%endif + +# PAM plugin; moved to a standalone sub-package +%exclude %{_libdir}/%{pkg_name}/plugin/{auth_pam_v1.so,auth_pam.so} +%exclude %dir %{_libdir}/%{pkg_name}/plugin/auth_pam_tool_dir +%exclude %{_libdir}/%{pkg_name}/plugin/auth_pam_tool_dir/auth_pam_tool + +%{_mandir}/man1/aria_{chk,dump_log,ftdump,pack,read_log}.1* +%{_mandir}/man1/galera_new_cluster.1* +%{_mandir}/man1/galera_recovery.1* +%{_mandir}/man1/mariadb-service-convert.1* +%{_mandir}/man1/myisamchk.1* +%{_mandir}/man1/myisamlog.1* +%{_mandir}/man1/myisampack.1* +%{_mandir}/man1/myisam_ftdump.1* +%{_mandir}/man1/my_print_defaults.1* + +%{_mandir}/man1/mariadb-conv.1* + +%{_mandir}/man1/mysql_{install_db,secure_installation,tzinfo_to_sql}.1* +%{_mandir}/man1/mariadb-{install-db,secure-installation,tzinfo-to-sql}.1* +%{_mandir}/man1/{mysqld_,mariadbd-}safe.1* +%{_mandir}/man1/{mysqld_safe_helper,mariadbd-safe-helper}.1* + +%{_mandir}/man1/innochecksum.1* +%{_mandir}/man1/replace.1* +%{_mandir}/man1/resolveip.1* +%{_mandir}/man1/resolve_stack_dump.1* +%{_mandir}/man8/{mysqld,mariadbd}.8* +%{_mandir}/man1/wsrep_*.1* + +%{_mandir}/man1/mysql.server.1* + +%{_datadir}/%{pkg_name}/fill_help_tables.sql +%{_datadir}/%{pkg_name}/maria_add_gis_sp.sql +%{_datadir}/%{pkg_name}/maria_add_gis_sp_bootstrap.sql +%{_datadir}/%{pkg_name}/mysql_system_tables.sql +%{_datadir}/%{pkg_name}/mysql_system_tables_data.sql +%{_datadir}/%{pkg_name}/mysql_test_data_timezone.sql +%{_datadir}/%{pkg_name}/mysql_performance_tables.sql +%{_datadir}/%{pkg_name}/mysql_test_db.sql +%if %{with mroonga} +%{_datadir}/%{pkg_name}/mroonga/install.sql +%{_datadir}/%{pkg_name}/mroonga/uninstall.sql +%license %{_datadir}/%{pkg_name}/mroonga/COPYING +%license %{_datadir}/%{pkg_name}/mroonga/AUTHORS +%license %{_datadir}/%{name}-server/groonga-normalizer-mysql/lgpl-2.0.txt +%license %{_datadir}/%{name}-server/groonga/COPYING +%doc %{_datadir}/%{name}-server/groonga-normalizer-mysql/README.md +%doc %{_datadir}/%{name}-server/groonga/README.md +%endif +%if %{with galera} +%{_datadir}/%{pkg_name}/wsrep.cnf +%endif +%{_datadir}/%{pkg_name}/wsrep_notify +%dir %{_datadir}/%{pkg_name}/policy +%dir %{_datadir}/%{pkg_name}/policy/selinux +%{_datadir}/%{pkg_name}/policy/selinux/README +%{_datadir}/%{pkg_name}/policy/selinux/mariadb-server.* +%{_datadir}/%{pkg_name}/policy/selinux/mariadb.* + +%{_unitdir}/%{daemon_name}* + +%{_libexecdir}/mariadb-prepare-db-dir +%{_libexecdir}/mariadb-check-socket +%{_libexecdir}/mariadb-check-upgrade +%{_libexecdir}/mariadb-scripts-common + +%attr(0755,mysql,mysql) %dir %{pidfiledir} +%attr(0755,mysql,mysql) %dir %{dbdatadir} +%attr(0750,mysql,mysql) %dir %{logfiledir} +%attr(0660,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile} +%config(noreplace) %{logrotateddir}/%{daemon_name} + +%{_tmpfilesdir}/%{name}.conf +%{_sysusersdir}/%{name}.conf + +%if %{with cracklib} +%files cracklib-password-check +%config(noreplace) %{_sysconfdir}/my.cnf.d/cracklib_password_check.cnf +%{_libdir}/%{pkg_name}/plugin/cracklib_password_check.so +%endif + +%if %{with backup} +%files backup +%{_bindir}/maria{,db-}backup +%{_bindir}/mbstream +%{_mandir}/man1/maria{,db-}backup.1* +%{_mandir}/man1/mbstream.1* +%endif + +%if %{with rocksdb} +%files rocksdb-engine +%config(noreplace) %{_sysconfdir}/my.cnf.d/rocksdb.cnf +%{_bindir}/myrocks_hotbackup +%{_bindir}/{mysql_,mariadb-}ldb +%{_bindir}/sst_dump +%{_libdir}/%{pkg_name}/plugin/ha_rocksdb.so +%{_mandir}/man1/{mysql_,mariadb-}ldb.1* +%{_mandir}/man1/myrocks_hotbackup.1* +%endif + +%if %{with gssapi} +%files gssapi-server +%{_libdir}/%{pkg_name}/plugin/auth_gssapi.so +%config(noreplace) %{_sysconfdir}/my.cnf.d/auth_gssapi.cnf +%endif + +%if %{with pam} +%files pam +%{_libdir}/%{pkg_name}/plugin/{auth_pam_v1.so,auth_pam.so} +%attr(0755,root,root) %dir %{_libdir}/%{pkg_name}/plugin/auth_pam_tool_dir +# SUID-to-root binary. Access MUST be restricted (https://jira.mariadb.org/browse/MDEV-25126) +%attr(4750,root,mysql) %{_libdir}/%{pkg_name}/plugin/auth_pam_tool_dir/auth_pam_tool +%{_libdir}/security/pam_user_map.so +%{_sysconfdir}/security/user_map.conf +%endif + +%if %{with sphinx} +%files sphinx-engine +%{_libdir}/%{pkg_name}/plugin/ha_sphinx.so +%endif + +%if %{with oqgraph} +%files oqgraph-engine +%config(noreplace) %{_sysconfdir}/my.cnf.d/oqgraph.cnf +%{_libdir}/%{pkg_name}/plugin/ha_oqgraph.so +%endif + +%if %{with connect} +%files connect-engine +%config(noreplace) %{_sysconfdir}/my.cnf.d/connect.cnf +%{_libdir}/%{pkg_name}/plugin/ha_connect.so +%endif + +%if %{with s3} +%files s3-engine +%{_bindir}/aria_s3_copy +%{_mandir}/man1/aria_s3_copy.1* +%config(noreplace) %{_sysconfdir}/my.cnf.d/s3.cnf +%{_libdir}/%{pkg_name}/plugin/ha_s3.so +%endif + +%files server-utils +# Perl utilities +%{_bindir}/mysql{_convert_table_format,dumpslow,_fix_extensions,hotcopy,_setpermission} +%{_bindir}/mariadb-{convert-table-format,dumpslow,fix-extensions,hotcopy,setpermission} +%{_bindir}/{mysqld_,mariadbd-}multi + +%{_mandir}/man1/mysql{_convert_table_format,dumpslow,_fix_extensions,hotcopy,_setpermission}.1* +%{_mandir}/man1/mariadb-{convert-table-format,dumpslow,fix-extensions,hotcopy,setpermission}.1* +%{_mandir}/man1/{mysqld_,mariadbd-}multi.1* +# Utilities that can be used remotely +%{_bindir}/{mysql_,mariadb-}upgrade +%{_bindir}/perror +%{_mandir}/man1/{mysql_,mariadb-}upgrade.1* +%{_mandir}/man1/perror.1* + +%if %{with devel} +%files devel +%{_includedir}/* +%{_datadir}/aclocal/mysql.m4 +%{_libdir}/pkgconfig/*mariadb.pc +%if %{with clibrary} +%{_libdir}/{libmysqlclient.so.18,libmariadb.so,libmysqlclient.so,libmysqlclient_r.so} +%{_bindir}/mysql_config* +%{_bindir}/mariadb_config* +%{_bindir}/mariadb-config +%{_libdir}/libmariadb.so +%{_libdir}/libmysqlclient.so +%{_libdir}/libmysqlclient_r.so +%{_mandir}/man1/mysql_config* +%endif +%endif + +%if %{with embedded} +%files embedded +%{_libdir}/libmariadbd.so.* + +%files embedded-devel +%{_libdir}/libmysqld.so +%{_libdir}/libmariadbd.so +%endif + +%if %{with test} +%files test +%if %{with embedded} +%{_bindir}/test-connect-t +%{_bindir}/{mysql_client_test_embedded,mysqltest_embedded} +%{_bindir}/{mariadb-client-test-embedded,mariadb-test-embedded} +%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1* +%{_mandir}/man1/{mariadb-client-test-embedded,mariadb-test-embedded}.1* +%endif +%{_bindir}/{mysql_client_test,mysqltest,mariadb-client-test,mariadb-test} +%{_bindir}/my_safe_process +%attr(-,mysql,mysql) %{_datadir}/mysql-test +%{_mandir}/man1/{mysql_client_test,mysqltest,mariadb-client-test,mariadb-test}.1* +%{_mandir}/man1/my_safe_process.1* +%{_mandir}/man1/mysql-stress-test.pl.1* +%{_mandir}/man1/mysql-test-run.pl.1* +%endif + +%changelog +* Sun Aug 20 2023 Funda Wang <fundawang@yeah.net> - 4:10.5.22-1 +- update to 10.5.22 + +* Tue Feb 14 2023 peijiankang <peijiankang@kylinos.cn> - 4:10.5.16-3 +- add mariadb-openssl3.patch and mariadb-fips.patch + +* Tue Feb 7 2023 dillon chen <dillon.chen@gmail.com> - 4:10.5.16-2 +- change openssl to compat-openssl11 because openSSL upgrade to 3.0 + +* Thu May 26 2022 bzhaoop<bzhaojyathousandy@gmail.com> - 4:10.5.16-1 +- Bump to 10.5.16 for resolving CVEs below +- CVE-2022-27385 +- CVE-2022-27382 +- CVE-2022-27451 +- CVE-2022-27457 +- CVE-2022-27446 +- CVE-2022-27455 +- CVE-2022-27444 +- CVE-2022-27379 +- CVE-2022-27386 +- CVE-2022-27447 +- CVE-2022-27448 +- CVE-2022-27449 +- CVE-2022-27445 +- CVE-2022-27456 +- CVE-2022-27458 +- CVE-2022-27452 +- CVE-2022-27376 +- CVE-2022-27378 +- CVE-2022-27377 +- CVE-2022-27381 +- CVE-2022-27383 +- CVE-2022-27380 +- CVE-2022-27384 +- CVE-2022-27387 +- And we fit the latest packages for the new mariadb release, such as errmsg package. + +* Sat Apr 16 2022 bzhaoop<bzhaojyathousandy@gmail.com> - 4:10.5.15-2 +- Fix the systemd service issue about the env variable. +- Apply the patches from old branch. +- Adaption the cmake version and integrate into the spec file. + +* Thu Mar 17 2022 bzhaoop<bzhaojyathousandy@gmail.com> -4:10.5.15-1 +- Bump to 10.5.15 +- For resolving CVEs: +- CVE-2022-24048 +- CVE-2022-24052 +- CVE-2022-24050 +- CVE-2022-24051 +- CVE-2021-46668 +- CVE-2021-46658 + +* Mon Jul 26 2021 bzhaoop<bzhaojyathousandy@gmail.com> -4:10.5.10-3 +- Disable execute testing during rpm packaging for increasing performance. + +* Fri Jul 23 2021 zhouwenpei<zhouwenpei1@gmail.com> -4:10.5.10-2 +- remove unnecessary build require. + +* Wed Jun 16 2021 bzhaoop<bzhaojyathousandy@gmail.com> -4:10.5.10-1 +- Package init for new version 10.5.10 + +* Tue Sep 8 2020 lihaotian<lihaotian9@huawei.com> -3:10.3.9-11 +- Update the source0 url + +* Fri Jul 10 2020 volcanodragon<linfeilong@huawei.com> -3:10.3.9-10 +- Rename patch names + +* Fri Jul 3 2020 jinzhimin<jinzhimin2@huawei.com> -3:10.3.9-9 +- Add conflict between mysql + +* Mon Mar 2 2020 steven <steven_ygui@163.com> - 3:10.3.9-8 +- Add requires exclude for perls and skip some test cases + +* Sun Jan 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-7 +- Add mysql_install_db command in service file + +* Wed Jan 15 2020 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-6 +- Add my.cnf file + +* Wed Jan 8 2020 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-5 +- Repackaged + +* Tue Dec 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-4 +- Package rewrap and update the release number + +* Wed Sep 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 3:10.3.9-3 +- Package init diff --git a/mariadb.tmpfiles.d.in b/mariadb.tmpfiles.d.in new file mode 100644 index 0000000..cef54ad --- /dev/null +++ b/mariadb.tmpfiles.d.in @@ -0,0 +1,3 @@ +# Do not edit this file. +# To override this, put /etc/tmpfiles.d/mariadb.conf instead. +d /var/lib/mysql 0755 mysql mysql - diff --git a/my.cnf.in b/my.cnf.in new file mode 100644 index 0000000..651fd9b --- /dev/null +++ b/my.cnf.in @@ -0,0 +1,18 @@ +# +# This group is read both both by the client and the server +# use it for options that affect everything +# +[client-server] + +# +# This group is read by the server +# +[mysqld] +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 + +# +# include all files from the config directory +# +!includedir /etc/my.cnf.d + diff --git a/mysql.service.in b/mysql.service.in new file mode 100644 index 0000000..2f6541e --- /dev/null +++ b/mysql.service.in @@ -0,0 +1,64 @@ +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the +# best way is to: +# +# root> systemctl edit mariadb.service +# +# Then add additonal directives under a section (probably [Service]). +# +# For more info about custom unit files, see systemd.unit(5) or +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F +# +# For example, if you want to increase MariaDB's open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, use the contents below: +# +# [Service] +# LimitNOFILE=10000 +# + +[Unit] +Description=MariaDB 10.5.15 database server +Documentation=man:mariadbd(8) +Documentation=https://mariadb.com/kb/en/library/systemd/ +After=network.target + +[Install] +WantedBy=multi-user.target +Alias=mysql.service +Alias=mysqld.service + +[Service] +Type=notify +User=mysql +Group=mysql + +ExecStartPre=/usr/libexec/mariadb-check-socket +# '%n' expands to 'Full unit name'; man systemd.unit +ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n +# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mysql@.service.d/MY_SPECIAL.conf +# Note: we set --basedir to prevent probes that might trigger SELinux alarms, +# per bug #547485 +ExecStart=/usr/libexec/mariadbd --basedir=/var/lib/mysql/ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=/usr/libexec/mariadb-check-upgrade + +# Setting this to true can break replication and the Type=notify settings +# See also bind-address MariaDB option. +PrivateNetwork=false + +KillSignal=SIGTERM + +# Don't want to see an automated SIGKILL ever +SendSIGKILL=no + +# Restart crashed server only, on-failure would also restart, for example, when +# my.cnf contains unknown option +Restart=on-abort +RestartSec=5s + +UMask=007 + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true diff --git a/mysql@.service.in b/mysql@.service.in new file mode 100644 index 0000000..c3e2282 --- /dev/null +++ b/mysql@.service.in @@ -0,0 +1,85 @@ +# Multi instance version of MariaDB. For if you run mutiple verions at once. +# Also used for mariadb to bootstrap Galera. +# +# To use multi instance variant, use [mariadbd.INSTANCENAME] as sections in +# /etc/my.cnf to change per instance settings. A minimumal necessary +# configuration items to change to avoid conflicts between instances is: +# +# [mariadbd.instancename] +# # TCP port to make available for clients +# port=3306 +# # Socket to make available for clients +# socket=/tmp/mariadb-instancename.sock +# # Where MariaDB should store all its data +# datadir=/usr/local/mariadb-instancename/data +# +# and start the service via: +# +# root> systemctl start mariadb.server +# +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, for +# all instances, the best way is: +# +# root> systemctl edit mariadb.service +# +# Then add additonal directives under a section (probably [Service]). +# +# If you only want to change a specific instance: +# +# root> systemctl edit mariadb.server +# +# For more info about custom unit files, see systemd.unit(5) or +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F +# +# For example, if you want to increase MariaDB's open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, use the contents below: +# +# [Service] +# LimitNOFILE=10000 + +[Unit] +Description=MariaDB 10.5.15 database server (multi-instance %I) +Documentation=man:mariadbd(8) +Documentation=https://mariadb.com/kb/en/library/systemd/ +After=network.target + +[Install] +WantedBy=multi-user.target +Alias=mysql.service +Alias=mysqld.service + +[Service] +Type=notify +User=mysql +Group=mysql + +ExecStartPre=/usr/libexec/mariadb-check-socket --defaults-group-suffix=.%I +ExecStartPre=/usr/libexec/mariadb-prepare-db-dir --defaults-group-suffix=.%I %n +# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mysql@.service.d/MY_SPECIAL.conf +# Note: we set --basedir to prevent probes that might trigger SELinux alarms, +# per bug #547485 +ExecStart=/usr/libexec/mariadbd --defaults-group-suffix=.%I --basedir=/var/lib/mysql/ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=/usr/libexec/mariadb-check-upgrade --defaults-group-suffix=.%I + +# Setting this to true can break replication and the Type=notify settings +# See also bind-address MariaDB option. +PrivateNetwork=false + +KillSignal=SIGTERM + +# Don't want to see an automated SIGKILL ever +SendSIGKILL=no + +# Restart crashed server only, on-failure would also restart, for example, when +# my.cnf contains unknown option +Restart=on-abort +RestartSec=5s + +UMask=007 + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true diff --git a/mysql_config_multilib.sh b/mysql_config_multilib.sh new file mode 100644 index 0000000..82edb26 --- /dev/null +++ b/mysql_config_multilib.sh @@ -0,0 +1,26 @@ +#! /bin/sh +# +# Wrapper script for mysql_config to support multilib +# +# This command respects setarch + +bits=$(rpm --eval %__isa_bits) + +case $bits in + 32|64) status=known ;; + *) status=unknown ;; +esac + +if [ "$status" = "unknown" ] ; then + echo "$0: error: command 'rpm --eval %__isa_bits' returned unknown value: $bits" + exit 1 +fi + + +if [ -x /usr/bin/mysql_config-$bits ] ; then + /usr/bin/mysql_config-$bits "$@" +else + echo "$0: error: needed binary: /usr/bin/mysql_config-$bits is missing" + exit 1 +fi + diff --git a/skipped-tests-arm.list b/skipped-tests-arm.list new file mode 100644 index 0000000..ec2e920 --- /dev/null +++ b/skipped-tests-arm.list @@ -0,0 +1,5 @@ +# Fails since 10.3.17, only on armv7hl +versioning.partition : + +# Fail since 10.4.16 only on armv7hl +versioning.partition_rotation : diff --git a/skipped-tests-base.list b/skipped-tests-base.list new file mode 100644 index 0000000..a0bb6a8 --- /dev/null +++ b/skipped-tests-base.list @@ -0,0 +1,54 @@ +# The SSL test are failing correctly. Fro more explanation, see: +# https://jira.mariadb.org/browse/MDEV-8404?focusedCommentId=84275&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-84275 +main.ssl_7937 : #1399847 +main.ssl_8k_key : +main.ssl_crl : #1399847 + +# ------------------------------ +# Tests that fails because of 'Self Signed Certificate in the Certificate Chain' +perfschema.cnf_option : + +rpl.rpl_row_img_blobs : +rpl.rpl_row_img_eng_min : +rpl.rpl_row_img_eng_noblob : + +sys_vars.slave_parallel_threads_basic : + +# ------------------------------ +# Expected to fail, the plugin is not build with server, but 'mariadb-connector-c' instead +plugins.auth_ed25519 : +plugins.multiauth : + +# ------------------------------ +perfschema.nesting : #1399847 +perfschema.socket_summary_by_instance_func : #1399847 +perfschema.socket_summary_by_event_name_func : + +# ------------------------------ +# Fails since 10.1.12 +innodb.innodb_defrag_binlog : + +# Fails everywhere since 10.2.15 +main.userstat : + +# Fails everywhere since 10.4.11 +main.events_bugs : +sys_vars.tcp_nodelay : + +# Fails on i686 +encryption.innodb-redo-badkey : + +# Fails since 10.5.2 +main.mysqld--help2 : +disks.disks : +disks.disks_notembedded : + +# Fails since 10.5.3 +main.mysqld--help-aria : + +# Fails since 10.5.4 +main.ssl_system_ca : + +# Fails since 10.5.7 +innodb.innodb_wl6326_big : +plugins.feedback_plugin_load : @@ -0,0 +1 @@ +a492aa334f1111513b049e89b15b40d8 mariadb-10.5.22.tar.gz |