!9 upgrade mysql pacakge

Merge pull request !9 from jeff200902/master
This commit is contained in:
openeuler-ci-bot 2020-06-30 16:11:03 +08:00 committed by Gitee
commit 4f0a0660b7
25 changed files with 1291 additions and 88 deletions

View File

@ -1,20 +0,0 @@
diff --git a/cmake/build_configurations/compiler_options.cmake b/cmake/build_configurations/compiler_options.cmake
index fecf2a2..f3e012f 100644
--- a/cmake/build_configurations/compiler_options.cmake
+++ b/cmake/build_configurations/compiler_options.cmake
@@ -43,6 +43,7 @@ IF(UNIX)
# Default GCC flags
IF(CMAKE_COMPILER_IS_GNUCC)
SET(COMMON_C_FLAGS "-fno-omit-frame-pointer")
+ SET(COMMON_C_FLAGS "-fstack-protector-strong")
# Disable inline optimizations for valgrind testing to avoid false positives
IF(WITH_VALGRIND)
STRING_PREPEND(COMMON_C_FLAGS "-fno-inline ")
@@ -57,6 +58,7 @@ IF(UNIX)
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(COMMON_CXX_FLAGS "-std=c++14 -fno-omit-frame-pointer")
+ SET(COMMON_CXX_FLAGS "-fstack-protector-strong")
# Disable inline optimizations for valgrind testing to avoid false positives
IF(WITH_VALGRIND)
STRING_PREPEND(COMMON_CXX_FLAGS "-fno-inline ")

4
README.mysql-docs Normal file
View File

@ -0,0 +1,4 @@
The official MySQL documentation is not freely redistributable, so we cannot
include it in RHEL or Fedora. You can find it on-line at
http://dev.mysql.com/doc/

9
README.mysql-license Normal file
View File

@ -0,0 +1,9 @@
MySQL is distributed under GPL v2, but there are some licensing exceptions
that allow the client libraries to be linked with a non-GPL application,
so long as the application is under a license approved by Oracle.
For details see
http://www.mysql.com/about/legal/licensing/foss-exception/
Some innobase code from Percona and Google is under BSD license.
Some code related to test-suite is under LGPLv2.

View File

@ -0,0 +1,22 @@
diff -Nur a/plugin/x/client/mysqlxclient/xmessage.h b/plugin/x/client/mysqlxclient/xmessage.h
--- a/plugin/x/client/mysqlxclient/xmessage.h 2019-09-20 16:30:51.000000000 +0800
+++ b/plugin/x/client/mysqlxclient/xmessage.h 2020-06-03 10:50:50.605147957 +0800
@@ -36,7 +36,6 @@
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/wire_format_lite.h>
-#include <google/protobuf/wire_format_lite_inl.h>
#ifdef USE_MYSQLX_FULL_PROTO
diff -Nur a/plugin/x/ngs/include/ngs/protocol/protocol_protobuf.h b/plugin/x/ngs/include/ngs/protocol/protocol_protobuf.h
--- a/plugin/x/ngs/include/ngs/protocol/protocol_protobuf.h 2019-09-20 16:30:51.000000000 +0800
+++ b/plugin/x/ngs/include/ngs/protocol/protocol_protobuf.h 2020-06-03 10:51:54.566083039 +0800
@@ -38,7 +38,6 @@
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/wire_format_lite.h>
-#include <google/protobuf/wire_format_lite_inl.h>
#ifdef USE_MYSQLX_FULL_PROTO
#include "plugin/x/generated/protobuf/mysqlx.pb.h"

View File

@ -0,0 +1,31 @@
diff -up a/boost/boost_1_70_0/boost/mpl/print.hpp b/boost/boost_1_70_0/boost/mpl/print.hpp
--- a/boost/boost_1_70_0/boost/mpl/print.hpp 2014-07-09 23:12:31.000000000 +0200
+++ b/boost/boost_1_70_0/boost/mpl/print.hpp 2015-01-20 12:44:59.621400948 +0100
@@ -52,16 +52,15 @@ struct print
enum { n = sizeof(T) + -1 };
#elif defined(__MWERKS__)
void f(int);
-#else
- enum {
- n =
-# if defined(__EDG_VERSION__)
- aux::dependent_unsigned<T>::value > -1
-# else
- sizeof(T) > -1
-# endif
- };
-#endif
+#elif defined(__EDG_VERSION__)
+ enum { n = aux::dependent_unsigned<T>::value > -1 };
+#elif defined(BOOST_GCC)
+ enum { n1 };
+ enum { n2 };
+ enum { n = n1 != n2 };
+#else
+ enum { n = sizeof(T) > -1 };
+#endif
};
#if defined(BOOST_MSVC)
Diff finished. Tue Jan 20 12:45:03 2015

120
boost-1.58.0-pool.patch Normal file
View File

