From 17025cc09b63fcdf881d427ab62292e07c10bff3 Mon Sep 17 00:00:00 2001 From: Rien Maertens Date: Fri, 17 Jul 2020 16:40:07 +0200 Subject: [PATCH] New package: mysql8-8.0.21 --- srcpkgs/libmysqlclient8 | 1 + srcpkgs/libmysqlclient8-devel | 1 + srcpkgs/mysql8-client | 1 + srcpkgs/mysql8/INSTALL | 9 ++ srcpkgs/mysql8/files/my.cnf | 145 ++++++++++++++++++ srcpkgs/mysql8/files/mysqld/log/run | 2 + srcpkgs/mysql8/files/mysqld/run | 4 + srcpkgs/mysql8/patches/00-no-fips-mode.patch | 109 +++++++++++++ .../patches/01-no_bio_set_callback_ex.patch | 11 ++ srcpkgs/mysql8/template | 132 ++++++++++++++++ srcpkgs/mysql8/update | 2 + 11 files changed, 417 insertions(+) create mode 120000 srcpkgs/libmysqlclient8 create mode 120000 srcpkgs/libmysqlclient8-devel create mode 120000 srcpkgs/mysql8-client create mode 100644 srcpkgs/mysql8/INSTALL create mode 100644 srcpkgs/mysql8/files/my.cnf create mode 100755 srcpkgs/mysql8/files/mysqld/log/run create mode 100755 srcpkgs/mysql8/files/mysqld/run create mode 100644 srcpkgs/mysql8/patches/00-no-fips-mode.patch create mode 100644 srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch create mode 100644 srcpkgs/mysql8/template create mode 100644 srcpkgs/mysql8/update diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8 new file mode 120000 index 00000000000..9a17e91b694 --- /dev/null +++ b/srcpkgs/libmysqlclient8 @@ -0,0 +1 @@ +mysql8 \ No newline at end of file diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel new file mode 120000 index 00000000000..9a17e91b694 --- /dev/null +++ b/srcpkgs/libmysqlclient8-devel @@ -0,0 +1 @@ +mysql8 \ No newline at end of file diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client new file mode 120000 index 00000000000..9a17e91b694 --- /dev/null +++ b/srcpkgs/mysql8-client @@ -0,0 +1 @@ +mysql8 \ No newline at end of file diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL new file mode 100644 index 00000000000..4ce513cca4a --- /dev/null +++ b/srcpkgs/mysql8/INSTALL @@ -0,0 +1,9 @@ +# *-*-shell-*-* +# +case ${ACTION} in +post) + install -dm0700 var/lib/mysql + usr/bin/mysql_install_db --user=mysql --keep-my-cnf --basedir=/usr --datadir=/var/lib/mysql + chown -R mysql:mysql var/lib/mysql + ;; +esac diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf new file mode 100644 index 00000000000..3870208583f --- /dev/null +++ b/srcpkgs/mysql8/files/my.cnf @@ -0,0 +1,145 @@ +# MySQL config file for medium systems. +# +# This is for a system with little memory (32M - 64M) where MySQL plays +# an important part, or systems up to 128M where MySQL is used together with +# other programs (such as a web server) +# +# MySQL programs look for option files in a set of +# locations which depend on the deployment platform. +# You can copy this option file to one of those +# locations. For information about these locations, see: +# http://dev.mysql.com/doc/mysql/en/option-files.html +# +# In this file, you can use all long options that a program supports. +# If you want to know which options a program supports, run the program +# with the "--help" option. + +# The following options will be passed to all MySQL clients +[client] +#password = your_password +port = 3306 +socket = /run/mysqld/mysqld.sock + +# Here follows entries for some specific programs + +# The MySQL server +[mysqld] +port = 3306 +socket = /run/mysqld/mysqld.sock +datadir = /var/lib/mysql +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 1M +table_open_cache = 64 +sort_buffer_size = 512K +net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M + +# Don't listen on a TCP/IP port at all. This can be a security enhancement, +# if all processes that need to connect to mysqld run on the same host. +# All interaction with mysqld must be made via Unix sockets or named pipes. +# Note that using this option without enabling named pipes on Windows +# (via the "enable-named-pipe" option) will render mysqld useless! +# +skip-networking + +# Replication Master Server (default) +# binary logging is required for replication +log-bin=mysql-bin + +# binary logging format - mixed recommended +binlog_format=mixed + +# required unique id between 1 and 2^32 - 1 +# defaults to 1 if master-host is not set +# but will not function as a master if omitted +server-id = 1 + +# Replication Slave (comment out master section to use this) +# +# To configure this host as a replication slave, you can choose between +# two methods : +# +# 1) Use the CHANGE MASTER TO command (fully described in our manual) - +# the syntax is: +# +# CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=, +# MASTER_USER=, MASTER_PASSWORD= ; +# +# where you replace , , by quoted strings and +# by the master's port number (3306 by default). +# +# Example: +# +# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, +# MASTER_USER='joe', MASTER_PASSWORD='secret'; +# +# OR +# +# 2) Set the variables below. However, in case you choose this method, then +# start replication for the first time (even unsuccessfully, for example +# if you mistyped the password in master-password and the slave fails to +# connect), the slave will create a master.info file, and any later +# change in this file to the variables' values below will be ignored and +# overridden by the content of the master.info file, unless you shutdown +# the slave server, delete master.info and restart the slaver server. +# For that reason, you may want to leave the lines below untouched +# (commented) and instead use CHANGE MASTER TO (see above) +# +# required unique id between 2 and 2^32 - 1 +# (and different from the master) +# defaults to 2 if master-host is set +# but will not function as a slave if omitted +#server-id = 2 +# +# The replication master for this slave - required +#master-host = +# +# The username the slave will use for authentication when connecting +# to the master - required +#master-user = +# +# The password the slave will authenticate with when connecting to +# the master - required +#master-password = +# +# The port the master is listening on. +# optional - defaults to 3306 +#master-port = +# +# binary logging - not required for slaves, but recommended +#log-bin=mysql-bin + +# Uncomment the following if you are using InnoDB tables +#innodb_data_home_dir = /var/lib/mysql +#innodb_data_file_path = ibdata1:10M:autoextend +#innodb_log_group_home_dir = /var/lib/mysql +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +#innodb_buffer_pool_size = 16M +#innodb_additional_mem_pool_size = 2M +# Set .._log_file_size to 25 % of buffer pool size +#innodb_log_file_size = 5M +#innodb_log_buffer_size = 8M +#innodb_flush_log_at_trx_commit = 1 +#innodb_lock_wait_timeout = 50 + +[mysqldump] +quick +max_allowed_packet = 16M + +[mysql] +no-auto-rehash +# Remove the next comment character if you are not familiar with SQL +#safe-updates + +[myisamchk] +key_buffer_size = 20M +sort_buffer_size = 20M +read_buffer = 2M +write_buffer = 2M + +[mysqlhotcopy] +interactive-timeout diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run new file mode 100755 index 00000000000..b36c4dafa40 --- /dev/null +++ b/srcpkgs/mysql8/files/mysqld/log/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec logger -p daemon.notice diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run new file mode 100755 index 00000000000..bc16a07883e --- /dev/null +++ b/srcpkgs/mysql8/files/mysqld/run @@ -0,0 +1,4 @@ +#!/bin/sh +[ ! -d /run/mysqld ] && mkdir -p /run/mysqld +chown mysql:mysql /run/mysqld +exec chpst -u mysql:mysql mysqld --user=mysql 2>&1 diff --git a/srcpkgs/mysql8/patches/00-no-fips-mode.patch b/srcpkgs/mysql8/patches/00-no-fips-mode.patch new file mode 100644 index 00000000000..e3328a505f0 --- /dev/null +++ b/srcpkgs/mysql8/patches/00-no-fips-mode.patch @@ -0,0 +1,109 @@ +diff --git a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc +index 8bf63ce1..7c1a0e36 100644 +--- a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc ++++ b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc +@@ -327,26 +327,7 @@ error: + + #define OPENSSL_ERROR_LENGTH 512 + static int configure_ssl_fips_mode(const uint fips_mode) { +- int rc = -1; +- unsigned int fips_mode_old = -1; +- char err_string[OPENSSL_ERROR_LENGTH] = {'\0'}; +- unsigned long err_library = 0; +- if (fips_mode > 2) { +- goto EXIT; +- } +- fips_mode_old = FIPS_mode(); +- if (fips_mode_old == fips_mode) { +- rc = 1; +- goto EXIT; +- } +- if (!(rc = FIPS_mode_set(fips_mode))) { +- err_library = ERR_get_error(); +- ERR_error_string_n(err_library, err_string, sizeof(err_string) - 1); +- err_string[sizeof(err_string) - 1] = '\0'; +- G_ERROR("openssl fips mode set failed: %s", err_string); +- } +-EXIT: +- return rc; ++ return 1; + } + + static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file, +diff --git a/plugin/x/client/xconnection_impl.cc b/plugin/x/client/xconnection_impl.cc +index 13bc6794..164f65e8 100644 +--- a/plugin/x/client/xconnection_impl.cc ++++ b/plugin/x/client/xconnection_impl.cc +@@ -518,24 +518,7 @@ XError Connection_impl::get_ssl_error(const int error_id) { + */ + int set_fips_mode(const uint32_t fips_mode, + char err_string[OPENSSL_ERROR_LENGTH]) { +- int rc = -1; +- unsigned int fips_mode_old = -1; +- unsigned long err_library = 0; +- if (fips_mode > 2) { +- goto EXIT; +- } +- fips_mode_old = FIPS_mode(); +- if (fips_mode_old == fips_mode) { +- rc = 1; +- goto EXIT; +- } +- if (!(rc = FIPS_mode_set(fips_mode))) { +- err_library = ERR_get_error(); +- ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1); +- err_string[OPENSSL_ERROR_LENGTH - 1] = '\0'; +- } +-EXIT: +- return rc; ++ return 1; + } + + XError Connection_impl::activate_tls() { +diff --git a/vio/viosslfactories.cc b/vio/viosslfactories.cc +index 6c04029c..9f777af5 100644 +--- a/vio/viosslfactories.cc ++++ b/vio/viosslfactories.cc +@@ -492,32 +492,7 @@ void ssl_start() { + @retval 1 Success + */ + int set_fips_mode(const uint fips_mode, char err_string[OPENSSL_ERROR_LENGTH]) { +- int rc = -1; +- unsigned int fips_mode_old = -1; +- unsigned long err_library = 0; +- if (fips_mode > 2) { +- goto EXIT; +- } +- fips_mode_old = FIPS_mode(); +- if (fips_mode_old == fips_mode) { +- rc = 1; +- goto EXIT; +- } +- if (!(rc = FIPS_mode_set(fips_mode))) { +- /* +- If OS doesn't have FIPS enabled openssl library and user sets FIPS mode +- ON, It fails with proper error. But in the same time it doesn't allow to +- perform any cryptographic operation. Now if FIPS mode set fails with +- error, setting old working FIPS mode value in the OpenSSL library. It will +- allow successful cryptographic operation and will not abort the server. +- */ +- FIPS_mode_set(fips_mode_old); +- err_library = ERR_get_error(); +- ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1); +- err_string[OPENSSL_ERROR_LENGTH - 1] = '\0'; +- } +-EXIT: +- return rc; ++ return 1; + } + + /** +@@ -525,7 +500,7 @@ EXIT: + + @returns openssl current fips mode + */ +-uint get_fips_mode() { return FIPS_mode(); } ++uint get_fips_mode() { return 0; } + + long process_tls_version(const char *tls_version) { + const char *separator = ","; diff --git a/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch new file mode 100644 index 00000000000..eb69db28907 --- /dev/null +++ b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch @@ -0,0 +1,11 @@ +--- vio/viossl.cc 2020-07-17 16:19:42.848476566 +0200 ++++ vio/viossl.cc 2020-07-17 16:19:21.385102033 +0200 +@@ -45,7 +45,7 @@ + BIO_set_callback_ex was added in openSSL 1.1.1 + For older openSSL, use the deprecated BIO_set_callback. + */ +-#if OPENSSL_VERSION_NUMBER >= 0x10101000L ++#if false // libressl doesn't have BIO_set_callback_ex + #define HAVE_BIO_SET_CALLBACK_EX + #endif + diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template new file mode 100644 index 00000000000..e33f9f44a35 --- /dev/null +++ b/srcpkgs/mysql8/template @@ -0,0 +1,132 @@ +# Template file for 'mysql8' +pkgname=mysql8 +version=8.0.21 +revision=1 +wrksrc="mysql-${version}" +build_style=cmake +configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql + -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON + -DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man + -DINSTALL_PLUGINDIR=lib/mysql/plugin -DINSTALL_SCRIPTDIR=bin + -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_DOCREADMEDIR=share/mysql + -DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql + -DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql + -DWITH_ZLIB=system -DWITH_SSL=system -DWITH_LIBWRAP=OFF + -DWITH_EXTRA_CHARSETS=complex -DWITH_EMBEDDED_SERVER=ON + -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 + -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 + -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 + -DSTACK_DIRECTION=1 -DHAVE_LLVM_LIBCPP_EXITCODE=0" +hostmakedepends="perl bison ncurses-devel" +makedepends="zlib-devel libressl-devel readline-devel boost-devel" +depends="mysql8-client" +conf_files="/etc/mysql/my.cnf" +short_desc="World's most popular open source database" +maintainer="Orphaned " +license="GPL-2.0-only" +homepage="https://www.mysql.com/products/community/" +distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz" +checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034 +system_accounts="mysql" +mysql_homedir="/var/lib/mysql" +lib32disabled=yes + +CFLAGS="-D__STDC_ISO_10646__" +if [ "$CROSS_BUILD" ]; then + configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1" + configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0" +fi + +pre_configure() { + # libressl major detection. + sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake + #sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h + + # We need some host binaries before starting cross compilation. + if [ "$CROSS_BUILD" ]; then + CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake . + make comp_err comp_sql gen_lex_hash gen_lex_token + mkdir -p bin.host/{extra,scripts,sql} + cp extra/comp_err bin.host/extra + cp scripts/comp_sql bin.host/scripts + cp sql/gen_lex_hash bin.host/sql + cp sql/gen_lex_token bin.host/sql + make clean + # Remove the rules for the host binaries to not + # have them overwritten with target binaries + rm CMakeCache.txt + vsed -i ${wrksrc}/scripts/CMakeLists.txt \ + -e "/ADD_EXECUTABLE(comp_sql/d" + vsed -i ${wrksrc}/sql/CMakeLists.txt \ + -e "/ADD_EXECUTABLE(gen_lex_hash/d" \ + -e "/ADD_EXECUTABLE(gen_lex_token/d" \ + -e "/ADD_DEPENDENCIES(gen_lex_token/d" + fi +} + +pre_build() { + if [ "$CROSS_BUILD" ]; then + mkdir -p ${wrksrc}/build + cp -a ${wrksrc}/bin.host/* ${wrksrc}/build + mkdir -p ${wrksrc}/build/libmysqld + cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld + export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql + fi +} + +post_install() { + # Remove unneeded stuff. + rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data} + rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1 + + # Configuration file. + vinstall ${FILESDIR}/my.cnf 640 etc/mysql + + # runit service + vsv mysqld +} + +libmysqlclient8_package() { + short_desc+=" - client library" + pkg_install() { + vmove "usr/lib/libmysqlclient*.so.*" + } +} + +libmysqlclient8-devel_package() { + depends="libmysqlclient8>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/bin/mysql_config + vmove usr/share/man/man1/mysql_config.1 + vmove usr/include + vmove "usr/lib/*.a" + vmove "usr/lib/*.so" + } +} + +mysql8-client_package() { + depends="perl" + short_desc+=" - database client binaries" + pkg_install() { + for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \ + mysql_client_test_embedded mysqldumpslow mysqlbinlog \ + mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \ + mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \ + mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \ + mysqlslap mysqltest_embedded mysqlmanager mysqltest \ + mysqlhotcopy mysql_upgrade mysql_zap; do + if [ -f ${DESTDIR}/usr/bin/${f} ]; then + vmove usr/bin/${f} + elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then + vmove usr/sbin/${f} + fi + if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then + vmove usr/share/man/man1/${f}.1 + elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then + vmove usr/share/man/man8/${f}.8 + fi + done + } +} diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update new file mode 100644 index 00000000000..da80797cf4a --- /dev/null +++ b/srcpkgs/mysql8/update @@ -0,0 +1,2 @@ +site='http://dev.mysql.com/downloads/mysql/' +pattern='MySQL Community Server \K[\d.]+'