diff options
author | 2017-07-18 16:22:18 -0400 | |
---|---|---|
committer | 2017-07-18 16:22:18 -0400 | |
commit | 731537b966b6677ed4a86b9202b98358c024b4aa (patch) | |
tree | d4447bb47a7fcf8ab04577de7614f10522ca47f1 | |
parent | Drop deprecated mariadb-galera from overlay (diff) | |
download | mysql-731537b966b6677ed4a86b9202b98358c024b4aa.tar.gz mysql-731537b966b6677ed4a86b9202b98358c024b4aa.tar.bz2 mysql-731537b966b6677ed4a86b9202b98358c024b4aa.zip |
dev-db/mariadb: Override several pieces of the eclass
Simplify many checks and allow for a new config system to be used
This now has a single includedir in my.cnf and many files in /etc/mysql/mariadb.d
Package-Manager: Portage-2.3.6, Repoman-2.3.2
Manifest-Sign-Key: D1F781EFF9F4A3B6
-rw-r--r-- | dev-db/mariadb/files/my.cnf-10.2 | 3 | ||||
-rw-r--r-- | dev-db/mariadb/files/my.cnf.distro-client | 21 | ||||
-rw-r--r-- | dev-db/mariadb/files/my.cnf.distro-server | 28 | ||||
-rw-r--r-- | dev-db/mariadb/mariadb-10.2.6.ebuild | 158 | ||||
-rw-r--r-- | dev-db/mariadb/metadata.xml | 1 |
5 files changed, 197 insertions, 14 deletions
diff --git a/dev-db/mariadb/files/my.cnf-10.2 b/dev-db/mariadb/files/my.cnf-10.2 new file mode 100644 index 0000000..80b4771 --- /dev/null +++ b/dev-db/mariadb/files/my.cnf-10.2 @@ -0,0 +1,3 @@ +# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file. + +!includedir @GENTOO_PORTAGE_EPREFIX@/etc/mysql/mariadb.d diff --git a/dev-db/mariadb/files/my.cnf.distro-client b/dev-db/mariadb/files/my.cnf.distro-client new file mode 100644 index 0000000..4bbe0f9 --- /dev/null +++ b/dev-db/mariadb/files/my.cnf.distro-client @@ -0,0 +1,21 @@ +# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-client.cnf: The global mysql configuration file. + +# The following options will be passed to all MySQL clients +[client] +socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock +character-sets-dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mariadb/charsets +default-character-set=utf8 + +[mysql] +# uncomment the next directive if you are not familiar with SQL +#safe-updates + +[mysqldump] +quick +max_allowed_packet = 16M + +[myisamchk] +character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mariadb/charsets + +[myisampack] +character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mariadb/charsets diff --git a/dev-db/mariadb/files/my.cnf.distro-server b/dev-db/mariadb/files/my.cnf.distro-server new file mode 100644 index 0000000..eaf80be --- /dev/null +++ b/dev-db/mariadb/files/my.cnf.distro-server @@ -0,0 +1,28 @@ +# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-server.cnf: The global mysql configuration file. + +# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations +[mysqld] +character-set-server = utf8 +user = mysql +port = 3306 +socket = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock +pid-file = @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mariadb.pid +log-error = @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err +basedir = @GENTOO_PORTAGE_EPREFIX@/usr +datadir = @DATADIR@ +skip-external-locking +lc_messages_dir = @GENTOO_PORTAGE_EPREFIX@/usr/share/mariadb +#Set this to your desired error message language +lc_messages = en_US + +# security: +# using "localhost" in connects uses sockets by default +# skip-networking +bind-address = 127.0.0.1 + +log-bin +server-id = 1 + +# point the following paths to different dedicated disks +tmpdir = @GENTOO_PORTAGE_EPREFIX@/tmp/ +#log-update = @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname diff --git a/dev-db/mariadb/mariadb-10.2.6.ebuild b/dev-db/mariadb/mariadb-10.2.6.ebuild index 300717f..323622c 100644 --- a/dev-db/mariadb/mariadb-10.2.6.ebuild +++ b/dev-db/mariadb/mariadb-10.2.6.ebuild @@ -10,13 +10,14 @@ MYSQL_PV_MAJOR="5.6" JAVA_PKG_OPT_USE="jdbc" -inherit toolchain-funcs java-pkg-opt-2 mysql-multilib-r1 +inherit toolchain-funcs java-pkg-opt-2 prefix toolchain-funcs \ + multilib-minimal mysql-multilib-r1 HOMEPAGE="http://mariadb.org/" DESCRIPTION="An enhanced, drop-in replacement for MySQL" LICENSE="GPL-2 LGPL-2.1+" -IUSE="+backup bindist cracklib galera kerberos innodb-lz4 innodb-lzo innodb-snappy jdbc mroonga odbc oqgraph pam sphinx sst-rsync sst-xtrabackup tokudb systemd xml" +IUSE="+backup bindist cracklib galera kerberos innodb-lz4 innodb-lzo innodb-snappy jdbc mroonga odbc oqgraph pam rocksdb sphinx sst-rsync sst-xtrabackup tokudb systemd xml" RESTRICT="!bindist? ( bindist )" REQUIRED_USE="jdbc? ( extraengine server !static ) server? ( tokudb? ( jemalloc !tcmalloc ) ) static? ( !pam )" @@ -88,7 +89,6 @@ MULTILIB_WRAPPED_HEADERS+=( /usr/include/mysql/mysql_version.h /usr/include/mariadb/mariadb_version.h /usr/include/mysql/private/probes_mysql_nodtrace.h /usr/include/mysql/private/probes_mysql_dtrace.h ) -MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config ) pkg_setup() { java-pkg-opt-2_pkg_setup @@ -97,12 +97,36 @@ pkg_setup() { pkg_preinst() { java-pkg-opt-2_pkg_preinst - mysql-multilib-r1_pkg_preinst + + # Here we need to see if the implementation switched client libraries + # We check if this is a new instance of the package and a client library already exists + local SHOW_ABI_MESSAGE libpath + if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then + libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") + elog "Due to ABI changes when switching between different client libraries," + elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." + elog "Please run: revdep-rebuild --library ${libpath}" + ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" + fi } src_prepare() { java-pkg-opt-2_src_prepare - mysql-multilib-r1_src_prepare + if use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + # Remove the bundled groonga + # There is no CMake flag, it simply checks for existance + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" + + eapply "${PATCHES[@]}" + eapply_user } src_configure(){ @@ -144,7 +168,7 @@ src_configure(){ fi MYSQL_CMAKE_NATIVE_DEFINES+=( - -DPLUGIN_OQGRAPH=$(usex oqgraph YES NO) + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) -DPLUGIN_SPHINX=$(usex sphinx YES NO) -DPLUGIN_TOKUDB=$(usex tokudb YES NO) -DPLUGIN_AUTH_PAM=$(usex pam YES NO) @@ -161,11 +185,12 @@ src_configure(){ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga YES NO) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) -DWITH_MARIABACKUP=$(usex backup ON OFF) -DWITH_LIBARCHIVE=$(usex backup ON OFF) -DINSTALL_SQLBENCHDIR=share/mariadb + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) ) if use test ; then # This is needed for the new client lib which tests a real, open server @@ -176,13 +201,118 @@ src_configure(){ } src_install() { - mysql-multilib-r1_src_install - install_compat_symlink() { - use static-libs && dosym libmariadbclient.a "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.a" - dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so" - dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}" - } - multilib_foreach_abi install_compat_symlink + # wrap the config scripts + local MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config ) + multilib-minimal_src_install +} + +# Intentionally override eclass function +multilib_src_install() { + cmake-utils_src_install + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${D}${MY_INCLUDEDIR}/private/config.h" ]] ; then + rm "${D}${MY_INCLUDEDIR}/private/config.h" || die + fi + + if ! multilib_is_native_abi && use server ; then + insinto /usr/include/mysql/private + doins "${S}"/sql/*.h + fi +} + +multilib_src_install_all() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" + dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" + cp "${FILESDIR}/my.cnf-distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + newins "${TMPDIR}/50-distro-client.cnf" + + if use server ; then + mycnf_src="my.cnf.distro-server" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + if use prefix ; then + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ + "${TMPDIR}/my.cnf.ok" || die + fi + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + einfo "Creating initial directories" + # Empty directories ... + diropts "-m0750" + if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then + dodir "${MY_DATADIR#${EPREFIX}}" + keepdir "${MY_DATADIR#${EPREFIX}}" + chown -R mysql:mysql "${D}/${MY_DATADIR}" + fi + + diropts "-m0755" + local folder + for folder in "${MY_LOGDIR#${EPREFIX}}" ; do + dodir "${folder}" + keepdir "${folder}" + chown -R mysql:mysql "${ED}/${folder}" + done + + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + fi + + #Remove mytop if perl is not selected + [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" + + # Install compatible symlinks to libmysqlclient + use static-libs && dosym libmariadbclient.a "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.a" + dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so" + dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}" } # Official test instructions: diff --git a/dev-db/mariadb/metadata.xml b/dev-db/mariadb/metadata.xml index b4e973b..69cc5da 100644 --- a/dev-db/mariadb/metadata.xml +++ b/dev-db/mariadb/metadata.xml @@ -33,6 +33,7 @@ <flag name="pam">Enable the optional PAM authentication plugin for the server</flag> <flag name="pbxt">Add experimental support for PBXT storage engine</flag> <flag name="profiling">Add support for statement profiling (requires USE=community).</flag> + <flag name="rocksdb">Add support for RocksDB; a key/value, LSM database optimized for flash storage</flag> <flag name="server">Build the server program</flag> <flag name="sphinx">Add suport for the sphinx full-text search engine</flag> <flag name="sst-rsync">Add tools needed to support the rsync SST method</flag> |