@ -0,0 +1,120 @@
Index: boost/boost_1_70_0/boost/pool/pool.hpp
===================================================================
--- a/boost/boost_1_70_0/boost/pool/pool.hpp (revision 78317)
+++ b/boost/boost_1_70_0/boost/pool/pool.hpp (revision 78326)
@@ -27,4 +27,6 @@
#include <boost/pool/poolfwd.hpp>
+// std::numeric_limits
+#include <boost/limits.hpp>
// boost::integer::static_lcm
#include <boost/integer/common_factor_ct.hpp>
@@ -358,4 +360,11 @@
}
+ size_type max_chunks() const
+ { //! Calculated maximum number of memory chunks that can be allocated in a single call by this Pool.
+ size_type partition_size = alloc_size();
+ size_type POD_size = integer::static_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type);
+ return (std::numeric_limits<size_type>::max() - POD_size) / alloc_size();
+ }
+
static void * & nextof(void * const ptr)
{ //! \returns Pointer dereferenced.
@@ -377,5 +388,7 @@
//! the first time that object needs to allocate system memory.
//! The default is 32. This parameter may not be 0.
- //! \param nmax_size is the maximum number of chunks to allocate in one block.
+ //! \param nmax_size is the maximum number of chunks to allocate in one block.
+ set_next_size(nnext_size);
+ set_max_size(nmax_size);
}
@@ -400,7 +413,7 @@
}
void set_next_size(const size_type nnext_size)
- { //! Set number of chunks to request from the system the next time that object needs to allocate system memory. This value should never be set to 0.
- //! \returns nnext_size.
- next_size = start_size = nnext_size;
+ { //! Set number of chunks to request from the system the next time that object needs to allocate system memory. This value should never be set to 0.
+ BOOST_USING_STD_MIN();
+ next_size = start_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nnext_size, max_chunks());
}
size_type get_max_size() const
@@ -410,5 +423,6 @@
void set_max_size(const size_type nmax_size)
{ //! Set max_size.
- max_size = nmax_size;
+ BOOST_USING_STD_MIN();
+ max_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nmax_size, max_chunks());
}
size_type get_requested_size() const
@@ -713,7 +727,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// initialize it,
@@ -753,7 +767,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// initialize it,
@@ -797,4 +811,6 @@
//! \returns Address of chunk n if allocated ok.
//! \returns 0 if not enough memory for n chunks.
+ if (n > max_chunks())
+ return 0;
const size_type partition_size = alloc_size();
@@ -845,7 +861,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// insert it into the list,
Index: libs/pool/test/test_bug_6701.cpp
===================================================================
--- libs/pool/test/test_bug_6701.cpp (revision 78326)
+++ libs/pool/test/test_bug_6701.cpp (revision 78326)
@@ -0,0 +1,27 @@
+/* Copyright (C) 2012 Étienne Dupuis
+*
+* Use, modification and distribution is subject to the
+* Boost Software License, Version 1.0. (See accompanying
+* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Test of bug #6701 (https://svn.boost.org/trac/boost/ticket/6701)
+
+#include <boost/pool/object_pool.hpp>
+#include <boost/limits.hpp>
+
+int main()
+{
+ boost::pool<> p(1024, std::numeric_limits<size_t>::max() / 768);
+
+ void *x = p.malloc();
+ BOOST_ASSERT(!x);
+
+ BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_next_size());
+ BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_max_size());
+
+ void *y = p.ordered_malloc(std::numeric_limits<size_t>::max() / 768);
+ BOOST_ASSERT(!y);
+
+ return 0;
+}

View File

@ -0,0 +1,24 @@
Fix things so that chains of certificates work in the server and client
certificate files.
This only really works for OpenSSL-based builds, as yassl is unable to read
multiple certificates from a file. The patch below to yassl/src/ssl.cpp
doesn't fix that, but just arranges that the viosslfactories.c patch won't
have any ill effects in a yassl build. Since we don't use yassl in Red Hat/
Fedora builds, I'm not feeling motivated to try to fix yassl for this.
See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158
diff --git a/vio/viosslfactories.cc b/vio/viosslfactories.cc
index 5e881e3..2927e7f 100644
--- a/vio/viosslfactories.cc
+++ b/vio/viosslfactories.cc
@@ -198,7 +198,7 @@ static int vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file,
if (!key_file && cert_file) key_file = cert_file;
if (cert_file &&
- SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) {
+ SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) {
*error = SSL_INITERR_CERT;
DBUG_PRINT("error",
("%s from file '%s'", sslGetErrString(*error), cert_file));

View File

@ -0,0 +1,45 @@
Upstream chooses to install INFO_SRC and INFO_BIN into the docs dir, which
breaks at least two packaging commandments, so we put them into $libdir
instead. That means we have to hack the file_contents regression test
to know about this.
Recommendation they change is at http://bugs.mysql.com/bug.php?id=61425
diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test
index 75f8c93..973291c 100644
--- a/mysql-test/t/file_contents.test
+++ b/mysql-test/t/file_contents.test
@@ -12,7 +12,7 @@
--perl
print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n";
$dir_bin = $ENV{'MYSQL_BINDIR'};
-if ($dir_bin =~ m|^/usr/|) {
+if ($dir_bin =~ m|.*/usr/$|) {
# RPM package
$dir_docs = $dir_bin;
$dir_docs =~ s|/lib|/share/doc|;
@@ -35,7 +35,7 @@ if ($dir_bin =~ m|^/usr/|) {
}
}
}
-} elsif ($dir_bin =~ m|/usr$|) {
+} elsif ($dir_bin =~ m|.*/usr$|) {
# RPM build during development
$dir_docs = "$dir_bin/share/doc";
if(-d "$dir_docs/packages") {
@@ -55,6 +55,15 @@ if ($dir_bin =~ m|^/usr/|) {
$dir_docs = glob "$dir_bin/share/mysql-*/docs";
}
}
+
+ # All the above is entirely wacko, because these files are not docs;
+ # they should be kept in libdir instead. mtr does not provide a nice
+ # way to find libdir though, so we have to kluge it like this:
+ if (-d "$dir_bin/lib64/mysql") {
+ $dir_docs = "$dir_bin/lib64/mysql";
+ } else {
+ $dir_docs = "$dir_bin/lib/mysql";
+ }
}
} else {
# tar.gz package, Windows, or developer work (in git)

View File

@ -0,0 +1,52 @@
Improve the documentation that will be installed in the mysql-test RPM.
diff -Naur mysql-5.5.20.orig/mysql-test/README mysql-5.5.20/mysql-test/README
--- mysql-5.5.20.orig/mysql-test/README 2011-12-16 14:52:05.000000000 -0500
+++ mysql-5.5.20/mysql-test/README 2012-02-10 17:06:19.531082253 -0500
@@ -1,14 +1,26 @@
This directory contains a test suite for the MySQL daemon. To run
-the currently existing test cases, simply execute ./mysql-test-run in
-this directory. It will fire up the newly built mysqld and test it.
+the currently existing test cases, execute ./mysql-test-run in
+this directory.
-Note that you do not have to have to do "make install", and you could
-actually have a co-existing MySQL installation. The tests will not
-conflict with it.
-
-All tests must pass. If one or more of them fail on your system, please
-read the following manual section for instructions on how to report the
-problem:
+For use in Red Hat distributions, you should run the script as user mysql,
+so the best bet is something like
+ cd /usr/share/mysql-test
+ sudo -u mysql ./mysql-test-run --skip-test-list=platform-specific-tests.list
+This will use the installed mysql executables, but will run a private copy
+of the server process (using data files within /usr/share/mysql-test),
+so you need not start the mysqld service beforehand.
+
+The "--skip-test-list=platform-specific-tests.list" option excludes tests that are
+known to fail on one or more Red-Hat-supported platforms. You can omit it
+if you want to check whether such failures occur for you. Documentation
+about the reasons for omitting such tests can be found in the file
+platform-specific-tests.list.
+
+To clean up afterwards, remove the created "var" subdirectory, eg
+ sudo -u mysql rm -rf /usr/share/mysql-test/var
+
+If one or more tests fail on your system, please read the following manual
+section for instructions on how to report the problem:
http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
@@ -25,7 +37,8 @@
With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
-tests cannot run with an external server.
+tests cannot run with an external server (because they need to control the
+options with which the server is started).
You can create your own test cases. To create a test case, create a new

View File

@ -0,0 +1,77 @@
Some hard-coded paths make problems when package is built into chroot like
Software Collections. Removing these hard-coded paths should fix it.
Upstream report: https://mariadb.atlassian.net/browse/MDEV-6485
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 94d9ecf5..69058c22 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -109,7 +109,7 @@ IF(UNIX)
" Choose between ${VALID_INSTALL_LAYOUTS}" )
ENDIF()
- SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
+ SET(SYSCONFDIR "/etc"
CACHE PATH "config directory (for my.cnf)")
MARK_AS_ADVANCED(SYSCONFDIR)
ENDIF()
@@ -271,6 +271,7 @@ SET(INSTALL_SECURE_FILE_PRIVDIR_TARGZ ${secure_file_priv_path})
#
SET(INSTALL_BINDIR_RPM "bin")
SET(INSTALL_SBINDIR_RPM "sbin")
+SET(INSTALL_SYSCONFDIR_RPM "/etc")
#
IF(CMAKE_SYSTEM_PROCESSOR IN_LIST KNOWN_64BIT_ARCHITECTURES)
SET(INSTALL_LIBDIR_RPM "lib64/mysql")
diff --git a/mysys/my_default.cc b/mysys/my_default.cc
index a8f6132a..3b448ef3 100644
--- a/mysys/my_default.cc
+++ b/mysys/my_default.cc
@@ -1565,12 +1565,12 @@ static const char **init_default_directories(MEM_ROOT *alloc) {
#else
- errors += add_directory(alloc, "/etc/", dirs);
- errors += add_directory(alloc, "/etc/mysql/", dirs);
-
#if defined(DEFAULT_SYSCONFDIR)
if (DEFAULT_SYSCONFDIR[0])
+ {
errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
+ errors += add_directory(alloc, DEFAULT_SYSCONFDIR "/mysql", dirs);
+ }
#endif /* DEFAULT_SYSCONFDIR */
#endif
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index c64bfb52..1b2a76cf 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -288,9 +288,9 @@ IF(UNIX)
ENDIF(UNIX)
SET(prefix "${CMAKE_INSTALL_PREFIX}")
-SET(sysconfdir ${prefix})
+SET(sysconfdir ${SYSCONFDIR})
SET(bindir ${prefix}/${INSTALL_BINDIR})
-SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+SET(libexecdir ${prefix}/${INSTALL_LIBEXECDIR})
SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
SET(libsubdir ${INSTALL_LIBDIR})
SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 8cd63ecc..21ad556c 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -586,9 +586,7 @@ sub list_defaults_files
my %seen; # Don't list the same file more than once
return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
- ('/etc/my.cnf',
- '/etc/mysql/my.cnf',
- '@sysconfdir@/my.cnf',
+ ('@sysconfdir@/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
$opt{'extra-file'},
($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));

View File

@ -0,0 +1,19 @@
MySQL 8.0 includes a feature that requires we set linux NICE capabilities to
mysqld daemon. Because of that, LD_LIBRARY_PATH does not work (see
secure-execution mode in http://man7.org/linux/man-pages/man8/ld.so.8.html).
Related: #1628814
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 3f179a7a..209b3eb2 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -918,6 +918,8 @@ IF(UNIX_INSTALL_RPATH_ORIGIN_PRIV_LIBDIR)
ADD_INSTALL_RPATH_FOR_PROTOBUF(mysqld)
ENDIF()
+SET_TARGET_PROPERTIES(mysqld PROPERTIES INSTALL_RPATH "${RPATH_LIBDIR}")
+
OPTION(DEBUG_EXTNAME "Build server as mysqld-debug (debug builds only)" OFF)
MARK_AS_ADVANCED(DEBUG_EXTNAME)

View File

@ -0,0 +1,37 @@
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index c64bfb52..4da9e699 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -523,6 +523,32 @@ ELSE()
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
ENDIF()
+
+ # files for systemd
+ SET(SYSTEMD_SCRIPTS
+ mysql.tmpfiles.d
+ mysql.service
+ mysql@.service
+ mysql-prepare-db-dir
+ mysql-wait-stop
+ mysql-check-socket
+ mysql-scripts-common
+ mysql_config_multilib
+ my.cnf
+ server.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

View File

@ -0,0 +1,27 @@
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index f77bd022..a3a3bd9f 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -57,6 +57,9 @@ IF(INSTALL_MYSQLTESTDIR)
ENDIF()
+# Expand some paths in the perl script correctly
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql-test-run.pl ${CMAKE_CURRENT_SOURCE_DIR}/mysql-test-run.pl @ONLY)
+
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory
FIND_PROGRAM(PERL_EXECUTABLE perl
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index b82611fd..7fc5987e 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1656,7 +1656,7 @@ sub command_line_setup {
my $path_share = $path_language;
@share_locations =
- ("share/mysql-" . $mysql_base_version, "share/mysql", "share");
+ ("@INSTALL_MYSQLSHAREDIR@", "share/mysql-" . $mysql_base_version, "share/mysql", "share");
$path_charsetsdir = my_find_dir($basedir, \@share_locations, "charsets");

37
community-mysql.rpmlintrc Normal file
View File

@ -0,0 +1,37 @@
# THIS FILE SERVES FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON
# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors
# (same file in python3 package served as a great example)
# Spelling errors
addFilter(r'spelling-error .* en_US (cnf|mysqld|subpackage) ')
# Debug symlinks
addFilter(r'dangling-relative-symlink /usr/lib/.build-id')
# Testsuite
# Some expected tests results are zero-length files
addFilter(r'(zero-length|pem-certificate|hidden-file-or-dir) /usr/share/mysql-test/*')
# Chroot function
# False positive; checked by upstream
addFilter(r'missing-call-to-chdir-with-chroot')
# Missing documentation
# I don't think that's on the upstream priority list
addFilter(r'no-documentation')
addFilter(r'no-manual-page-for-binary')
# Cluster is gone
addFilter("W: obsolete-not-provided mysql-cluster")
addFilter("W: obsolete-not-provided mysql-bench")
addFilter("W: obsolete-not-provided community-mysql-bench")
# Config file without noreplace flag
# Don't replace logs that may contain old entries
addFilter(r'conffile-without-noreplace-flag /var/log/mariadb/mariadb.log')
# Seems pretty standard to me ...
addFilter(r'non-standard-dir-perm /var/log/mysql 750')

16
my.cnf.in Normal file
View File

@ -0,0 +1,16 @@
#
# 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]
#
# include all files from the config directory
#
!includedir @SYSCONF2DIR@

39
mysql-check-socket.sh Normal file
View File

@ -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]}`/mysql-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
if fuser "$socketfile" &>/dev/null ; then
socketpid=$(fuser "$socketfile" 2>/dev/null)
echo "Is another MySQL daemon already running with the same unix socket?" >&2
echo "Please, stop the process $socketpid or remove $socketfile 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

112
mysql-prepare-db-dir.sh Normal file
View File

@ -0,0 +1,112 @@
#!/bin/sh
# This script creates the mysql data directory during first service start.
# In subsequent starts, it does nothing much.
#
# This script is meant to be run as non-root user either during initscript
# or systemd service execution, before starting the mysqld daemon.
# Running it as root may have some security risks, because it touches files
# that can be symlinks pointing to unexpected locations.
#
# On the other hand, when using non-standard locations for datadir and logfile,
# this script might not be able to create the files and the daemon won't start
# properly. A solution for that is to created the locations for datadir and
# logfile with correct ownership before starting the daemon.
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
# 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=@DAEMON_NAME@.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."
exit 1
elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then
echo "The log file $errlogfile cannot be written, please, fix its permissions."
echo "The daemon will be run under $myuser:$mygroup"
exit 1
fi
fi
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")"
}
# Make the data directory if doesn't exist or empty
if should_initialize "$datadir" ; then
# Now create the database
echo "Initializing @NICE_PROJECT_NAME@ database"
@libexecdir@/mysqld --initialize-insecure --datadir="$datadir" --user="$myuser"
ret=$?
if [ $ret -ne 0 ] ; then
echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2
echo "Perhaps @sysconfdir@/my.cnf is misconfigured." >&2
# Clean up any partially-created database files
if [ ! -e "$datadir/mysql/user.frm" ] ; then
rm -rf "$datadir"/*
fi
exit $ret
fi
# upgrade does not need to be run on a fresh datadir
echo "@VERSION@" >"$datadir/mysql_upgrade_info"
fi
exit 0

68
mysql-scripts-common.sh Normal file
View File

@ -0,0 +1,68 @@
#!/bin/sh
# Some useful functions used in other MySQL helper scripts
# This scripts defines variables datadir, errlogfile, socketfile
export LC_ALL=C
# extract value of a MySQL 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=`@bindir@/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, scrits 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 mysqld_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 mysqld daemon or
# mysqld_safe script
# 2) configurable values are defined in @sysconfdir@/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 mysqld_safe script and source
# code itself.
server_sections="mysqld_safe mysqld server mysqld-@MAJOR_VERSION@.@MINOR_VERSION@ client-server"
get_mysql_option "$server_sections" datadir "@MYSQL_DATADIR@"
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/`hostname`.err"
errlogfile="$result"
get_mysql_option "$server_sections" socket "@MYSQL_UNIX_ADDR@"
socketfile="$result"
get_mysql_option "$server_sections" pid-file "$datadir/`hostname`.pid"
pidfile="$result"

36
mysql-wait-stop.sh Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
# This script waits for mysqld to be properly stopped
# (which can be many seconds in some large load).
# Running this as ExecStopPost is useful so that starting which is done
# as part of restart doesn't see the former process still running.
# Wait for the server to properly end the main server
ret=0
TIMEOUT=60
SECONDS=0
if ! [ -f "$pidfile" ]; then
exit 0
fi
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -z "$MYSQLPID" ] ; then
exit 2
fi
while /bin/true; do
# Check process still exists
if ! [ -d "/proc/${MYSQLPID}" ] ; then
break
fi
if [ $SECONDS -gt $TIMEOUT ] ; then
ret=3
break
fi
sleep 1
done
exit $ret

62
mysql.service.in Normal file
View File

@ -0,0 +1,62 @@
# 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 use systemctl edit:
#
# $ systemctl edit @DAEMON_NAME@.service
#
# this will create file
#
# /etc/systemd/system/@DAEMON_NAME@.service.d/override.conf
#
# which be parsed after the file @DAEMON_NAME@.service itself is parsed.
#
# For example, if you want to increase mysql's open-files-limit to 20000
# add following when editing with command above:
#
# [Service]
# LimitNOFILE=20000
#
# Or if you require to execute pre and post scripts in the unit file as root, set
# PermissionsStartOnly=true
#
# 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
#
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload
[Unit]
Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target
After=network.target
[Service]
Type=notify
User=mysql
Group=mysql
ExecStartPre=@libexecdir@/mysql-check-socket
ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --basedir=@prefix@
ExecStopPost=@libexecdir@/mysql-wait-stop
# 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
Restart=on-failure
RestartPreventExitStatus=1
# Sets open_files_limit
LimitNOFILE = 10000
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
Environment=MYSQLD_PARENT_PID=1
[Install]
WantedBy=multi-user.target

View File

@ -1,91 +1,370 @@
%define debug_package %{nil} #%{!?runselftest:%global runselftest 0}
%define __os_install_post %{nil} Name: mysql
%define __debug_install_post \ Version: 8.0.18
%{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\ Release: 2
%{nil} Summary: The package provides MySQL programs and shared libraries
License: GPLv2 with exceptions and LGPLv2 and BSD
Name: mysql URL: http://www.mysql.com
Version: 8.0.17 Source0: https://cdn.mysql.com/Downloads/MySQL-8.0/mysql-boost-%{version}.tar.gz
Release: 4 Source1: mysql_config_multilib.sh
License: GPLv2 Source2: my.cnf.in
Summary: The world's most popular open source database Source3: README.mysql-docs
URL: http://www.mysql.com/ Source4: README.mysql-license
Source0: https://cdn.mysql.com/archives/%{name}-8.0/%{name}-boost-%{version}.tar.gz Source5: mysql.tmpfiles.d.in
Source6: mysql.service.in
Patch0000: 0000-mysql-add-fstack-protector-strong.patch Source7: mysql-prepare-db-dir.sh
BuildRequires: cmake openssl-devel ncurses-devel libtirpc-devel rpcgen Source8: mysql-check-socket.sh
Requires: libatomic >= 1.2.0 libstdc++ >= 7.3.0 ncurses libtirpc openssl Source9: mysql-scripts-common.sh
Source10: mysql-wait-stop.sh
Source11: mysql@.service.in
Source12: community-mysql.rpmlintrc
Source13: server.cnf.in
Patch0000: community-mysql-install-test.patch
Patch0001: community-mysql-file-contents.patch
Patch0002: community-mysql-scripts.patch
Patch0003: community-mysql-paths.patch
Patch0004: community-mysql-chain-certs.patch
Patch0005: community-mysql-sharedir.patch
Patch0006: community-mysql-rpath.patch
Patch0007: boost-1.58.0-pool.patch
Patch0008: boost-1.57.0-mpl-print.patch
Patch9001: all-mysql-8.0.18-add-protobuf-support.patch
BuildRequires: cmake gcc-c++ libaio-devel libedit-devel libevent-devel libicu-devel
BuildRequires: lz4-devel mecab-devel bison libzstd-devel openssl openssl-devel
BuildRequires: perl-interpreter perl-generators rpcgen libtirpc-devel lz4
BuildRequires: protobuf-lite-devel rapidjson-devel re2-devel zlib zlib-devel
BuildRequires: multilib-rpm-config procps time perl(Digest::file) perl(Digest::MD5) perl(Env)
BuildRequires: perl(Exporter) perl(Fcntl) perl(File::Temp) perl(Data::Dumper)
BuildRequires: perl(Getopt::Long) perl(IPC::Open3) perl(JSON) perl(LWP::Simple) perl(Memoize)
BuildRequires: perl(Socket) perl(Sys::Hostname) perl(Test::More) perl(Time::HiRes) systemd
%ifnarch aarch64
BuildRequires: numactl-devel
%endif
Requires: bash coreutils grep mysql-common = %{version}-%{release}
Provides: bundled(boost) = 1.69 mysql = %{version}-%{release}
Provides: mysql-compat-client = %{version}-%{release}
Conflicts: mariadb
Obsoletes: mysql-cluster < 5.1.44
%description %description
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, MySQL is a multi-threaded, multi-user database server. It consists
and robust SQL (Structured Query Language) database server. MySQL Server of a client, server implementation composed of a server daemon, and
is intended for mission-critical, heavy-load production systems as well differentClient program. Contains standard MySQL client and common
as for embedding into mass-deployed software. MySQL is a trademark of MySQL library and interface files.
Oracle and/or its affiliates
The MySQL software has Dual Licensing, which means you can use the MySQL %package libs
software free of charge under the GNU General Public License Summary: The shared libraries required for MySQL clients
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL Requires: mysql-common = %{version}-%{release}
licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of Provides: mysql-libs = %{version}-%{release}
the GPL. See the chapter "Licensing and Support" in the manual for %description libs
further info. The mysql-libs package provides the essential shared libraries for any
MySQL client program or interface. You will need to install this package
to use any other MySQL package or any clients that need to connect to a
MySQL server.
%package config
Summary: The config files required by server and cl
%description config
This package contains the config file my.cnf and my.cnf.d dir for MariaDB
or MySQL program. You will need to install this pack other MariaDB or MySQL
package if the config files are not package itself.
%package common
Summary: The shared files required for MySQL server and client
Requires: %{_sysconfdir}/my.cnf
%description common
This pacakge contains the essential shared files for any MySQL program.
Need to install this package to use any other MySQL package.
%package errmsg
Summary: The error messages files required by MySQL server
Requires: mysql-common = %{version}-%{release}
%description errmsg
The package contains the MySQL daemon`s error messages.
%package server
Summary: The MySQL server and related files
Suggests: mysql = %{version}-%{release}
Requires: mysql
Requires: mysql-common = %{version}-%{release} %{_sysconfdir}/my.cnf
Requires: %{_sysconfdir}/my.cnf.d mysql-errmsg = %{version}-%{release}
Requires: coreutils systemd
Requires(pre): /usr/sbin/useradd
Recommends: libcap
Requires(post): policycoreutils-python-utils
Requires: (mysql-selinux if selinux-policy-targeted)
Provides: mysql-server = %{version}-%{release}
Provides: mysql-compat-server = %{version}-%{release}
Obsoletes: mysql-bench < 5.7.8
Obsoletes: community-mysql-bench < 5.7.8
Conflicts: mariadb-server
Conflicts: mariadb-galera-server
%description server
MySQL is a multi-threadmulti-user database. It consists with client/server
implementation, a server daemon(mysqld) and many different client programs
and libraries. The package contains MySQL server、directories and other
accompanying files.
%package devel
Summary: Files for development of MySQL applications
Requires: mysql-libs = %{version}-%{release}
Requires: openssl-devel zlib-devel
Conflicts: mariadb-devel
%description devel
MySQL is a multi-threadmulti-user database. This package provides
the header files and libraries for the developing of MySQL client applications.
%package test
Summary: The test suite distributed with MySQL
Requires: mysql = %{version}-%{release} mysql-common = %{version}-%{release}
Requires: mysql-server = %{version}-%{release} gzip lz4 openssl perl(Digest::file)
Requires: perl(Digest::MD5) perl(Env) perl(Exporter) perl(Fcntl) perl(File::Temp)
Requires: perl(Data::Dumper) perl(Getopt::Long) perl(IPC::Open3) perl(JSON)
Requires: perl(LWP::Simple) perl(Memoize) perl(Socket) perl(Sys::Hostname)
Requires: perl(Test::More) perl(Time::HiRes)
Conflicts: mariadb-test
Provides: mysql-test = %{version}-%{release}
%description test
MySQL is a multi-threadmulti-user database. The package provides test suite.
%package help
Summary: Docs for development of MySQL applications.
Requires: mysql = %{version}-%{release}
%description help
The package provides Docs for development of MySQL applications.
%prep %prep
%autosetup -n %{name}-%{version} -p1 %autosetup -n mysql-%{version} -p1
cd mysql-test
add_test () {
echo "$1" : BUG#0 "${@:2}" >> platform-specific-tests.list
}
touch platform-specific-tests.list
add_test innodb.redo_log_archive_04 failed since 8.0.17
add_test clone.remote_dml_no_binlog failed since 8.0.17
%ifarch %arm aarch64
add_test gis.st_latitude
add_test gis.st_longitude
add_test perfschema.func_file_io missing hw on arm32
add_test perfschema.func_mutex missing hw on arm32
add_test perfschema.global_read_lock missing hw on arm32
add_test perfschema.setup_objects missing hw on arm32
%endif
cd -
cp %{SOURCE1} %{SOURCE2} %{SOURCE5} %{SOURCE6} %{SOURCE7} \
%{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE13} scripts
%build %build
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc \ %{set_build_flags}
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 \ %if %runselftest
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \ if [ x"$(id -u)" = "x0" ]; then
-DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci \ echo "mysql's regression tests fail if run as root."
-DWITH_EMBEDDED_SERVER=1 -DCMAKE_C_COMPILER=/usr/bin/gcc -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost -DFORCE_INSOURCE_BUILD=1 echo "If you really need to build the RPM as root, use"
%make_build echo "--nocheck to skip the regression tests."
exit 1
fi
%endif
mkdir -p build && cd build
cmake .. \
-DBUILD_CONFIG=mysql_release -DFEATURE_SET="community" -DINSTALL_LAYOUT=RPM -DDAEMON_NAME="mysqld" \
-DDAEMON_NO_PREFIX="mysqld" -DLOG_LOCATION="%{_localstatedir}/log/mysql/mysqld.log" \
-DPID_FILE_DIR="%{_rundir}/mysqld" -DNICE_PROJECT_NAME="MySQL" -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DSYSCONFDIR="%{_sysconfdir}" -DSYSCONF2DIR="%{_sysconfdir}/my.cnf.d" -DINSTALL_INFODIR=share/info \
-DINSTALL_DOCDIR="share/doc/mysql" -DINSTALL_DOCREADMEDIR="share/doc/mysql" \
-DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_LIBEXECDIR=libexec -DINSTALL_LIBDIR="%{_lib}/mysql" \
-DRPATH_LIBDIR="%{_libdir}" -DINSTALL_MANDIR=share/man -DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_MYSQLTESTDIR=share/mysql-test -DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" -DINSTALL_SBINDIR=bin \
-DINSTALL_SUPPORTFILESDIR=share/mysql -DMYSQL_DATADIR="%{_localstatedir}/lib/mysql" \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" -DENABLED_LOCAL_INFILE=ON -DWITH_SYSTEMD=1 \
-DSYSTEMD_SERVICE_NAME="mysqld" -DSYSTEMD_PID_DIR="%{_rundir}/mysqld" -DWITH_INNODB_MEMCACHED=ON \
-DWITH_ROUTER=OFF -DWITH_SYSTEM_LIBS=ON -DWITH_BOOST=../boost -DREPRODUCIBLE_BUILD=OFF \
-DCMAKE_C_FLAGS="%{optflags}" -DCMAKE_CXX_FLAGS="%{optflags}" -DCMAKE_EXE_LINKER_FLAGS="-pie %{build_ldflags}" \
-DTMPDIR=/var/tmp -DWITH_MYSQLD_LDFLAGS="%{build_ldflags}" -DCMAKE_C_LINK_FLAGS="%{build_ldflags}" \
%ifnarch aarch64
-DWITH_NUMA=ON \
%endif
-DCMAKE_CXX_LINK_FLAGS"%{build_ldflags}"
cmake .. -LAH
%make_build VERBOSE=1
cd -
%install %install
%make_install cd build
make DESTDIR=%{buildroot} install
if %multilib_capable; then
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits}
install -p -m 0755 scripts/mysql_config_multilib %{buildroot}%{_bindir}/mysql_config
fi
install -p -m 0644 Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/
install -p -m 0644 Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/
install -d %{buildroot}%{_localstatedir}/log/mysql
install -d %{buildroot}%{_rundir}/mysqld
install -p -m 0755 -d %{buildroot}%{_localstatedir}/lib/mysql
install -p -m 0750 -d %{buildroot}%{_localstatedir}/lib/mysql-files
install -p -m 0700 -d %{buildroot}%{_localstatedir}/lib/mysql-keyring
install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/mysqld.service
install -D -p -m 644 scripts/mysql@.service %{buildroot}%{_unitdir}/mysqld@.service
install -D -p -m 0644 scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/mysqld.conf
install -D -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
install -p -m 755 scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop
install -p -m 755 scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket
install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common
install -D -p -m 0644 scripts/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/mysql-server.cnf
install -d %{buildroot}%{_sysconfdir}/logrotate.d
mv %{buildroot}%{_datadir}/mysql/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysqld
chmod 644 %{buildroot}%{_sysconfdir}/logrotate.d/mysqld
install -d %{buildroot}%{_sysconfdir}/ld.so.conf.d
echo "%{_libdir}/mysql" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/mysql-%{_arch}.conf
mv %{buildroot}%{_bindir}/mysqld %{buildroot}%{_libexecdir}/mysqld
install -d %{buildroot}%{_sbindir}
ln -s %{_libexecdir}/mysqld %{buildroot}%{_sbindir}/mysqld
cd -
#rm -rf %{buildroot}/usr/lib/debug install -p -m 0644 %{SOURCE3} %{basename:%{SOURCE3}}
#rm -rf %{buildroot}/usr/src/debug install -p -m 0644 %{SOURCE4} %{basename:%{SOURCE4}}
install -p -m 0644 mysql-test/platform-specific-tests.list %{buildroot}%{_datadir}/mysql-test
%clean %check
rm -rf %{buildroot} %if %runselftest
pushd build
make test VERBOSE=1
cd mysql-test
cp ../../mysql-test/platform-specific-tests.list .
export MTR_BUILD_THREAD=%{__isa_bits}
./mtr --mem --parallel=auto --force --retry=2 \
--mysqld=--binlog-format=mixed \
--suite-timeout=720 --testcase-timeout=30 \
--report-unstable-tests --clean-vardir \
--skip-test-list=platform-specific-tests.list
rm -r var $(readlink var)
cd -
popd
%endif
%pre %pre server
if ! id %{name} > /dev/null 2>&1;then /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
useradd -M -s /sbin/nologin %{name} /usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /sbin/nologin \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%post server
%systemd_post mysqld.service
if [ ! -e "%{_localstatedir}/log/mysql/mysqld.log" -a ! -h "%{_localstatedir}/log/mysql/mysqld.log" ] ; then
install /dev/null -m0640 -omysql -gmysql "%{_localstatedir}/log/mysql/mysqld.log"
fi fi
%post %preun server
if [ -f %{_prefix}/local/%{name}/support-files/mysql.server > /dev/null 2>&1 ] && [ ! -f %{_initddir}/mysql > /dev/null 2>&1 ];then %systemd_preun mysqld.service
cp %{_prefix}/local/%{name}/support-files/mysql.server %{_initddir}/mysql
chmod +x %{_initddir}/mysql
chkconfig --level 2345 mysql on
fi
%preun %postun server
if [ -f %{_sysconfdir}/my.cnf ];then %systemd_postun_with_restart mysqld.service
mv %{_sysconfdir}/my.cnf %{_sysconfdir}/my.cnf.rpmold
fi
if [ -f %{_initddir}/mysql ];then
mv %{_initddir}/mysql %{_initddir}/mysql.rpmold
fi
%postun
if ["$1" = "0"]; then
rm -rf %{_prefix}/local/%{name}
userdel -r %{name} &>/dev/null
fi
%files %files
%attr(755, %{name}, %{name}) %{_prefix}/local/%{name}/* %doc README README.mysql-license README.mysql-docs
%exclude /usr/src/debug %{_bindir}/{mysql,mysql_config_editor,mysqladmin,mysqlcheck,mysqldump}
%exclude /usr/lib/debug %{_bindir}/{mysqlimport,mysqlpump,mysqlshow,mysqlslap,mysqlbinlog}
%exclude %{_tmpfilesdir}/mysql.conf
%files libs
%{_libdir}/mysql/libmysqlclient*.so.*
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/*
%files config
%dir %{_sysconfdir}/my.cnf.d
%config(noreplace) %{_sysconfdir}/my.cnf
%files common
%dir %{_libdir}/mysql
%dir %{_datadir}/mysql
%{_datadir}/mysql/charsets
%files errmsg
%{_datadir}/mysql/{errmsg-utf8.txt,english}
%lang(bg) %{_datadir}/mysql/bulgarian
%lang(cs) %{_datadir}/mysql/czech
%lang(da) %{_datadir}/mysql/danish
%lang(nl) %{_datadir}/mysql/dutch
%lang(et) %{_datadir}/mysql/estonian
%lang(fr) %{_datadir}/mysql/french
%lang(de) %{_datadir}/mysql/german
%lang(el) %{_datadir}/mysql/greek
%lang(hu) %{_datadir}/mysql/hungarian
%lang(it) %{_datadir}/mysql/italian
%lang(ja) %{_datadir}/mysql/japanese
%lang(ko) %{_datadir}/mysql/korean
%lang(no) %{_datadir}/mysql/norwegian
%lang(no) %{_datadir}/mysql/norwegian-ny
%lang(pl) %{_datadir}/mysql/polish
%lang(pt) %{_datadir}/mysql/portuguese
%lang(ro) %{_datadir}/mysql/romanian
%lang(ru) %{_datadir}/mysql/russian
%lang(sr) %{_datadir}/mysql/serbian
%lang(sk) %{_datadir}/mysql/slovak
%lang(es) %{_datadir}/mysql/spanish
%lang(sv) %{_datadir}/mysql/swedish
%lang(uk) %{_datadir}/mysql/ukrainian
%files server
%{_bindir}/{ibd2sdi,myisamchk,myisam_ftdump,myisamlog,myisampack,my_print_defaults}
%{_bindir}/{mysql_secure_installation,mysql_ssl_rsa_setup,mysql_tzinfo_to_sql,perror}
%{_bindir}/{mysql_upgrade,mysqld_pre_systemd,mysqldumpslow,innochecksum}
%config(noreplace) %{_sysconfdir}/my.cnf.d/mysql-server.cnf
%{_sbindir}/mysqld
%caps(cap_sys_nice=ep) %{_libexecdir}/mysqld
%{_libdir}/mysql/{INFO_SRC,INFO_BIN,plugin}
%dir %{_datadir}/mysql
%{_datadir}/mysql/dictionary.txt
%{_datadir}/mysql/*.sql
%{_unitdir}/mysqld*
%{_libexecdir}/{mysql-prepare-db-dir,mysql-wait-stop,mysql-check-socket,mysql-scripts-common}
%exclude %{_tmpfilesdir}/mysql.conf
%exclude %{_libdir}/mysql/*.a
%exclude %{_datadir}/mysql/{mysql.server,mysqld_multi.server}
%{_tmpfilesdir}/mysqld.conf
%attr(0755,mysql,mysql) %dir %{_localstatedir}/lib/mysql
%attr(0750,mysql,mysql) %dir %{_localstatedir}/lib/mysql-files
%attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring
%attr(0750,mysql,mysql) %dir %{_localstatedir}/log/mysql
%attr(0755,mysql,mysql) %dir %{_rundir}/mysqld
%attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{_localstatedir}/log/mysql/mysqld.log
%config(noreplace) %{_sysconfdir}/logrotate.d/mysqld
%files devel
%{_bindir}/mysql_config*
%{_includedir}/mysql
%{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql/libmysqlclient.so
%{_libdir}/pkgconfig/mysqlclient.pc
%exclude %{_bindir}/mysql_config_editor
%files test
%{_bindir}/{mysql_client_test,mysqltest,mysqltest_safe_process,mysqlxtest}
%attr(-,mysql,mysql) %{_datadir}/mysql-test
%files help
%doc README.mysql-license README.mysql-docs LICENSE
%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
%{_mandir}/man1/{mysql.1*,mysql_config_editor.1*,mysqladmin.1*,mysqlbinlog.1*,mysqldump.1*}
%{_mandir}/man1/{mysqlcheck.1*,mysqlimport.1*,mysqlpump.1*,mysqlshow.1*,mysqlslap.1*}
%{_mandir}/man1/{ibd2sdi.1*,myisamchk.1*,myisamlog.1*,myisampack.1*,myisam_ftdump.1*,mysqlman.1*}
%{_mandir}/man1/{my_print_defaults.1*,mysql_secure_installation.1*,mysql_ssl_rsa_setup.1*}
%{_mandir}/man1/{mysql_tzinfo_to_sql.1*,mysql_upgrade.1*,mysqldumpslow.1*,perror.1*}
%{_mandir}/man1/{lz4_decompress.1*,zlib_decompress.1*,innochecksum.1*,mysql.server.1*}
%{_mandir}/man8/mysqld.8*
%{_mandir}/man1/mysql_config.1*
%exclude %{_mandir}/man1/{mysqld_multi.1*,mysqld_safe.1*,comp_err.1*}
%changelog %changelog
* Tue Jun 16 2020 wutao <wutao61@huawei.com> - 8.0.17-4 * Mon Jun 1 2020 Jeffery.Gao <gaojianxing@huawei.com> - 8.0.18-2
- fix %postun problem - Package upgrade.
* Wed Mar 1 2020 zhangtao<zhangtao221@huawei.com> 8.0.17-3 * Wed Mar 1 2020 zhangtao<zhangtao221@huawei.com> 8.0.17-3
- add fstack-protector-strong - add fstack-protector-strong
* Fri Feb 28 2020 catastrowings <jianghuhao1994@163.com> 8.0.17-2 * Fri Feb 28 2020 catastrowings <jianghuhao1994@163.com> 8.0.17-2
- openEuler package init. - openEuler package init.

1
mysql.tmpfiles.d.in Normal file
View File

@ -0,0 +1 @@
d @PID_FILE_DIR@ 0755 mysql mysql -

62
mysql@.service.in Normal file
View File

@ -0,0 +1,62 @@
# 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 use systemctl edit:
#
# $ systemctl edit @DAEMON_NAME@.service
#
# this will create file
#
# /etc/systemd/system/@DAEMON_NAME@.service.d/override.conf
#
# which be parsed after the file @DAEMON_NAME@.service itself is parsed.
#
# For example, if you want to increase mysql's open-files-limit to 20000
# add following when editing with command above:
#
# [Service]
# LimitNOFILE=20000
#
# Or if you require to execute pre and post scripts in the unit file as root, set
# PermissionsStartOnly=true
#
# 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
#
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload
[Unit]
Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target
After=network.target
[Service]
Type=notify
User=mysql
Group=mysql
ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I
ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@
ExecStopPost=@libexecdir@/mysql-wait-stop --defaults-group-suffix=.%I
# 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
Restart=on-failure
RestartPreventExitStatus=1
# Sets open_files_limit
LimitNOFILE = 10000
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
Environment=MYSQLD_PARENT_PID=1
[Install]
WantedBy=multi-user.target

26
mysql_config_multilib.sh Normal file
View File

@ -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 @bindir@/mysql_config-$bits ] ; then
@bindir@/mysql_config-$bits "$@"
else
echo "$0: error: needed binary: @bindir@/mysql_config-$bits is missing"
exit 1
fi

18
server.cnf.in Normal file
View File

@ -0,0 +1,18 @@
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html
# 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 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