diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b4c5788
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+SOURCES/mariadb-5.5.65.tar.gz
diff --git a/.mariadb.metadata b/.mariadb.metadata
new file mode 100644
index 0000000..5f80820
--- /dev/null
+++ b/.mariadb.metadata
@@ -0,0 +1 @@
+886f157260e696e793bf0b270ca1393aaa219617 SOURCES/mariadb-5.5.65.tar.gz
diff --git a/SOURCES/README.mysql-cnf b/SOURCES/README.mysql-cnf
new file mode 100644
index 0000000..65bebb9
--- /dev/null
+++ b/SOURCES/README.mysql-cnf
@@ -0,0 +1,13 @@
+This directory contains prepared configuration files with .cnf extension,
+which provide a configuration for some common MariaDB deployment scenarios.
+These configuration files do not include the default configuration of datadir,
+log-file and pid-file locations, as specified in the default my.cnf file,
+provided in this distribution.
+
+Thus, it is recommended to use these configuration files as an addition to the
+default my.cnf configuration file.
+
+Since default my.cnf contains `!includedir /etc/my.cnf.d` directive, it is
+recommended to copy required configuration under /etc/my.cnf.d/ directory,
+so the default my.cnf specifications will be extended.
+
diff --git a/SOURCES/README.mysql-docs b/SOURCES/README.mysql-docs
new file mode 100644
index 0000000..dd894a7
--- /dev/null
+++ b/SOURCES/README.mysql-docs
@@ -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/
diff --git a/SOURCES/README.mysql-license b/SOURCES/README.mysql-license
new file mode 100644
index 0000000..1282653
--- /dev/null
+++ b/SOURCES/README.mysql-license
@@ -0,0 +1,6 @@
+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/
diff --git a/SOURCES/filter-requires-mysql.sh b/SOURCES/filter-requires-mysql.sh
new file mode 100755
index 0000000..bce04c6
--- /dev/null
+++ b/SOURCES/filter-requires-mysql.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+/usr/lib/rpm/perl.req $* | \
+    grep -v -e "perl(th" \
+    -e "perl(lib::mtr" -e "perl(lib::v1/mtr" -e "perl(mtr"
diff --git a/SOURCES/libmysql.version b/SOURCES/libmysql.version
new file mode 100644
index 0000000..d0e329c
--- /dev/null
+++ b/SOURCES/libmysql.version
@@ -0,0 +1,243 @@
+# symbols exported from mysql 5.1
+libmysqlclient_16 {
+  global:
+	_fini;
+	_init;
+	my_init;
+	myodbc_remove_escape;
+	mysql_affected_rows;
+	mysql_autocommit;
+	mysql_change_user;
+	mysql_character_set_name;
+	mysql_close;
+	mysql_commit;
+	mysql_data_seek;
+	mysql_debug;
+	mysql_dump_debug_info;
+	mysql_embedded;
+	mysql_eof;
+	mysql_errno;
+	mysql_error;
+	mysql_escape_string;
+	mysql_fetch_field;
+	mysql_fetch_field_direct;
+	mysql_fetch_fields;
+	mysql_fetch_lengths;
+	mysql_fetch_row;
+	mysql_field_count;
+	mysql_field_seek;
+	mysql_field_tell;
+	mysql_free_result;
+	mysql_get_character_set_info;
+	mysql_get_client_info;
+	mysql_get_client_version;
+	mysql_get_host_info;
+	mysql_get_parameters;
+	mysql_get_proto_info;
+	mysql_get_server_info;
+	mysql_get_server_version;
+	mysql_get_ssl_cipher;
+	mysql_hex_string;
+	mysql_info;
+	mysql_init;
+	mysql_insert_id;
+	mysql_kill;
+	mysql_list_dbs;
+	mysql_list_fields;
+	mysql_list_processes;
+	mysql_list_tables;
+	mysql_more_results;
+	mysql_next_result;
+	mysql_num_fields;
+	mysql_num_rows;
+	mysql_options;
+	mysql_ping;
+	mysql_query;
+	mysql_read_query_result;
+	mysql_real_connect;
+	mysql_real_escape_string;
+	mysql_real_query;
+	mysql_refresh;
+	mysql_rollback;
+	mysql_row_seek;
+	mysql_row_tell;
+	mysql_select_db;
+	mysql_send_query;
+	mysql_server_end;
+	mysql_server_init;
+	mysql_set_character_set;
+	mysql_set_local_infile_default;
+	mysql_set_local_infile_handler;
+	mysql_set_server_option;
+	mysql_shutdown;
+	mysql_sqlstate;
+	mysql_ssl_set;
+	mysql_stat;
+	mysql_stmt_affected_rows;
+	mysql_stmt_attr_get;
+	mysql_stmt_attr_set;
+	mysql_stmt_bind_param;
+	mysql_stmt_bind_result;
+	mysql_stmt_close;
+	mysql_stmt_data_seek;
+	mysql_stmt_errno;
+	mysql_stmt_error;
+	mysql_stmt_execute;
+	mysql_stmt_fetch;
+	mysql_stmt_fetch_column;
+	mysql_stmt_field_count;
+	mysql_stmt_free_result;
+	mysql_stmt_init;
+	mysql_stmt_insert_id;
+	mysql_stmt_num_rows;
+	mysql_stmt_param_count;
+	mysql_stmt_param_metadata;
+	mysql_stmt_prepare;
+	mysql_stmt_reset;
+	mysql_stmt_result_metadata;
+	mysql_stmt_row_seek;
+	mysql_stmt_row_tell;
+	mysql_stmt_send_long_data;
+	mysql_stmt_sqlstate;
+	mysql_stmt_store_result;
+	mysql_store_result;
+	mysql_thread_end;
+	mysql_thread_id;
+	mysql_thread_init;
+	mysql_thread_safe;
+	mysql_use_result;
+	mysql_warning_count;
+# These are documented in Paul DuBois' MySQL book, so we treat them as part
+# of the de-facto API.
+	free_defaults;
+	handle_options;
+	load_defaults;
+	my_print_help;
+# This isn't really documented anywhere, but it seems to be part of the
+# de-facto API as well.  We're not going to export the deprecated version
+# make_scrambled_password, however.
+	my_make_scrambled_password;
+# This really shouldn't be exported, but some applications use it as a
+# workaround for inadequate threading support; see bug #846602
+	THR_KEY_mysys;
+  local:
+	*;
+};
+# symbols added in mysql 5.5
+libmysqlclient_18 {
+  global:
+	mysql_client_find_plugin;
+	mysql_client_register_plugin;
+	mysql_load_plugin;
+	mysql_load_plugin_v;
+	mysql_plugin_options;
+	mysql_stmt_next_result;
+#
+# Ideally the following symbols wouldn't be exported, but various applications
+# require them.  We limit the namespace damage by prefixing mysql_
+# (see mysql-dubious-exports.patch), which means the symbols are not present
+# in libmysqlclient_16.
+#
+# mysql-connector-odbc requires these
+	mysql_default_charset_info;
+	mysql_get_charset;
+	mysql_get_charset_by_csname;
+	mysql_net_realloc;
+# PHP's mysqli.so requires this (via the ER() macro)
+	mysql_client_errors;
+};
+
+# symbols specific for mariadb
+libmysqlclient_18_mariadb {
+  global:
+    # symbols related to non-blocking operations
+    # documented here: https://kb.askmonty.org/en/non-blocking-api-reference/
+	mysql_get_socket;
+	mysql_get_timeout_value;
+	mysql_get_timeout_value_ms;
+	mysql_real_connect_start;
+	mysql_real_connect_cont;
+	mysql_real_query_start;
+	mysql_real_query_cont;
+	mysql_fetch_row_start;
+	mysql_fetch_row_cont;
+	mysql_set_character_set_start;
+	mysql_set_character_set_cont;
+	mysql_select_db_start;
+	mysql_select_db_cont;
+	mysql_send_query_start;
+	mysql_send_query_cont;
+	mysql_store_result_start;
+	mysql_store_result_cont;
+	mysql_free_result_start;
+	mysql_free_result_cont;
+	mysql_close_start;
+	mysql_close_cont;
+	mysql_change_user_start;
+	mysql_change_user_cont;
+	mysql_query_start;
+	mysql_query_cont;
+	mysql_shutdown_start;
+	mysql_shutdown_cont;
+	mysql_dump_debug_info_start;
+	mysql_dump_debug_info_cont;
+	mysql_refresh_start;
+	mysql_refresh_cont;
+	mysql_kill_start;
+	mysql_kill_cont;
+	mysql_set_server_option_start;
+	mysql_set_server_option_cont;
+	mysql_ping_start;
+	mysql_ping_cont;
+	mysql_stat_start;
+	mysql_stat_cont;
+	mysql_list_dbs_start;
+	mysql_list_dbs_cont;
+	mysql_list_tables_start;
+	mysql_list_tables_cont;
+	mysql_list_processes_start;
+	mysql_list_processes_cont;
+	mysql_list_fields_start;
+	mysql_list_fields_cont;
+	mysql_read_query_result_start;
+	mysql_read_query_result_cont;
+	mysql_stmt_prepare_start;
+	mysql_stmt_prepare_cont;
+	mysql_stmt_execute_start;
+	mysql_stmt_execute_cont;
+	mysql_stmt_fetch_start;
+	mysql_stmt_fetch_cont;
+	mysql_stmt_store_result_start;
+	mysql_stmt_store_result_cont;
+	mysql_stmt_close_start;
+	mysql_stmt_close_cont;
+	mysql_stmt_reset_start;
+	mysql_stmt_reset_cont;
+	mysql_stmt_free_result_start;
+	mysql_stmt_free_result_cont;
+	mysql_stmt_send_long_data_start;
+	mysql_stmt_send_long_data_cont;
+	mysql_commit_start;
+	mysql_commit_cont;
+	mysql_rollback_start;
+	mysql_rollback_cont;
+	mysql_autocommit_start;
+	mysql_autocommit_cont;
+	mysql_next_result_start;
+	mysql_next_result_cont;
+	mysql_stmt_next_result_start;
+	mysql_stmt_next_result_cont;
+    # dynamic columns API
+    # documented here: https://kb.askmonty.org/en/dynamic-columns-api/
+    # currently only documentation for mariadb-10.0.x available, but
+    # upstream promissed adding 5.5.x version as well
+	dynamic_column_create;
+	dynamic_column_create_many;
+	dynamic_column_update;
+	dynamic_column_update_many;
+	dynamic_column_delete;
+	dynamic_column_exists;
+	dynamic_column_list;
+	dynamic_column_get;
+	dynamic_column_prepare_decimal;
+};
diff --git a/SOURCES/mariadb-basedir.patch b/SOURCES/mariadb-basedir.patch
new file mode 100644
index 0000000..691fd7b
--- /dev/null
+++ b/SOURCES/mariadb-basedir.patch
@@ -0,0 +1,11 @@
+--- mariadb-5.5.40/scripts/mysql_config.sh.basedir	2014-10-08 15:19:53.000000000 +0200
++++ mariadb-5.5.40/scripts/mysql_config.sh	2014-11-06 13:36:54.025734370 +0100
+@@ -77,7 +77,7 @@
+ me=`get_full_path $0`
+ 
+ # Script might have been renamed but assume mysql_<something>config<something>
+-basedir=`echo $me | sed -e 's;/bin/mysql_.*config.*;;'`
++basedir='@prefix@'
+ 
+ ldata='@localstatedir@'
+ execdir='@libexecdir@'
diff --git a/SOURCES/mariadb-cipherreplace.patch b/SOURCES/mariadb-cipherreplace.patch
new file mode 100644
index 0000000..b2b37c6
--- /dev/null
+++ b/SOURCES/mariadb-cipherreplace.patch
@@ -0,0 +1,11 @@
+diff -up mariadb-5.5.41/mysql-test/t/ssl_8k_key.test.cipherreplace mariadb-5.5.41/mysql-test/t/ssl_8k_key.test
+--- mariadb-5.5.41/mysql-test/t/ssl_8k_key.test.cipherreplace	2015-01-09 17:06:09.904431758 +0100
++++ mariadb-5.5.41/mysql-test/t/ssl_8k_key.test	2015-01-09 17:04:42.560377123 +0100
+@@ -2,6 +2,7 @@
+ #
+ # Bug#29784 YaSSL assertion failure when reading 8k key.
+ #
++--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+ --exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
+ 
+ ##  This test file is for testing encrypted communication only, not other
diff --git a/SOURCES/mariadb-covscan-signexpr.patch b/SOURCES/mariadb-covscan-signexpr.patch
new file mode 100644
index 0000000..1bbb3db
--- /dev/null
+++ b/SOURCES/mariadb-covscan-signexpr.patch
@@ -0,0 +1,16 @@
+This issue has been found by Coverity - static analysis tool.
+
+mysql-5.5.31/strings/ctype-ucs2.c:1707:sign_extension – Suspicious implicit sign extension: "s[0]" with type "unsigned char" (8 bits, unsigned) is promoted in "(s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "(s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
+
+diff -up mysql-5.5.31/strings/ctype-ucs2.c.covscan1 mysql-5.5.31/strings/ctype-ucs2.c
+--- mysql-5.5.31/strings/ctype-ucs2.c.covscan1	2013-06-14 12:12:29.663300314 +0200
++++ mysql-5.5.31/strings/ctype-ucs2.c	2013-06-14 12:13:07.809299646 +0200
+@@ -1704,7 +1704,7 @@ my_utf32_uni(CHARSET_INFO *cs __attribut
+ {
+   if (s + 4 > e)
+     return MY_CS_TOOSMALL4;
+-  *pwc= (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]);
++  *pwc= (((my_wc_t)s[0]) << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]);
+   return 4;
+ }
+ 
diff --git a/SOURCES/mariadb-covscan-stroverflow.patch b/SOURCES/mariadb-covscan-stroverflow.patch
new file mode 100644
index 0000000..a994ff2
--- /dev/null
+++ b/SOURCES/mariadb-covscan-stroverflow.patch
@@ -0,0 +1,17 @@
+The following problems have been found by Coverity - static analysis tool.
+
+mysql-5.5.31/sql/sp_rcontext.h:87:buffer_size_warning – Calling strncpy with a maximum size argument of 512 bytes on destination array "this->m_message" of size 512 bytes might leave the destination string unterminated. 
+
+diff -rup mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h mariadb-5.5.47/sql/sp_rcontext.h
+--- mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h	2015-12-09 18:22:47.000000000 +0100
++++ mariadb-5.5.47/sql/sp_rcontext.h	2016-02-04 07:55:50.073558349 +0100
+@@ -84,7 +84,8 @@ public:
+     memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH);
+     m_sql_state[SQLSTATE_LENGTH]= '\0';
+ 
+-    strncpy(m_message, msg, MYSQL_ERRMSG_SIZE);
++    strncpy(m_message, msg, sizeof(m_message)-1);
++    m_message[sizeof(m_message)-1] = '\0';
+   }
+ 
+   void clear()
diff --git a/SOURCES/mariadb-errno.patch b/SOURCES/mariadb-errno.patch
new file mode 100644
index 0000000..66ad3df
--- /dev/null
+++ b/SOURCES/mariadb-errno.patch
@@ -0,0 +1,20 @@
+"extern int errno" is just a really bad idea.
+
+diff -up mariadb-5.5.33a/include/my_sys.h.p1 mariadb-5.5.33a/include/my_sys.h
+--- mariadb-5.5.33a/include/my_sys.h.p1	2013-09-20 00:34:26.000000000 +0200
++++ mariadb-5.5.33a/include/my_sys.h	2013-10-21 14:46:46.866624871 +0200
+@@ -190,13 +190,8 @@ extern void my_large_free(uchar *ptr);
+ #define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : my_malloc(size,MYF(MY_FAE)))
+ #define my_safe_afree(ptr, size, min_length) ((size <= min_length) ? my_afree(ptr) : my_free(ptr))
+ 
+-#ifndef errno				/* did we already get it? */
+-#ifdef HAVE_ERRNO_AS_DEFINE
+ #include <errno.h>			/* errno is a define */
+-#else
+-extern int errno;			/* declare errno */
+-#endif
+-#endif					/* #ifndef errno */
++
+ extern char *home_dir;			/* Home directory for user */
+ extern MYSQL_PLUGIN_IMPORT char  *mysql_data_home;
+ extern const char *my_progname;		/* program-name (printed in errors) */
diff --git a/SOURCES/mariadb-file-contents.patch b/SOURCES/mariadb-file-contents.patch
new file mode 100644
index 0000000..8ad8c73
--- /dev/null
+++ b/SOURCES/mariadb-file-contents.patch
@@ -0,0 +1,27 @@
+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 -up mariadb-5.5.34/mysql-test/t/file_contents.test.p10 mariadb-5.5.34/mysql-test/t/file_contents.test
+--- mariadb-5.5.34/mysql-test/t/file_contents.test.p10	2013-11-20 13:28:56.000000000 +0100
++++ mariadb-5.5.34/mysql-test/t/file_contents.test	2013-11-22 08:50:30.244702013 +0100
+@@ -32,6 +32,15 @@ if ($dir_bin eq '/usr/') {
+     # RedHat/Debian: version number in directory name
+     $dir_docs = glob "$dir_docs/mariadb-server-*";
+     $dir_docs = glob "$dir_docs/MySQL-server*" unless -d $dir_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 "/usr/lib64/mysql") {
++       $dir_docs = "/usr/lib64/mysql";
++    } else {
++       $dir_docs = "/usr/lib/mysql";
++    }
+   }
+   # Slackware
+   $dir_docs = glob "$dir_bin/doc/mariadb-[0-9]*" unless -d $dir_docs;
diff --git a/SOURCES/mariadb-install-test.patch b/SOURCES/mariadb-install-test.patch
new file mode 100644
index 0000000..5657b73
--- /dev/null
+++ b/SOURCES/mariadb-install-test.patch
@@ -0,0 +1,56 @@
+Improve the documentation that will be installed in the mysql-test RPM.
+
+diff -up mariadb-5.5.32/mysql-test/README.p3 mariadb-5.5.32/mysql-test/README
+--- mariadb-5.5.32/mysql-test/README.p3	2013-07-17 16:51:29.000000000 +0200
++++ mariadb-5.5.32/mysql-test/README	2013-07-30 23:22:54.959494478 +0200
+@@ -1,15 +1,28 @@
+-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.
+-
+-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. To run the test suite in a source directory, you
+-must do make first.
+-
+-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:
++This directory contains a test suite for the MariaDB daemon. To run
++the currently existing test cases, execute ./mysql-test-run in
++this directory.
++
++For use in Red Hat distributions, you should run the script as user mysql,
++who is created with nologin shell however, so the best bet is something like
++       $ su -
++       # cd /usr/share/mysql-test
++       # su -s /bin/bash mysql -c "./mysql-test-run --skip-test-list=rh-skipped-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=rh-skipped-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
++rh-skipped-tests.list.
++
++To clean up afterwards, remove the created "var" subdirectory, eg
++       # su -s /bin/bash - mysql -c "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://kb.askmonty.org/v/reporting-bugs
+ 
+@@ -26,7 +39,8 @@ other relevant options.
+ 
+ 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
+ file in the t subdirectory using a text editor. The file should have a .test
diff --git a/SOURCES/mariadb-logrotate.patch b/SOURCES/mariadb-logrotate.patch
new file mode 100644
index 0000000..c9f8b50
--- /dev/null
+++ b/SOURCES/mariadb-logrotate.patch
@@ -0,0 +1,71 @@
+Adjust the mysql-log-rotate script in several ways:
+
+* Use the correct log file pathname for Red Hat installations.
+* Enable creation of the log file by logrotate (needed since
+  /var/log/ isn't writable by mysql user); and set the same 640
+  permissions we normally use.
+* Comment out the actual rotation commands, so that user must edit
+  the file to enable rotation.  This is unfortunate, but the fact
+  that the script will probably fail without manual configuration
+  (to set a root password) means that we can't really have it turned
+  on by default.  Fortunately, in most configurations the log file
+  is low-volume and so rotation is not critical functionality.
+
+See discussions at RH bugs 799735, 547007
+
+
+diff -up mariadb-5.5.32/support-files/mysql-log-rotate.sh.errlog mariadb-5.5.32/support-files/mysql-log-rotate.sh
+--- mariadb-5.5.32/support-files/mysql-log-rotate.sh.errlog	2013-08-29 14:35:34.839119044 +0200
++++ mariadb-5.5.32/support-files/mysql-log-rotate.sh	2013-08-29 14:38:54.203996083 +0200
+@@ -1,9 +1,9 @@
+ # This logname can be set in /etc/my.cnf
+-# by setting the variable "err-log"
+-# in the [safe_mysqld] section as follows:
++# by setting the variable "log-error"
++# in the [mysqld_safe] section as follows:
+ #
+-# [safe_mysqld]
+-# err-log=@localstatedir@/mysqld.log
++# [mysqld_safe]
++# log-error=/var/log/mariadb/mariadb.log
+ #
+ # If the root user has a password you have to create a
+ # /root/.my.cnf configuration file with the following
+@@ -18,19 +18,21 @@
+ # ATTENTION: This /root/.my.cnf should be readable ONLY
+ # for root !
+ 
+-@localstatedir@/mysqld.log {
+-        # create 600 mysql mysql
+-        notifempty
+-	daily
+-        rotate 3
+-        missingok
+-        compress
+-    postrotate
+-	# just if mysqld is really running
+-	if test -x @bindir@/mysqladmin && \
+-	   @bindir@/mysqladmin ping &>/dev/null
+-	then
+-	   @bindir@/mysqladmin flush-logs
+-	fi
+-    endscript
+-}
++# Then, un-comment the following lines to enable rotation of mysql's log file:
++
++#/var/log/mariadb/mariadb.log {
++#        create 640 mysql mysql
++#        notifempty
++#	daily
++#        rotate 3
++#        missingok
++#        compress
++#    postrotate
++#	# just if mysqld is really running
++#	if test -x @bindir@/mysqladmin && \
++#	   @bindir@/mysqladmin ping &>/dev/null
++#	then
++#	   @bindir@/mysqladmin flush-logs
++#	fi
++#    endscript
++#}
diff --git a/SOURCES/mariadb-mysql_secure_installation.patch b/SOURCES/mariadb-mysql_secure_installation.patch
new file mode 100644
index 0000000..2ad644e
--- /dev/null
+++ b/SOURCES/mariadb-mysql_secure_installation.patch
@@ -0,0 +1,45 @@
+From a0a93d99939de297863f7060e78e6a0ce7a271a7 Mon Sep 17 00:00:00 2001
+From: Sergei Golubchik <sergii@pisem.net>
+Date: Tue, 18 Nov 2014 22:26:04 +0100
+Subject: [PATCH] MDEV-4399 mysql_secure_installation reports error in
+ find_mysql_client
+
+1. remove find_mysql_client (from a bad merge)
+2. use $mysql_command
+---
+ scripts/mysql_secure_installation.sh | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
+index 9e9bce9..8eca327 100644
+--- a/scripts/mysql_secure_installation.sh
++++ b/scripts/mysql_secure_installation.sh
+@@ -182,7 +182,7 @@ else
+ fi
+ 
+ mysql_command=`find_in_basedir mysql $bindir`
+-if test -z "$print_defaults"
++if test -z "$mysql_command"
+ then
+   cannot_find_file mysql $bindir
+   exit 1
+@@ -204,7 +204,7 @@ prepare() {
+ do_query() {
+     echo "$1" >$command
+     #sed 's,^,> ,' < $command  # Debugging
+-    $bindir/mysql --defaults-file=$config <$command
++    $mysql_command --defaults-file=$config <$command
+     return $?
+ }
+ 
+@@ -376,7 +376,6 @@ clean_and_exit() {
+ # The actual script starts here
+ 
+ prepare
+-find_mysql_client
+ set_echo_compat
+ 
+ echo
+-- 
+2.5.5
+
diff --git a/SOURCES/mariadb-norelocatable.patch b/SOURCES/mariadb-norelocatable.patch
new file mode 100644
index 0000000..399cca9
--- /dev/null
+++ b/SOURCES/mariadb-norelocatable.patch
@@ -0,0 +1,78 @@
+Revert upstream changes to make the mysql_install_dbrelocatable
+
+Resolves: #1731062
+
+Upstream intended to make the mysql_install_db script to be relocatable, which
+is not a supported use case in RHEL. Because of different layout (mysqld in
+/usr/libexec while all other binaries in /usr/bin) these changes broke
+mysql_install_db if run without arguments (we use --rpm in the systemd so we
+didn't meet this issue there). Reverting changes upstream did fixes the
+standalone run of mysql_install_db again.
+
+Original upstream issue: https://jira.mariadb.org/browse/MDEV-14580
+Related fixes that broke the RHEL build:
+https://github.com/MariaDB/server/commit/9c5be7d131f7eb7f27df722463faa2cd8135fd1b
+https://github.com/MariaDB/server/commit/50e593386fcbaa1ca7bd2ed9fdfc51fd5102cdab
+
+diff -up mariadb-5.5.65/scripts/mysql_install_db.sh.norellocatable mariadb-5.5.65/scripts/mysql_install_db.sh
+--- mariadb-5.5.65/scripts/mysql_install_db.sh.norellocatable	2019-08-17 07:06:14.135318451 +0200
++++ mariadb-5.5.65/scripts/mysql_install_db.sh	2019-08-17 07:10:58.702473136 +0200
+@@ -36,9 +36,6 @@ in_rpm=0
+ ip_only=0
+ cross_bootstrap=0
+ 
+-dirname0=`dirname $0 2>/dev/null`
+-dirname0=`dirname $dirname0 2>/dev/null`
+-
+ usage()
+ {
+   cat <<EOF
+@@ -243,16 +238,9 @@ then
+ fi
+ if test -n "$srcdir"
+ then
+-  # In an out-of-source build, builddir is not srcdir. Try to guess where
+-  # builddir is by looking for my_print_defaults.
+   if test -z "$builddir"
+   then
+-    if test -x "$dirname0/extra/my_print_defaults"
+-    then
+-      builddir="$dirname0"
+-    else
+-      builddir="$srcdir"
+-    fi
++    builddir="$srcdir"
+   fi
+   print_defaults="$builddir/extra/my_print_defaults"
+ elif test -n "$basedir"
+@@ -263,9 +251,6 @@ then
+     cannot_find_file my_print_defaults $basedir/bin $basedir/extra
+     exit 1
+   fi
+-elif test -n "$dirname0" -a -x "$dirname0/@bindir@/my_print_defaults"
+-then
+-  print_defaults="$dirname0/@bindir@/my_print_defaults"
+ else
+   print_defaults="@bindir@/my_print_defaults"
+ fi
+@@ -317,19 +302,11 @@ then
+     cannot_find_file fill_help_tables.sql @pkgdata_locations@
+     exit 1
+   fi
+-# relative from where the script was run for a relocatable install
+-elif test -n "$dirname0" -a -x "$dirname0/@INSTALL_SBINDIR@/mysqld"
+-then
+-  basedir="$dirname0"
+-  bindir="$basedir/@INSTALL_SBINDIR@"
+-  resolveip="$bindir/resolveip"
+-  mysqld="$basedir/@INSTALL_SBINDIR@/mysqld"
+-  pkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ else
+   basedir="@prefix@"
+   bindir="@bindir@"
+   resolveip="$bindir/resolveip"
+-  mysqld="@sbindir@/mysqld"
++  mysqld="@libexecdir@/mysqld"
+   pkgdatadir="@pkgdatadir@"
+ fi
+ 
diff --git a/SOURCES/mariadb-prepare-db-dir b/SOURCES/mariadb-prepare-db-dir
new file mode 100644
index 0000000..f5ef9f8
--- /dev/null
+++ b/SOURCES/mariadb-prepare-db-dir
@@ -0,0 +1,171 @@
+#!/bin/sh
+
+# This script creates the mysql data directory during first service start.
+# In subsequent starts, it does nothing much.
+
+# extract value of a MySQL option from config files
+# Usage: get_mysql_option SECTION VARNAME DEFAULT
+# 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
+        result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
+        if [ -z "$result" ]; then
+            # if not found, use the default value
+            result="$3"
+        fi
+}
+
+# Defaults here had better match what mysqld_safe will default to
+get_mysql_option mysqld datadir "/var/lib/mysql"
+datadir="$result"
+get_mysql_option mysqld_safe log-error "/var/log/mariadb/mariadb.log"
+errlogfile="$result"
+get_mysql_option mysqld socket "$datadir/mysql.sock"
+socketfile="$result"
+
+
+
+# Absorb configuration settings from the specified systemd service file,
+# or the default "mysqld" service if not specified
+SERVICE_NAME="$1"
+if [ x"$SERVICE_NAME" = x ]
+then
+    SERVICE_NAME=mysqld.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
+
+
+
+# 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
+
+
+
+# We check if there is already a process using the socket file,
+# since otherwise this systemd service file could report false
+# positive result when starting and mysqld_safe could remove
+# a socket file, which actually uses a different daemon.
+response=`/usr/bin/mysqladmin --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 "Socket file $socketfile exists." >&2
+  echo "Is another MySQL daemon already running with the same unix socket?" >&2
+  exit 1
+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
+    # 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"
+    # 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/mysql_install_db --rpm --datadir="$datadir" --user="$myuser"
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+        echo "Initialization of MariaDB database failed." >&2
+        echo "Perhaps @sysconfdir@/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
+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."
+        echo "Make sure the $datadir is empty before running `basename $0`."
+        exit 1
+    fi
+fi
+
+exit 0
diff --git a/SOURCES/mariadb-s390-tsc.patch b/SOURCES/mariadb-s390-tsc.patch
new file mode 100644
index 0000000..f995266
--- /dev/null
+++ b/SOURCES/mariadb-s390-tsc.patch
@@ -0,0 +1,41 @@
+Support s390/s390x in performance schema's cycle-counting functions.
+Filed upstream at http://bugs.mysql.com/bug.php?id=59953
+
+
+diff -up mysql-5.5.28/include/my_rdtsc.h.p11 mysql-5.5.28/include/my_rdtsc.h
+--- mysql-5.5.28/include/my_rdtsc.h.p11	2012-08-29 10:50:46.000000000 +0200
++++ mysql-5.5.28/include/my_rdtsc.h	2012-12-06 14:22:13.651823354 +0100
+@@ -125,6 +125,7 @@ C_MODE_END
+ #define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME      25
+ #define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
+ #define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64       27
++#define MY_TIMER_ROUTINE_ASM_S390                28
+ 
+ #endif
+ 
+diff -up mysql-5.5.28/mysys/my_rdtsc.c.p11 mysql-5.5.28/mysys/my_rdtsc.c
+--- mysql-5.5.28/mysys/my_rdtsc.c.p11	2012-08-29 10:50:46.000000000 +0200
++++ mysql-5.5.28/mysys/my_rdtsc.c	2012-12-06 14:22:13.672823375 +0100
+@@ -224,6 +224,13 @@ ulonglong my_timer_cycles(void)
+     clock_gettime(CLOCK_SGI_CYCLE, &tp);
+     return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec;
+   }
++#elif defined(__GNUC__) && defined(__s390__)
++  /* covers both s390 and s390x */
++  {
++    ulonglong result;
++    __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
++    return result;
++  }
+ #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
+   /* gethrtime may appear as either cycle or nanosecond counter */
+   return (ulonglong) gethrtime();
+@@ -533,6 +540,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
+   mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
+ #elif defined(__sgi) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE)
+   mti->cycles.routine= MY_TIMER_ROUTINE_SGI_CYCLE;
++#elif defined(__GNUC__) && defined(__s390__)
++  mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390;
+ #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
+   mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME;
+ #else
diff --git a/SOURCES/mariadb-string-overflow.patch b/SOURCES/mariadb-string-overflow.patch
new file mode 100644
index 0000000..5bb46da
--- /dev/null
+++ b/SOURCES/mariadb-string-overflow.patch
@@ -0,0 +1,43 @@
+These issues were found by Coverity static analysis tool, for more info
+see messages by particular fixes (messages belong to 5.1.61).
+
+Filed upstream at http://bugs.mysql.com/bug.php?id=64631
+
+
+Error: BUFFER_SIZE_WARNING:
+/builddir/build/BUILD/mysql-5.1.61/sql/sql_prepare.cc:2749: buffer_size_warning: Calling strncpy with a maximum size argument of 512 bytes on destination array "this->stmt->last_error" of size 512 bytes might leave the destination string unterminated.
+
+
+diff -up mariadb-5.5.28a/sql/sql_prepare.cc.p20 mariadb-5.5.28a/sql/sql_prepare.cc
+--- mariadb-5.5.28a/sql/sql_prepare.cc.p20	2012-11-28 16:49:36.000000000 +0100
++++ mariadb-5.5.28a/sql/sql_prepare.cc	2012-12-17 17:45:24.232151645 +0100
+@@ -2975,7 +2975,7 @@ void mysql_stmt_get_longdata(THD *thd, c
+   {
+     stmt->state= Query_arena::STMT_ERROR;
+     stmt->last_errno= thd->stmt_da->sql_errno();
+-    strncpy(stmt->last_error, thd->stmt_da->message(), MYSQL_ERRMSG_SIZE);
++    strncpy(stmt->last_error, thd->stmt_da->message(), sizeof(stmt->last_error)-1);
+   }
+   thd->stmt_da= save_stmt_da;
+   thd->warning_info= save_warinig_info;
+
+
+
+
+Error: STRING_OVERFLOW:
+/builddir/build/BUILD/mysql-5.1.61/storage/innodb_plugin/handler/ha_innodb.cc:6544: fixed_size_dest: You might overrun the 512 byte fixed-size string "name2" by copying "name" without checking the length.
+/builddir/build/BUILD/mysql-5.1.61/storage/innodb_plugin/handler/ha_innodb.cc:6544: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
+
+diff -up mariadb-5.5.28a/sql/sql_trigger.cc.p20 mariadb-5.5.28a/sql/sql_trigger.cc
+diff -up mariadb-5.5.28a/storage/innobase/handler/ha_innodb.cc.p20 mariadb-5.5.28a/storage/innobase/handler/ha_innodb.cc
+--- mariadb-5.5.28a/storage/innobase/handler/ha_innodb.cc.p20	2012-11-28 16:49:36.000000000 +0100
++++ mariadb-5.5.28a/storage/innobase/handler/ha_innodb.cc	2012-12-17 17:45:24.239151651 +0100
+@@ -7094,7 +7094,7 @@ ha_innobase::create(
+ 
+ 	ut_a(strlen(name) < sizeof(name2));
+ 
+-	strcpy(name2, name);
++	strncpy(name2, name, sizeof(name2)-1);
+ 
+ 	normalize_table_name(norm_name, name2);
+ 
diff --git a/SOURCES/mariadb-strmov.patch b/SOURCES/mariadb-strmov.patch
new file mode 100644
index 0000000..03322ff
--- /dev/null
+++ b/SOURCES/mariadb-strmov.patch
@@ -0,0 +1,30 @@
+Remove overly optimistic definition of strmov() as stpcpy().
+
+mysql uses this macro with overlapping source and destination strings,
+which is verboten per spec, and fails on some Red Hat platforms.
+Deleting the definition is sufficient to make it fall back to a
+byte-at-a-time copy loop, which should consistently give the
+expected behavior.
+
+Note: the particular case that prompted this patch is reported and fixed
+at http://bugs.mysql.com/bug.php?id=48864.  However, my faith in upstream's
+ability to detect this type of error is low, and I also see little evidence
+of any real performance gain from optimizing these calls.  So I'm keeping
+this patch.
+
+diff -up mariadb-5.5.28a/include/m_string.h.p2 mariadb-5.5.28a/include/m_string.h
+--- mariadb-5.5.28a/include/m_string.h.p2	2012-12-17 16:14:19.140536799 +0100
++++ mariadb-5.5.28a/include/m_string.h	2012-12-17 16:15:40.036567242 +0100
+@@ -79,12 +79,6 @@ extern "C" {
+ extern void *(*my_str_malloc)(size_t);
+ extern void (*my_str_free)(void *);
+ 
+-#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
+-#define strmov(A,B) __builtin_stpcpy((A),(B))
+-#elif defined(HAVE_STPCPY)
+-#define strmov(A,B) stpcpy((A),(B))
+-#endif
+-
+ /* Declared in int2str() */
+ extern const char _dig_vec_upper[];
+ extern const char _dig_vec_lower[];
diff --git a/SOURCES/mariadb-wait-ready b/SOURCES/mariadb-wait-ready
new file mode 100644
index 0000000..2d0da07
--- /dev/null
+++ b/SOURCES/mariadb-wait-ready
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# This script waits for mysqld to be ready to accept connections
+# (which can be many seconds or even minutes after launch, if there's
+# a lot of crash-recovery work to do).
+# Running this as ExecStartPost is useful so that services declared as
+# "After mysqld" won't be started until the database is really ready.
+
+# Service file passes us the daemon's PID (actually, mysqld_safe's PID)
+daemon_pid="$1"
+
+# extract value of a MySQL option from config files
+# Usage: get_mysql_option SECTION VARNAME DEFAULT
+# 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(){
+	result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
+	if [ -z "$result" ]; then
+	    # not found, use default
+	    result="$3"
+	fi
+}
+
+# Defaults here had better match what mysqld_safe will default to
+get_mysql_option mysqld datadir "/var/lib/mysql"
+datadir="$result"
+get_mysql_option mysqld socket "/var/lib/mysql/mysql.sock"
+socketfile="$result"
+
+# Wait for the server to come up or for the mysqld process to disappear
+ret=0
+while /bin/true; do
+	if ! [ -d "/proc/$daemon_pid" ] ; then
+            ret=1
+            break
+	fi
+	RESPONSE=`/usr/bin/mysqladmin --no-defaults --connect-timeout=2 --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
+	mret=$?
+	if [ $mret -eq 0 ]; then
+	    break
+	fi
+	# exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
+	# anything else suggests a configuration error
+	if [ $mret -ne 1 -a $mret -ne 11 ]; then
+	    ret=1
+	    break
+	fi
+	# "Access denied" also means the server is alive
+	echo "$RESPONSE" | grep -q "Access denied for user" && break
+
+	sleep 1
+done
+
+exit $ret
diff --git a/SOURCES/mariadb.service b/SOURCES/mariadb.service
new file mode 100644
index 0000000..7f3db6d
--- /dev/null
+++ b/SOURCES/mariadb.service
@@ -0,0 +1,48 @@
+# 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 create a file "/etc/systemd/system/mariadb.service",
+# containing
+#	.include /lib/systemd/system/mariadb.service
+#	...make your changes here...
+# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
+# which doesn't need to include ".include" call and which will be parsed
+# after the file mariadb.service itself is parsed.
+#
+# 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, so create a file named
+# "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
+#	[Service]
+#	LimitNOFILE=10000
+
+# Note: /usr/lib/... is recommended in the .include line though /lib/... 
+# still works.
+# Don't forget to reload systemd daemon after you change unit configuration:
+# root> systemctl --system daemon-reload
+
+[Unit]
+Description=MariaDB database server
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User=mysql
+Group=mysql
+
+ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n
+# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
+# per bug #547485
+ExecStart=/usr/bin/mysqld_safe --basedir=/usr
+ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID
+
+# 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
+
+[Install]
+WantedBy=multi-user.target
diff --git a/SOURCES/mariadb.tmpfiles.d b/SOURCES/mariadb.tmpfiles.d
new file mode 100644
index 0000000..6b64dd7
--- /dev/null
+++ b/SOURCES/mariadb.tmpfiles.d
@@ -0,0 +1,5 @@
+# Do not edit this file; it will be overwritten on upgrades.
+# If you want to override the settings here, you can copy this file
+# to /etc/tmpfiles.d/mariadb.conf and make your changes there.
+
+d /var/run/mariadb 0755 mysql mysql -
diff --git a/SOURCES/my.cnf b/SOURCES/my.cnf
new file mode 100644
index 0000000..bf7d644
--- /dev/null
+++ b/SOURCES/my.cnf
@@ -0,0 +1,19 @@
+[mysqld]
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
+# 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 mariadb according to the
+# instructions in http://fedoraproject.org/wiki/Systemd
+
+[mysqld_safe]
+log-error=/var/log/mariadb/mariadb.log
+pid-file=/var/run/mariadb/mariadb.pid
+
+#
+# include all files from the config directory
+#
+!includedir /etc/my.cnf.d
+
diff --git a/SOURCES/my_config.h b/SOURCES/my_config.h
new file mode 100644
index 0000000..02baa3d
--- /dev/null
+++ b/SOURCES/my_config.h
@@ -0,0 +1,33 @@
+/*
+ * Kluge to support multilib installation of both 32- and 64-bit RPMS:
+ * we need to arrange that header files that appear in both RPMs are
+ * identical.  Hence, this file is architecture-independent and calls
+ * in an arch-dependent file that will appear in just one RPM.
+ *
+ * To avoid breaking arches not explicitly supported by Red Hat, we
+ * use this indirection file *only* on known multilib arches.
+ *
+ * Note: this may well fail if user tries to use gcc's -I- option.
+ * But that option is deprecated anyway.
+ */
+#if defined(__x86_64__)
+#include "my_config_x86_64.h"
+#elif defined(__i386__)
+#include "my_config_i386.h"
+#elif defined(__ppc64__) || defined(__powerpc64__)
+#include "my_config_ppc64.h"
+#elif defined(__ppc__) || defined(__powerpc__)
+#include "my_config_ppc.h"
+#elif defined(__s390x__)
+#include "my_config_s390x.h"
+#elif defined(__s390__)
+#include "my_config_s390.h"
+#elif defined(__sparc__) && defined(__arch64__)
+#include "my_config_sparc64.h"
+#elif defined(__sparc__)
+#include "my_config_sparc.h"
+#elif defined(__arm__)
+#include "my_config_arm.h"
+#elif defined(__aarch64__)
+#include "my_config_aarch64.h"
+#endif
diff --git a/SOURCES/mysql-embedded-check.c b/SOURCES/mysql-embedded-check.c
new file mode 100644
index 0000000..8bf8ca5
--- /dev/null
+++ b/SOURCES/mysql-embedded-check.c
@@ -0,0 +1,26 @@
+/* simple test program to see if we can link the embedded server library */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "mysql.h"
+
+MYSQL *mysql;
+
+static char *server_options[] = \
+       { "mysql_test", "--defaults-file=my.cnf", NULL };
+int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
+
+static char *server_groups[] = { "libmysqld_server", 
+                                 "libmysqld_client", NULL };
+
+int main(int argc, char **argv)
+{
+   mysql_library_init(num_elements, server_options, server_groups);
+   mysql = mysql_init(NULL);
+   mysql_close(mysql);
+   mysql_library_end();
+
+   return 0;
+}
diff --git a/SOURCES/rh-skipped-tests-base.list b/SOURCES/rh-skipped-tests-base.list
new file mode 100644
index 0000000..68a6cdf
--- /dev/null
+++ b/SOURCES/rh-skipped-tests-base.list
@@ -0,0 +1,11 @@
+# Tests and a bug where we track the failure in the following format:
+# suite.test : rhbz#1234567
+
+# Failing from 5.5.63 on all arches
+main.mysql                             :
+
+# i686, ppc64le
+main.mysql_client_test_nonblock        : rhbz#1544452 rhbz#1021450
+
+# ppc, ppc64le, aarch64
+innodb.innodb_simulate_comp_failures   :
diff --git a/SPECS/mariadb.spec b/SPECS/mariadb.spec
new file mode 100644
index 0000000..5984a64
--- /dev/null
+++ b/SPECS/mariadb.spec
@@ -0,0 +1,1111 @@
+# TokuDB engine is now part of MariaDB, but it is available only for x86_64;
+# variable tokudb allows to build with TokuDB storage engine
+%bcond_with tokudb
+
+Name: mariadb
+Version: 5.5.65
+Release: 1%{?dist}
+Epoch: 1
+
+Summary: A community developed branch of MySQL
+Group: Applications/Databases
+URL: http://mariadb.org
+# Exceptions allow client libraries to be linked with most open source SW,
+# not only GPL code.  See README.mysql-license
+# Some innobase code from Percona and Google is under BSD license
+# Some code related to test-suite is under LGPLv2
+License: GPLv2 with exceptions and LGPLv2 and BSD
+
+# The evr of mysql we want to obsolete
+%global obsoleted_mysql_evr 5.5-0
+
+# Regression tests take a long time, you can skip 'em with this
+%{!?runselftest:%global runselftest 1}
+
+Source0: http://mirror.hosting90.cz/%{name}/%{name}-%{version}/source/%{name}-%{version}.tar.gz
+Source3: my.cnf
+Source5: my_config.h
+Source6: README.mysql-docs
+Source7: README.mysql-license
+Source8: libmysql.version
+Source9: mysql-embedded-check.c
+Source10: mariadb.tmpfiles.d
+Source11: mariadb.service
+Source12: mariadb-prepare-db-dir
+Source13: mariadb-wait-ready
+Source14: rh-skipped-tests-base.list
+Source16: README.mysql-cnf
+# Working around perl dependency checking bug in rpm FTTB. Remove later.
+Source999: filter-requires-mysql.sh
+
+# Comments for these patches are in the patch files.
+Patch1: mariadb-errno.patch
+Patch2: mariadb-strmov.patch
+Patch3: mariadb-install-test.patch
+Patch7: mariadb-s390-tsc.patch
+Patch8: mariadb-logrotate.patch
+Patch9: mariadb-cipherreplace.patch
+Patch10: mariadb-file-contents.patch
+Patch11: mariadb-string-overflow.patch
+Patch14: mariadb-basedir.patch
+Patch17: mariadb-covscan-signexpr.patch
+Patch18: mariadb-covscan-stroverflow.patch
+Patch20: mariadb-mysql_secure_installation.patch
+Patch21: mariadb-norelocatable.patch
+
+BuildRequires: perl, readline-devel, openssl-devel
+BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel
+BuildRequires: systemd, systemtap-sdt-devel
+BuildRequires: pam-devel
+# make test requires time and ps
+BuildRequires: time procps
+# perl modules needed to run regression tests
+BuildRequires: perl(Socket), perl(Time::HiRes)
+BuildRequires: perl(Data::Dumper), perl(Test::More), perl(Env)
+# version 5.5.56+ requires checkpolicy and policycoreutils-python
+BuildRequires: checkpolicy policycoreutils-python
+
+Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: grep, fileutils, bash
+Requires(post): %{_sbindir}/update-alternatives
+Requires(postun): %{_sbindir}/update-alternatives
+
+%{?systemd_requires: %systemd_requires}
+
+# MariaDB replaces mysql packages
+Provides: mysql = %{epoch}:%{version}-%{release}
+Provides: mysql%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql < %{obsoleted_mysql_evr}
+
+# When rpm 4.9 is universal, this could be cleaned up:
+%global __perl_requires %{SOURCE999}
+%global __perllib_requires %{SOURCE999}
+
+# By default, patch(1) creates backup files when chunks apply with offsets.
+# Turn that off to ensure such files don't get included in RPMs (cf bz#884755).
+%global _default_patch_flags --no-backup-if-mismatch
+
+%description
+MariaDB is a community developed branch of MySQL.
+MariaDB is a multi-user, multi-threaded SQL database server.
+It is a client/server implementation consisting of a server daemon (mysqld)
+and many different client programs and libraries. The base package
+contains the standard MariaDB/MySQL client programs and generic MySQL files.
+
+%package libs
+
+Summary: The shared libraries required for MariaDB/MySQL clients
+Group: Applications/Databases
+Requires: /sbin/ldconfig
+Provides: mysql-libs = %{epoch}:%{version}-%{release}
+Provides: mysql-libs%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql-libs < %{obsoleted_mysql_evr}
+
+%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. MariaDB is a community developed branch of MySQL.
+
+%package server
+
+Summary: The MariaDB server and related files
+Group: Applications/Databases
+Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: sh-utils
+Requires(pre): /usr/sbin/useradd
+# We require this to be present for %%{_tmpfilesdir}
+Requires: systemd
+# Make sure it's there when scriptlets run, too
+Requires(post): systemd %{_sbindir}/update-alternatives
+Requires(preun): systemd
+Requires(postun): systemd %{_sbindir}/update-alternatives
+# mysqlhotcopy needs DBI/DBD support
+Requires: perl-DBI, perl-DBD-MySQL
+Provides: mysql-compat-server = %{epoch}:%{version}-%{release}
+Provides: mysql-compat-server%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql-server < %{obsoleted_mysql_evr}
+
+%description server
+MariaDB is a multi-user, multi-threaded SQL database server. It is a
+client/server implementation consisting of a server daemon (mysqld)
+and many different client programs and libraries. This package contains
+the MariaDB server and some accompanying files and directories.
+MariaDB is a community developed branch of MySQL.
+
+%package devel
+
+Summary: Files for development of MariaDB/MySQL applications
+Group: Applications/Databases
+Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: openssl-devel%{?_isa}
+Provides: mysql-devel = %{epoch}:%{version}-%{release}
+Provides: mysql-devel%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql-devel < %{obsoleted_mysql_evr}
+
+%description devel
+MariaDB is a multi-user, multi-threaded SQL database server. This
+package contains the libraries and header files that are needed for
+developing MariaDB/MySQL client applications.
+MariaDB is a community developed branch of MySQL.
+
+%package embedded
+
+Summary: MariaDB as an embeddable library
+Group: Applications/Databases
+Requires: /sbin/ldconfig
+Obsoletes: mysql-embedded < %{obsoleted_mysql_evr}
+
+%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 branch of MySQL.
+
+%package embedded-devel
+
+Summary: Development files for MariaDB as an embeddable library
+Group: Applications/Databases
+Requires: %{name}-embedded%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql-embedded-devel < %{obsoleted_mysql_evr}
+
+%description embedded-devel
+MariaDB is a multi-user, multi-threaded SQL database server. This
+package contains files needed for developing and testing with
+the embedded version of the MariaDB server.
+MariaDB is a community developed branch of MySQL.
+
+%package bench
+
+Summary: MariaDB benchmark scripts and data
+Group: Applications/Databases
+Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
+Obsoletes: mysql-bench < %{obsoleted_mysql_evr}
+
+%description bench
+MariaDB is a multi-user, multi-threaded SQL database server. This
+package contains benchmark scripts and data for use when benchmarking
+MariaDB.
+MariaDB is a community developed branch of MySQL.
+
+%package test
+
+Summary: The test suite distributed with MariaD
+Group: Applications/Databases
+BuildRequires: openssl
+Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release}
+Requires: perl(Socket), perl(Time::HiRes)
+Requires: perl(Data::Dumper), perl(Test::More), perl(Env)
+Requires: openssl
+Obsoletes: mysql-test < %{obsoleted_mysql_evr}
+
+%description test
+MariaDB is a multi-user, multi-threaded SQL database server. This
+package contains the regression test suite distributed with
+the MariaDB sources.
+MariaDB is a community developed branch of MySQL.
+
+
+
+%prep
+%setup -q -n mariadb-%{version}
+
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch14 -p1
+%patch17 -p1
+%patch18 -p1
+%patch20 -p1
+%patch21 -p1
+
+# workaround for upstream bug #56342
+rm -f mysql-test/t/ssl_8k_key-master.opt
+
+# generate a list of tests that fail, but are not disabled by upstream
+cat %{SOURCE14} > mysql-test/rh-skipped-tests.list
+
+
+
+%build
+
+# fail quickly and obviously if user tries to build as root
+%if %runselftest
+	if [ x"`id -u`" = x0 ]; then
+		echo "The mariadb's regression tests may fail if run as root."
+		echo "If you really need to build the RPM as root, use"
+		echo "--define='runselftest 0' to skip the regression tests."
+		exit 1
+	fi
+%endif
+
+CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
+# force PIC mode so that we can build libmysqld.so
+CFLAGS="$CFLAGS -fPIC"
+# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization
+# submitted as bz #529298
+%ifarch sparc sparcv9 sparc64
+CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" `
+%endif
+# significant performance gains can be achieved by compiling with -O3 optimization
+# rhbz#1051069
+%ifarch %{power64}
+CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O3|g" `
+%endif
+CXXFLAGS="$CFLAGS"
+export CFLAGS CXXFLAGS
+# building with PIE
+LDFLAGS="$LDFLAGS -fPIE -pie -Wl,-z,relro,-z,now"
+export LDFLAGS
+
+# 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 \
+	-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora}" \
+	-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
+	-DINSTALL_DOCDIR=share/doc/%{name}-%{version} \
+	-DINSTALL_DOCREADMEDIR=share/doc/%{name}-%{version} \
+	-DINSTALL_INCLUDEDIR=include/mysql \
+	-DINSTALL_INFODIR=share/info \
+	-DINSTALL_LIBDIR="%{_lib}/mysql" \
+	-DINSTALL_MANDIR=share/man \
+	-DINSTALL_MYSQLSHAREDIR=share/mysql \
+	-DINSTALL_MYSQLTESTDIR=share/mysql-test \
+	-DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \
+	-DINSTALL_SBINDIR=libexec \
+	-DINSTALL_SCRIPTDIR=bin \
+	-DINSTALL_SQLBENCHDIR=share \
+	-DINSTALL_SUPPORTFILESDIR=share/mysql \
+	-DMYSQL_DATADIR="%{_localstatedir}/lib/mysql" \
+	-DMYSQL_UNIX_ADDR="%{_localstatedir}/lib/mysql/mysql.sock" \
+	-DENABLED_LOCAL_INFILE=ON \
+	-DENABLE_DTRACE=ON \
+	-DWITH_EMBEDDED_SERVER=ON \
+	-DWITH_READLINE=ON \
+	-DWITH_SSL=system \
+	-DWITH_ZLIB=system \
+	-DWITH_JEMALLOC=no \
+%{!?with_tokudb:	-DWITHOUT_TOKUDB=ON}\
+	-DTMPDIR=%{_localstatedir}/tmp \
+	-DWITH_MYSQLD_LDFLAGS="-Wl,-z,relro,-z,now"
+
+#For CMake "List Advanced Help" about possible arguments and their values
+#cmake -LAH
+
+make %{?_smp_mflags} VERBOSE=1
+
+# debuginfo extraction scripts fail to find source files in their real
+# location -- satisfy them by copying these files into location, which
+# is expected by scripts
+for e in innobase xtradb ; do
+  for f in pars0grm.c pars0grm.y pars0lex.l lexyy.c ; do
+    cp -p "storage/$e/pars/$f" "storage/$e/$f"
+  done
+done
+
+
+
+%check
+%if %runselftest
+  # hack to let 32- and 64-bit tests run concurrently on same build machine
+  case `uname -m` in
+    ppc64 | ppc64p7 | ppc64le | s390x | x86_64 | sparc64 )
+      MTR_BUILD_THREAD=7
+      ;;
+    *)
+      MTR_BUILD_THREAD=11
+      ;;
+  esac
+  export MTR_BUILD_THREAD
+  export MTR_PARALLEL=1
+
+  make test VERBOSE=1
+
+  # The cmake build scripts don't provide any simple way to control the
+  # options for mysql-test-run, so ignore the make target and just call it
+  # manually.  Nonstandard options chosen are:
+  # --force to continue tests after a failure
+  # no retries please
+  # skip tests that are listed in rh-skipped-tests.list
+  # avoid redundant test runs with --binlog-format=mixed
+  # increase timeouts to prevent unwanted failures during mass rebuilds
+  (
+    cd mysql-test
+    perl ./mysql-test-run.pl --force --retry=2 \
+	--skip-test-list=rh-skipped-tests.list \
+	--suite-timeout=720 --testcase-timeout=30 \
+	--mysqld=--binlog-format=mixed --force-restart \
+	--shutdown-timeout=60 --big-test --max-test-fail=100
+    # cmake build scripts will install the var cruft if left alone :-(
+    rm -rf var
+  )
+%endif
+
+
+
+%install
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# List the installed tree for RPM package maintenance purposes.
+find $RPM_BUILD_ROOT -print | sed "s|^$RPM_BUILD_ROOT||" | sort > ROOTFILES
+
+# multilib header hacks
+# we only apply this to known Red Hat multilib arches, per bug #181335
+unamei=$(uname -i)
+%ifarch %{arm}
+unamei=arm
+%endif
+%ifarch %{power64}
+unamei=ppc64
+%endif
+%ifarch %{arm} aarch64 %{ix86} x86_64 ppc %{power64} %{sparc} s390 s390x
+mv $RPM_BUILD_ROOT%{_includedir}/mysql/my_config.h $RPM_BUILD_ROOT%{_includedir}/mysql/my_config_${unamei}.h
+mv $RPM_BUILD_ROOT%{_includedir}/mysql/private/config.h $RPM_BUILD_ROOT%{_includedir}/mysql/private/my_config_${unamei}.h
+install -p -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_includedir}/mysql/
+install -p -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_includedir}/mysql/private/config.h
+%endif
+
+# cmake generates some completely wacko references to -lprobes_mysql when
+# building with dtrace support.  Haven't found where to shut that off,
+# so resort to this blunt instrument.  While at it, let's not reference
+# libmysqlclient_r anymore either.
+sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \
+	${RPM_BUILD_ROOT}%{_bindir}/mysql_config >mysql_config.tmp
+cp -p -f mysql_config.tmp ${RPM_BUILD_ROOT}%{_bindir}/mysql_config
+chmod 755 ${RPM_BUILD_ROOT}%{_bindir}/mysql_config
+
+# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files,
+# but that's pretty wacko --- see also mariadb-file-contents.patch)
+install -p -m 644 Docs/INFO_SRC ${RPM_BUILD_ROOT}%{_libdir}/mysql/
+install -p -m 644 Docs/INFO_BIN ${RPM_BUILD_ROOT}%{_libdir}/mysql/
+rm -rf ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/MariaDB-server-%{version}/
+
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/mariadb
+chmod 0750 $RPM_BUILD_ROOT%{_localstatedir}/log/mariadb
+touch $RPM_BUILD_ROOT%{_localstatedir}/log/mariadb/mariadb.log
+
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/mariadb
+install -m 0755 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/mysql
+
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
+install -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/my.cnf
+
+# install systemd unit files and scripts for handling server startup
+mkdir -p ${RPM_BUILD_ROOT}%{_unitdir}
+install -p -m 644 %{SOURCE11} ${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
+install -p -m 755 %{SOURCE12} ${RPM_BUILD_ROOT}%{_libexecdir}/
+install -p -m 755 %{SOURCE13} ${RPM_BUILD_ROOT}%{_libexecdir}/
+
+mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
+install -p -m 0644 %{SOURCE10} $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}.conf
+
+# Fix funny permissions that cmake build scripts apply to config files
+#chmod 644 ${RPM_BUILD_ROOT}%{_datadir}/mysql/config.*.ini
+
+# Fix scripts for multilib safety
+mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysql_config
+touch ${RPM_BUILD_ROOT}%{_bindir}/mysql_config
+
+mv ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysqlbug
+touch ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug
+
+# Remove libmysqld.a
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a
+
+# libmysqlclient_r is no more.  Upstream tries to replace it with symlinks
+# but that really doesn't work (wrong soname in particular).  We'll keep
+# just the devel libmysqlclient_r.so link, so that rebuilding without any
+# source change is enough to get rid of dependency on libmysqlclient_r.
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient_r.so*
+ln -s libmysqlclient.so ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient_r.so
+
+# mysql-test includes one executable that doesn't belong under /usr/share,
+# so move it and provide a symlink
+mv ${RPM_BUILD_ROOT}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process ${RPM_BUILD_ROOT}%{_bindir}
+ln -s ../../../../../bin/my_safe_process ${RPM_BUILD_ROOT}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process
+
+# should move this to /etc/ ?
+rm -f ${RPM_BUILD_ROOT}%{_bindir}/mysql_embedded
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.a
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/binary-configure
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/magic
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ndb-config-2-node.ini
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql.server
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysqld_multi.server
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1*
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1*
+rm -f ${RPM_BUILD_ROOT}%{_bindir}/mytop
+
+# put logrotate script where it needs to be
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+mv ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/mariadb
+chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/mariadb
+
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d
+echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf
+
+# copy additional docs into build tree so %%doc will find them
+cp -p %{SOURCE6} README.mysql-docs
+cp -p %{SOURCE7} README.mysql-license
+cp -p %{SOURCE16} README.mysql-cnf
+install -p -m 0644 README.mysql-cnf ${RPM_BUILD_ROOT}%{_datadir}/mysql/README.mysql-cnf
+
+# install the list of skipped tests to be available for user runs
+install -p -m 0644 mysql-test/rh-skipped-tests.list ${RPM_BUILD_ROOT}%{_datadir}/mysql-test
+
+# remove unneeded RHEL-4 SELinux stuff
+rm -rf ${RPM_BUILD_ROOT}%{_datadir}/mysql/SELinux/
+
+# remove SysV init script
+rm -f ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/mysql
+
+# remove duplicate logrotate script
+rm -f ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/mysql
+
+# remove doc files that we rather pack using %%doc
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/doc/COPYING
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/doc/INFO_BIN
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/doc/INFO_SRC
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/doc/INSTALL-BINARY
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/doc/README
+
+# we don't care about scripts for solaris
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/solaris/postinstall-solaris
+
+%pre server
+/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
+/usr/sbin/useradd -M -N -g mysql -o -r -d %{_localstatedir}/lib/mysql -s /sbin/nologin \
+	-c "MariaDB Server" -u 27 mysql >/dev/null 2>&1 || :
+
+%post devel
+%{_sbindir}/update-alternatives --install %{_bindir}/mysql_config \
+	mysql_config %{_libdir}/mysql/mysql_config %{__isa_bits}
+
+%post libs -p /sbin/ldconfig
+
+%post server
+%systemd_post mariadb.service
+/bin/chmod 0755 %{_localstatedir}/lib/mysql
+/bin/touch %{_localstatedir}/log/mariadb/mariadb.log
+
+%{_sbindir}/update-alternatives --install %{_bindir}/mysqlbug \
+	mysqlbug %{_libdir}/mysql/mysqlbug %{__isa_bits}
+
+%post embedded -p /sbin/ldconfig
+
+%preun server
+%systemd_preun mariadb.service
+
+%postun devel
+if [ $1 -eq 0 ] ; then
+	%{_sbindir}/update-alternatives --remove mysql_config %{_libdir}/mysql/mysql_config
+fi
+
+%postun libs -p /sbin/ldconfig
+
+%postun server
+%systemd_postun_with_restart mariadb.service
+if [ $1 -eq 0 ] ; then
+	%{_sbindir}/update-alternatives --remove mysqlbug %{_libdir}/mysql/mysqlbug
+fi
+
+%postun embedded -p /sbin/ldconfig
+
+
+
+%files
+%doc README COPYING README.mysql-license
+%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
+%doc README.mysql-docs
+
+%{_bindir}/msql2mysql
+%{_bindir}/mysql
+%{_bindir}/mysql_find_rows
+%{_bindir}/mysql_waitpid
+%{_bindir}/mysqlaccess
+%{_bindir}/mysqladmin
+%{_bindir}/mysqlbinlog
+%{_bindir}/mysqlcheck
+%{_bindir}/mysqldump
+%{?with_tokudb:%{_bindir}/tokuftdump}
+%{_bindir}/mysqlimport
+%{_bindir}/mysqlshow
+%{_bindir}/mysqlslap
+%{_bindir}/my_print_defaults
+%{_bindir}/aria_chk
+%{_bindir}/aria_dump_log
+%{_bindir}/aria_ftdump
+%{_bindir}/aria_pack
+%{_bindir}/aria_read_log
+
+%{_mandir}/man1/mysql.1*
+%{_mandir}/man1/mysql_find_rows.1*
+%{_mandir}/man1/mysql_waitpid.1*
+%{_mandir}/man1/mysqlaccess.1*
+%{_mandir}/man1/mysqladmin.1*
+%{_mandir}/man1/mysqldump.1*
+%{_mandir}/man1/mysqlshow.1*
+%{_mandir}/man1/mysqlslap.1*
+%{_mandir}/man1/my_print_defaults.1*
+%{_mandir}/man1/aria_chk.1.gz
+%{_mandir}/man1/aria_dump_log.1.gz
+%{_mandir}/man1/aria_ftdump.1.gz
+%{_mandir}/man1/aria_pack.1.gz
+%{_mandir}/man1/aria_read_log.1.gz
+
+%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf
+
+%files libs
+%doc README COPYING README.mysql-license
+%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
+# although the default my.cnf contains only server settings, we put it in the
+# libs package because it can be used for client settings too.
+%config(noreplace) %{_sysconfdir}/my.cnf
+%config(noreplace) %{_sysconfdir}/my.cnf.d/mysql-clients.cnf
+%dir %{_sysconfdir}/my.cnf.d
+%dir %{_libdir}/mysql
+%{_libdir}/mysql/libmysqlclient.so.*
+%{_libdir}/mysql/plugin/dialog.so
+%{_libdir}/mysql/plugin/mysql_clear_password.so
+%{_sysconfdir}/ld.so.conf.d/*
+
+%dir %{_datadir}/mysql
+%{_datadir}/mysql/english
+%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
+%{_datadir}/mysql/charsets
+
+%files server
+%{_bindir}/myisamchk
+%{_bindir}/myisam_ftdump
+%{_bindir}/myisamlog
+%{_bindir}/myisampack
+%{_bindir}/mysql_convert_table_format
+%{_bindir}/mysql_fix_extensions
+%{_bindir}/mysql_install_db
+%{_bindir}/mysql_plugin
+%{_bindir}/mysql_secure_installation
+%{_bindir}/mysql_setpermission
+%{_bindir}/mysql_tzinfo_to_sql
+%{_bindir}/mysql_upgrade
+%{_bindir}/mysql_zap
+%ghost %{_bindir}/mysqlbug
+%{_bindir}/mysqldumpslow
+%{_bindir}/mysqld_multi
+%{_bindir}/mysqld_safe
+%{_bindir}/mysqld_safe_helper
+%{_bindir}/mysqlhotcopy
+%{_bindir}/mysqltest
+%{_bindir}/innochecksum
+%{_bindir}/perror
+%{_bindir}/replace
+%{_bindir}/resolve_stack_dump
+%{_bindir}/resolveip
+
+%config(noreplace) %{_sysconfdir}/my.cnf.d/server.cnf
+%{?with_tokudb:%config(noreplace) %{_sysconfdir}/my.cnf.d/tokudb.cnf}
+
+%{_libexecdir}/mysqld
+
+%{_libdir}/mysql/INFO_SRC
+%{_libdir}/mysql/INFO_BIN
+
+%{_libdir}/mysql/mysqlbug
+
+%exclude %{_libdir}/mysql/plugin/dialog.so
+%exclude %{_libdir}/mysql/plugin/mysql_clear_password.so
+%{_libdir}/mysql/plugin
+
+%{_mandir}/man1/msql2mysql.1*
+%{_mandir}/man1/myisamchk.1*
+%{_mandir}/man1/myisamlog.1*
+%{_mandir}/man1/myisampack.1*
+%{_mandir}/man1/mysql_convert_table_format.1*
+%{_mandir}/man1/myisam_ftdump.1*
+%{_mandir}/man1/mysql.server.1*
+%{_mandir}/man1/mysql_fix_extensions.1*
+%{_mandir}/man1/mysql_install_db.1*
+%{_mandir}/man1/mysql_plugin.1*
+%{_mandir}/man1/mysql_secure_installation.1*
+%{_mandir}/man1/mysql_upgrade.1*
+%{_mandir}/man1/mysql_zap.1*
+%{_mandir}/man1/mysqlbug.1*
+%{_mandir}/man1/mysqldumpslow.1*
+%{_mandir}/man1/mysqlbinlog.1*
+%{_mandir}/man1/mysqlcheck.1*
+%{_mandir}/man1/mysqld_multi.1*
+%{_mandir}/man1/mysqld_safe.1*
+%{_mandir}/man1/mysqlhotcopy.1*
+%{_mandir}/man1/mysqlimport.1*
+%{_mandir}/man1/mysql_setpermission.1*
+%{_mandir}/man1/mysqltest.1*
+%{_mandir}/man1/innochecksum.1*
+%{_mandir}/man1/perror.1*
+%{_mandir}/man1/replace.1*
+%{_mandir}/man1/resolve_stack_dump.1*
+%{_mandir}/man1/resolveip.1*
+%{_mandir}/man1/mysql_tzinfo_to_sql.1*
+%{_mandir}/man8/mysqld.8*
+
+%{_datadir}/mysql/errmsg-utf8.txt
+%{_datadir}/mysql/fill_help_tables.sql
+%{_datadir}/mysql/mysql_system_tables.sql
+%{_datadir}/mysql/mysql_system_tables_data.sql
+%{_datadir}/mysql/mysql_test_data_timezone.sql
+%{_datadir}/mysql/mysql_performance_tables.sql
+%doc %{_datadir}/mysql/my-*.cnf
+%doc %{_datadir}/mysql/README.mysql-cnf
+
+%{_unitdir}/mariadb.service
+%{_libexecdir}/mariadb-prepare-db-dir
+%{_libexecdir}/mariadb-wait-ready
+
+%{_tmpfilesdir}/%{name}.conf
+%attr(0755,mysql,mysql) %dir %{_localstatedir}/run/mariadb
+%attr(0755,mysql,mysql) %dir %{_localstatedir}/lib/mysql
+%attr(0750,mysql,mysql) %dir %{_localstatedir}/log/mariadb
+%attr(0640,mysql,mysql) %config(noreplace) %verify(not md5 size mtime) %{_localstatedir}/log/mariadb/mariadb.log
+%config(noreplace) %{_sysconfdir}/logrotate.d/mariadb
+
+%files devel
+%ghost %{_bindir}/mysql_config
+%{_includedir}/mysql
+%{_datadir}/aclocal/mysql.m4
+%{_libdir}/mysql/libmysqlclient.so
+%{_libdir}/mysql/libmysqlclient_r.so
+%{_libdir}/mysql/mysql_config
+%{_mandir}/man1/mysql_config.1*
+
+%files embedded
+%doc README COPYING README.mysql-license
+%doc storage/innobase/COPYING.Percona storage/innobase/COPYING.Google
+%{_libdir}/mysql/libmysqld.so.*
+
+%files embedded-devel
+%{_libdir}/mysql/libmysqld.so
+%{_bindir}/mysql_client_test_embedded
+%{_bindir}/mysqltest_embedded
+%{_mandir}/man1/mysql_client_test_embedded.1*
+%{_mandir}/man1/mysqltest_embedded.1*
+
+%files bench
+%{_datadir}/sql-bench
+
+%files test
+%{_bindir}/mysql_client_test
+%{_bindir}/my_safe_process
+%attr(-,mysql,mysql) %{_datadir}/mysql-test
+
+%{_mandir}/man1/mysql_client_test.1*
+
+%changelog
+* Sat Aug 17 2019 Honza Horak <hhorak@redhat.com> - 1:5.5.65-1
+- Rebase to 5.5.65
+  Also fixes:
+  CVE-2019-2737 CVE-2019-2739 CVE-2019-2740 CVE-2019-2805
+  Resolves: #1741357
+- Revert upstream changes that make the mysql_install_db relocatable
+  because it broke mysql_install_db when run without --rpm arg
+  Resolves: #1731062
+- Add openssl BR that was missing for the tests
+
+* Thu May 02 2019 Michal Schorm <mschorm@redhat.com> - 1:5.5.64-1
+- Rebase to 5.5.64
+- Resolves: #1490398
+- CVE's fixed: #1610986
+  CVE-2018-3058 CVE-2018-3063 CVE-2018-3066 CVE-2018-3081
+- CVE's fixed: #1664043
+  CVE-2018-3282 CVE-2019-2503
+- CVE's fixed: #1701686
+  CVE-2019-2529
+
+* Thu May 10 2018 Michal Schorm <mschorm@redhat.com> - 1:5.5.60-1
+- Rebase to 5.5.60
+- CVE's fixed: #1558256, #1558260, #1559060
+  CVE-2017-3636 CVE-2017-3641 CVE-2017-3653 CVE-2017-10379
+  CVE-2017-10384 CVE-2017-10378 CVE-2017-10268 CVE-2018-2562
+  CVE-2018-2622 CVE-2018-2640 CVE-2018-2665 CVE-2018-2668
+  CVE-2018-2755 CVE-2018-2819 CVE-2018-2817 CVE-2018-2761
+  CVE-2018-2781 CVE-2018-2771 CVE-2018-2813
+- Resolves: #1535217, #1491833, #1511982, #1145455, #1461692
+
+* Thu Jun 08 2017 Honza Horak <hhorak@redhat.com> - 1:5.5.56-2
+- Do not fix context and change owner if run by root in mariadb-prepare-db-dir
+  Related: #1458940
+- Check properly that datadir includes only expected files
+  Related: #1356897
+
+* Mon Jun 05 2017 Honza Horak <hhorak@redhat.com> - 1:5.5.56-1
+- Rebase to 5.5.56
+  That release also fixes the following security issues:
+  CVE-2016-5617/CVE-2016-6664 CVE-2017-3312 CVE-2017-3238 CVE-2017-3243
+  CVE-2017-3244 CVE-2017-3258 CVE-2017-3313 CVE-2017-3317 CVE-2017-3318
+  CVE-2017-3291 CVE-2017-3302 CVE-2016-5483/CVE-2017-3600 CVE-2017-3308
+  CVE-2017-3309 CVE-2017-3453 CVE-2017-3456 CVE-2017-3464
+  Resolves: #1458933
+  New deps required by upstream: checkpolicy and policycoreutils-python
+  License text removed by upstream: COPYING.LESSER
+  Do not ignore test-suite failure
+  Downstream script mariadb-prepare-db-dir fixed for CVE-2017-3265
+  Resolves: #1458940
+
+* Tue Mar 21 2017 Michal Schorm <mschorm@redhat.com> - 5.5.52-2
+- Extension of mariadb-prepare-db-dir script
+- Resolves: #1356897
+
+- Rebase to 5.5.52, that also include fix for CVE-2016-6662
+  Resolves: #1377974
+
+* Wed Sep 21 2016 Honza Horak <hhorak@redhat.com> - 5.5.52-1
+- Rebase to 5.5.52, that also include fix for CVE-2016-6662
+  Resolves: #1377974
+
+* Wed Aug 24 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.50-2
+- Rebuild
+  Related: #1359629
+
+* Mon Jul 25 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.50-1
+- Rebase to 5.5.50
+  Resolves: #1359629
+
+* Thu Jul 07 2016 Honza Horak <hhorak@redhat.com> - 1:5.5.47-5
+- Use full relro instead of just pie
+  Resolves: #1335863
+
+* Mon May 09 2016 Honza Horak <hhorak@redhat.com> - 1:5.5.47-4
+- dialog.so and mysql_clear_password.so should be in mariadb-libs package
+  Resolves: #1138843
+
+* Tue Apr 26 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.47-3
+- Fixed mysql_secure_installation
+  Resolves: #1186040
+
+* Thu Feb 18 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.47-2
+- Add warning to /usr/lib/tmpfiles.d/mariadb.conf
+  Resolves: #1241623
+
+* Wed Feb  3 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.47-1
+- Rebase to 5.5.47
+  Also fixes: CVE-2015-4792 CVE-2015-4802 CVE-2015-4815 CVE-2015-4816
+  CVE-2015-4819 CVE-2015-4826 CVE-2015-4830 CVE-2015-4836 CVE-2015-4858
+  CVE-2015-4861 CVE-2015-4870 CVE-2015-4879 CVE-2015-4913 CVE-2015-7744
+  CVE-2016-0505 CVE-2016-0546 CVE-2016-0596 CVE-2016-0597 CVE-2016-0598
+  CVE-2016-0600 CVE-2016-0606 CVE-2016-0608 CVE-2016-0609 CVE-2016-0616
+  CVE-2016-2047
+  Resolves: #1300621
+
+* Thu Jan 21 2016 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.44-3
+- MDEV-8827 Duplicate key with auto increment
+  fix innodb auto-increment handling three bugs:
+    1. innobase_next_autoinc treated the case of current<offset incorrectly
+    2. ha_innobase::get_auto_increment didn't recalculate current when increment changed
+    3. ha_innobase::get_auto_increment didn't pass offset down to innobase_next_autoinc
+  Resolves: #1300621
+
+* Mon Sep 21 2015 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.44-2
+- Rebuild
+  Related: #1247022
+
+* Tue Jul 28 2015 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.44-1
+- Rebase to 5.5.44
+  Resolves: #1247022
+
+* Wed Jul  8 2015 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.41-3
+- rebuild for correct systemtap markers on aarch64
+  Resolves: #1238468
+
+* Thu Jan 29 2015 Honza Horak <hhorak@redhat.com> - 1:5.5.41-2
+- Include new certificate for tests
+  Resolves: #1186110
+
+* Tue Jan 27 2015 Matej Muzila <mmuzila@redhat.com> - 1:5.5.41-1
+- Rebase to 5.5.41
+  Also fixes: CVE-2014-6568 CVE-2015-0374 CVE-2015-0381 CVE-2015-0382
+  CVE-2015-0391 CVE-2015-0411 CVE-2015-0432
+  Resolves: #1186110
+
+* Tue Dec 30 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.40-2
+- Fix header to let dependencies to build fine
+  Resolves: #1166603
+
+* Thu Nov 06 2014 Matej Muzila <mmuzila@redhat.com> - 1:5.5.40-1
+- Rebase to 5.5.40
+  Also fixes: CVE-2014-4274 CVE-2014-4287 CVE-2014-6463 CVE-2014-6464
+  CVE-2014-6469 CVE-2014-6484 CVE-2014-6505 CVE-2014-6507 CVE-2014-6520
+  CVE-2014-6530 CVE-2014-6551 CVE-2014-6555 CVE-2014-6559 CVE-2014-6564
+  Resolves: #1160549
+
+* Thu Aug 21 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.37-3
+- Fix my_config.h to include correct header
+  Related: #1123497
+
+* Tue Aug 19 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.37-2
+- Build with -O3 on all power64 arches
+  Disable some failing tests temporarily on ppc64le
+  Resolves: #1123497
+
+* Mon May 26 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.37-1
+- Rebase to 5.5.37
+  https://kb.askmonty.org/en/mariadb-5537-changelog/
+  Also fixes: CVE-2014-2440 CVE-2014-0384 CVE-2014-2432 CVE-2014-2431
+  CVE-2014-2430 CVE-2014-2436 CVE-2014-2438 CVE-2014-2419
+  Resolves: #1101062
+
+* Thu Mar 06 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.35-3
+- Fix a typo in last commit
+  Related: #1069586
+
+* Wed Feb 26 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.35-2
+- Remove unnecessary pid guessing and include README for included cnf files
+  Resolves: #1069586
+
+* Thu Jan 30 2014 Honza Horak <hhorak@redhat.com> 5.5.35-1
+- Rebase to 5.5.35
+  https://kb.askmonty.org/en/mariadb-5535-changelog/
+  Also fixes: CVE-2014-0001, CVE-2014-0412, CVE-2014-0437, CVE-2013-5908,
+  CVE-2014-0420, CVE-2014-0393, CVE-2013-5891, CVE-2014-0386, CVE-2014-0401,
+  CVE-2014-0402
+  Resolves: #1054041
+
+* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1:5.5.34-6
+- Mass rebuild 2014-01-24
+
+* Tue Jan 14 2014 Honza Horak <hhorak@redhat.com> - 1:5.5.34-5
+- Adopt compatible system versioning
+  Resolves: #1045013
+
+* Mon Jan 13 2014 Honza Horak <hhorak@redhat.com> 1:5.5.34-4
+- Fix alternatives calls for mysql_config
+  Related: #1050920
+
+* Fri Jan 10 2014 Honza Horak <hhorak@redhat.com> 1:5.5.34-3
+- Clean all non-needed doc files properly
+  Related: #1044532
+- Disable main.gis-precise test also for AArch64
+  Disable perfschema.func_file_io and perfschema.func_mutex for AArch64
+  (like it is done for 32-bit ARM)
+  Resolves: #1050988
+- Build with -O3 on ppc64 (disabling innodb_prefix_index_restart_server)
+  Related: #1051069
+- Move mysql_config to -devel sub-package and remove Require: mariadb
+  Resolves: #1050920
+
+* Tue Jan  7 2014 Honza Horak <hhorak@redhat.com> 1:5.5.34-1
+- Rebase to 5.5.34
+- Obsolete mysql packages
+  Resolves: #1043971
+- Don't test EDH-RSA-DES-CBC-SHA cipher, it seems to be removed from openssl
+  which now makes mariadb/mysql FTBFS because openssl_1 test fails
+  Resolves: #1048881
+- Check if socket file is not being used by another process at a time
+  of starting the service
+  Resolves: #1045435
+
+* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1:5.5.33a-4
+- Mass rebuild 2013-12-27
+
+* Mon Nov  4 2013 Honza Horak <hhorak@redhat.com> 1:5.5.33a-3
+- Check if correct process is running in mysql-wait-ready script
+  Resolves: #1026313
+
+* Mon Nov  4 2013 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.33a-2
+- Add pam-devel to BuildRequires for auth_pam.so to be built
+  Resolves: #1019945
+
+* Wed Oct 23 2013 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.33a-1
+- Rebase to 5.5.33a
+- Disable main.mysql_client_test_nonblock on i686
+  Resolves: #1020032
+
+* Wed Oct  9 2013 Jakub Dorňák <jdornak@redhat.com> - 1:5.5.32-11
+- Remove outfile_loaddata from rh-skipped-tests-base.list
+  Resolves: #950489
+
+* Wed Sep  4 2013 Honza Horak <hhorak@redhat.com> - 1:5.5.32-10
+- Multilib issues solved by alternatives
+  Resolves: #986959
+
+* Thu Aug 29 2013 Honza Horak <hhorak@redhat.com> - 1:5.5.32-9
+- Move log file into /var/log/mariadb/mariadb.log
+- Rename logrotate script to mariadb
+- Resolves: #999589
+
+* Mon Aug 19 2013 Honza Horak <hhorak@redhat.com> 5.5.32-8
+- Fix comments in mariadb.service file
+
+* Wed Jul 31 2013 Honza Horak <hhorak@redhat.com> 5.5.32-7
+- Do not use login shell for mysql user
+
+* Tue Jul 30 2013 Honza Horak <hhorak@redhat.com> 5.5.32-6
+- Remove unneeded systemd-sysv requires
+- Provide mysql-compat-server symbol
+- Create mariadb.service symlink
+- Fix multilib header location for arm
+- Enhance documentation in the unit file
+- Use scriptstub instead of links to avoid multilib conflicts
+- Revert docs in unversioned dir
+- Remove mysql provides from server-side and obsoleting mysql
+- Revert explicit enabling mysqld in the beggining of the transaction
+
+* Sun Jul 28 2013 Dennis Gilmore <dennis@ausil.us> - 5.5.32-5
+- remove "Requires(pretrans): systemd" since its not possible
+- when installing mariadb and systemd at the same time. as in a new install
+
+* Sat Jul 27 2013 Kevin Fenzi <kevin@scrye.com> 5.5.32-4
+- Set rpm doc macro to install docs in unversioned dir
+
+* Fri Jul 26 2013 Dennis Gilmore <dennis@ausil.us> 5.5.32-3
+- add Requires(pre) on systemd for the server package
+
+* Tue Jul 23 2013 Dennis Gilmore <dennis@ausil.us> 5.5.32-2
+- replace systemd-units requires with systemd
+- remove solaris files
+
+* Fri Jul 19 2013 Honza Horak <hhorak@redhat.com> 5.5.32-1
+- Rebase to 5.5.32
+  https://kb.askmonty.org/en/mariadb-5532-changelog/
+- Clean-up un-necessary systemd snippets
+
+* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1:5.5.31-7
+- Perl 5.18 rebuild
+
+* Mon Jul  1 2013 Honza Horak <hhorak@redhat.com> 5.5.31-6
+- Test suite params enhanced to decrease server condition influence
+- Fix misleading error message when uninstalling built-in plugins
+  Related: #966873
+
+* Thu Jun 27 2013 Honza Horak <hhorak@redhat.com> 5.5.31-5
+- Apply fixes found by Coverity static analysis tool
+
+* Wed Jun 19 2013 Honza Horak <hhorak@redhat.com> 5.5.31-4
+- Do not use pretrans scriptlet, which doesn't work in anaconda
+  Resolves: #975348
+
+* Fri Jun 14 2013 Honza Horak <hhorak@redhat.com> 5.5.31-3
+- Explicitly enable mysqld if it was enabled in the beggining
+  of the transaction.
+
+* Thu Jun 13 2013 Honza Horak <hhorak@redhat.com> 5.5.31-2
+- Apply man page fix from Jan Stanek
+
+* Fri May 24 2013 Honza Horak <hhorak@redhat.com> 5.5.31-1
+- Rebase to 5.5.31
+  https://kb.askmonty.org/en/mariadb-5531-changelog/
+- Preserve time-stamps in case of installed files
+- Use /var/tmp instead of /tmp, since the later is using tmpfs,
+  which can cause problems
+  Resolves: #962087
+- Fix test suite requirements
+
+* Sun May  5 2013 Honza Horak <hhorak@redhat.com> 5.5.30-2
+- Remove mytop utility, which is packaged separately
+- Resolve multilib conflicts in mysql/private/config.h
+
+* Fri Mar 22 2013 Honza Horak <hhorak@redhat.com> 5.5.30-1
+- Rebase to 5.5.30
+  https://kb.askmonty.org/en/mariadb-5530-changelog/
+
+* Fri Mar 22 2013 Honza Horak <hhorak@redhat.com> 1:5.5.29-11
+- Obsolete MySQL since it is now renamed to community-mysql
+- Remove real- virtual names
+
+* Thu Mar 21 2013 Honza Horak <hhorak@redhat.com> 1:5.5.29-10
+- Adding epoch to have higher priority than other mysql implementations
+  when comes to provider comparison
+
+* Wed Mar 13 2013 Honza Horak <hhorak@redhat.com> 5.5.29-9
+- Let mariadb-embedded-devel conflict with MySQL-embedded-devel
+- Adjust mariadb-sortbuffer.patch to correspond with upstream patch
+
+* Mon Mar  4 2013 Honza Horak <hhorak@redhat.com> 5.5.29-8
+- Mask expected warnings about setrlimit in test suite
+
+* Thu Feb 28 2013 Honza Horak <hhorak@redhat.com> 5.5.29-7
+- Use configured prefix value instead of guessing basedir
+  in mysql_config
+Resolves: #916189
+- Export dynamic columns and non-blocking API functions documented
+  by upstream
+
+* Wed Feb 27 2013 Honza Horak <hhorak@redhat.com> 5.5.29-6
+- Fix sort_buffer_length option type
+
+* Wed Feb 13 2013 Honza Horak <hhorak@redhat.com> 5.5.29-5
+- Suppress warnings in tests and skip tests also on ppc64p7
+
+* Tue Feb 12 2013 Honza Horak <hhorak@redhat.com> 5.5.29-4
+- Suppress warning in tests on ppc
+- Enable fixed index_merge_myisam test case
+
+* Thu Feb 07 2013 Honza Horak <hhorak@redhat.com> 5.5.29-3
+- Packages need to provide also %%_isa version of mysql package
+- Provide own symbols with real- prefix to distinguish from mysql
+  unambiguously
+- Fix format for buffer size in error messages (MDEV-4156)
+- Disable some tests that fail on ppc and s390
+- Conflict only with real-mysql, otherwise mariadb conflicts with ourself
+
+* Tue Feb 05 2013 Honza Horak <hhorak@redhat.com> 5.5.29-2
+- Let mariadb-libs to own /etc/my.cnf.d
+
+* Thu Jan 31 2013 Honza Horak <hhorak@redhat.com> 5.5.29-1
+- Rebase to 5.5.29
+  https://kb.askmonty.org/en/mariadb-5529-changelog/
+- Fix inaccurate default for socket location in mysqld-wait-ready
+  Resolves: #890535
+
+* Thu Jan 31 2013 Honza Horak <hhorak@redhat.com> 5.5.28a-8
+- Enable obsoleting mysql
+
+* Wed Jan 30 2013 Honza Horak <hhorak@redhat.com> 5.5.28a-7
+- Adding necessary hacks for perl dependency checking, rpm is still
+  not wise enough
+- Namespace sanity re-added for symbol default_charset_info
+
+* Mon Jan 28 2013 Honza Horak <hhorak@redhat.com> 5.5.28a-6
+- Removed %%{_isa} from provides/obsoletes, which doesn't allow
+  proper obsoleting
+- Do not obsolete mysql at the time of testing
+
+* Thu Jan 10 2013 Honza Horak <hhorak@redhat.com> 5.5.28a-5
+- Added licenses LGPLv2 and BSD
+- Removed wrong usage of %%{epoch}
+- Test-suite is run in %%check
+- Removed perl dependency checking adjustment, rpm seems to be smart enough
+- Other minor spec file fixes
+
+* Tue Dec 18 2012 Honza Horak <hhorak@redhat.com> 5.5.28a-4
+- Packaging of MariaDB based on MySQL package
+