Hardcoded paths removed to work fine in chroot
This commit is contained in:
parent
85af24c338
commit
f6b02e3277
@ -7,7 +7,7 @@ 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,
|
||||
Since default my.cnf contains `!includedir @sysconfdir@/my.cnf.d` directive, it is
|
||||
recommended to copy required configuration under @sysconfdir@/my.cnf.d/ directory,
|
||||
so the default my.cnf specifications will be extended.
|
||||
|
||||
|
@ -13,8 +13,8 @@ diff -up mariadb-10.0.10/support-files/rpm/server.cnf.p13 mariadb-10.0.10/suppor
|
||||
# If you use the same .cnf file for MySQL and MariaDB,
|
||||
# you can put MariaDB-only options here
|
||||
[mariadb]
|
||||
+log-error=/var/log/mariadb/mariadb.log
|
||||
+pid-file=/var/run/mariadb/mariadb.pid
|
||||
+log-error=@LOG_LOCATION@
|
||||
+pid-file=@PID_FILE_DIR@/@DAEMON_NAME@.pid
|
||||
|
||||
# This group is only read by MariaDB-10.0 servers.
|
||||
# If you use the same .cnf file for MariaDB of different versions,
|
||||
|
@ -6,9 +6,28 @@ to know about this.
|
||||
Recommendation they change is at http://bugs.mysql.com/bug.php?id=61425
|
||||
|
||||
|
||||
diff -up mariadb-10.0.10/mysql-test/t/file_contents.test.p7 mariadb-10.0.10/mysql-test/t/file_contents.test
|
||||
--- mariadb-10.0.10/mysql-test/t/file_contents.test.p7 2014-03-30 19:56:44.000000000 +0200
|
||||
+++ mariadb-10.0.10/mysql-test/t/file_contents.test 2014-04-07 18:14:32.776772032 +0200
|
||||
diff -up mariadb-10.0.12/mysql-test/t/file_contents.test.file_contents mariadb-10.0.12/mysql-test/t/file_contents.test.
|
||||
diff -up mariadb-10.0.12/mysql-test/t/file_contents.test.file_contents mariadb-10.0.12/mysql-test/t/file_contents.test
|
||||
--- mariadb-10.0.12/mysql-test/t/file_contents.test.file_contents 2014-06-12 11:26:03.000000000 +0200
|
||||
+++ mariadb-10.0.12/mysql-test/t/file_contents.test 2014-07-24 23:53:49.833176793 +0200
|
||||
@@ -11,7 +11,7 @@
|
||||
--perl
|
||||
print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n";
|
||||
$dir_bin = $ENV{'MYSQL_BINDIR'};
|
||||
-if ($dir_bin eq '/usr/') {
|
||||
+if ($dir_bin =~ '.*/usr/$') {
|
||||
# RPM package
|
||||
$dir_docs = $dir_bin;
|
||||
$dir_docs =~ s|/lib|/share/doc|;
|
||||
@@ -22,7 +22,7 @@ if ($dir_bin eq '/usr/') {
|
||||
# RedHat: version number in directory name
|
||||
$dir_docs = glob "$dir_docs/MySQL-server*";
|
||||
}
|
||||
-} elsif ($dir_bin eq '/usr') {
|
||||
+} elsif ($dir_bin =~ '.*/usr$') {
|
||||
# RPM build during development
|
||||
$dir_docs = "$dir_bin/share/doc";
|
||||
if(-d "$dir_docs/packages") {
|
||||
@@ -32,6 +32,15 @@ if ($dir_bin eq '/usr/') {
|
||||
# RedHat/Debian: version number in directory name
|
||||
$dir_docs = glob "$dir_docs/mariadb-server-*";
|
||||
@ -17,10 +36,10 @@ diff -up mariadb-10.0.10/mysql-test/t/file_contents.test.p7 mariadb-10.0.10/mysq
|
||||
+ # 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";
|
||||
+ if (-d "$dir_bin/lib64/mysql") {
|
||||
+ $dir_docs = "$dir_bin/lib64/mysql";
|
||||
+ } else {
|
||||
+ $dir_docs = "/usr/lib/mysql";
|
||||
+ $dir_docs = "$dir_bin/lib/mysql";
|
||||
+ }
|
||||
}
|
||||
# Slackware
|
||||
|
@ -27,7 +27,7 @@ diff -up mariadb-10.0.10/support-files/mysql-log-rotate.sh.p5 mariadb-10.0.10/su
|
||||
-# [safe_mysqld]
|
||||
-# err-log=@localstatedir@/mysqld.log
|
||||
+# [mysqld_safe]
|
||||
+# log-error=/var/log/mariadb/mariadb.log
|
||||
+# log-error=@LOG_LOCATION@
|
||||
#
|
||||
# If the root user has a password you have to create a
|
||||
# /root/.my.cnf configuration file with the following
|
||||
@ -53,7 +53,7 @@ diff -up mariadb-10.0.10/support-files/mysql-log-rotate.sh.p5 mariadb-10.0.10/su
|
||||
-}
|
||||
+# Then, un-comment the following lines to enable rotation of mysql's log file:
|
||||
+
|
||||
+#/var/log/mariadb/mariadb.log {
|
||||
+#@LOG_LOCATION@ {
|
||||
+# create 640 mysql mysql
|
||||
+# notifempty
|
||||
+# daily
|
||||
|
153
mariadb-paths.patch
Normal file
153
mariadb-paths.patch
Normal file
@ -0,0 +1,153 @@
|
||||
Some hard-coded paths make problems when package is built into chroot like
|
||||
Software Collections. Removing these hard-coded paths should fix it.
|
||||
|
||||
Upstream report: https://mariadb.atlassian.net/browse/MDEV-6485
|
||||
|
||||
|
||||
diff -up mariadb-10.0.12/client/mysql_plugin.c.cmakepaths mariadb-10.0.12/client/mysql_plugin.c
|
||||
--- mariadb-10.0.12/client/mysql_plugin.c.cmakepaths 2014-06-12 11:26:06.000000000 +0200
|
||||
+++ mariadb-10.0.12/client/mysql_plugin.c 2014-07-25 08:40:15.898059511 +0200
|
||||
@@ -90,6 +90,7 @@ static int find_plugin(char *tp_path);
|
||||
static int build_bootstrap_file(char *operation, char *bootstrap);
|
||||
static int dump_bootstrap_file(char *bootstrap_file);
|
||||
static int bootstrap_server(char *server_path, char *bootstrap_file);
|
||||
+static int find_file_in_path(char *to,const char *name);
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
@@ -122,7 +123,7 @@ int main(int argc,char *argv[])
|
||||
*/
|
||||
if ((error= process_options(argc, argv, operation)) ||
|
||||
(error= check_access()) ||
|
||||
- (error= find_tool("mysqld" FN_EXEEXT, server_path)) ||
|
||||
+ (error= find_file_in_path("mysqld" FN_EXEEXT, server_path)) ||
|
||||
(error= find_plugin(tp_path)) ||
|
||||
(error= build_bootstrap_file(operation, bootstrap)))
|
||||
goto exit;
|
||||
@@ -325,7 +326,7 @@ static int get_default_values()
|
||||
FILE *file= 0;
|
||||
|
||||
bzero(tool_path, FN_REFLEN);
|
||||
- if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path)))
|
||||
+ if ((error= find_file_in_path("my_print_defaults" FN_EXEEXT, tool_path)))
|
||||
goto exit;
|
||||
else
|
||||
{
|
||||
@@ -954,6 +955,55 @@ exit:
|
||||
}
|
||||
|
||||
|
||||
+#if defined(__WIN__)
|
||||
+#define F_OK 0
|
||||
+#define PATH_SEP ';'
|
||||
+#define PROGRAM_EXTENSION ".exe"
|
||||
+#else
|
||||
+#define PATH_SEP ':'
|
||||
+#endif
|
||||
+
|
||||
+static int find_file_in_path(char *to, const char *name)
|
||||
+{
|
||||
+ char *path,*pos,dir[2];
|
||||
+ const char *ext="";
|
||||
+
|
||||
+ if (!(path=getenv("PATH")))
|
||||
+ goto notfound;
|
||||
+ dir[0]=FN_LIBCHAR; dir[1]=0;
|
||||
+#ifdef PROGRAM_EXTENSION
|
||||
+ if (!fn_ext(name)[0])
|
||||
+ ext=PROGRAM_EXTENSION;
|
||||
+#endif
|
||||
+
|
||||
+ for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
|
||||
+ {
|
||||
+ if (path != pos)
|
||||
+ {
|
||||
+ strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
|
||||
+ if (!access(to,F_OK))
|
||||
+ {
|
||||
+ if (opt_verbose)
|
||||
+ printf("# Found tool '%s' as '%s'.\n", name, to);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+#ifdef __WIN__
|
||||
+ to[0]=FN_CURLIB;
|
||||
+ strxmov(to+1,dir,name,ext,NullS);
|
||||
+ if (!access(to,F_OK)) /* Test in current dir */
|
||||
+ {
|
||||
+ if (opt_verbose)
|
||||
+ printf("# Found tool '%s' as '%s'.\n", name, to);
|
||||
+ return 0;
|
||||
+ }
|
||||
+#endif
|
||||
+notfound:
|
||||
+ fprintf(stderr, "WARNING: Cannot find %s.\n", name);
|
||||
+ return 1; /* File not found */
|
||||
+}
|
||||
+
|
||||
/**
|
||||
Locate the tool and form tool path.
|
||||
|
||||
diff -up mariadb-10.0.12/mysys/my_default.c.cmakepaths mariadb-10.0.12/mysys/my_default.c
|
||||
--- mariadb-10.0.12/mysys/my_default.c.cmakepaths 2014-06-12 11:26:03.000000000 +0200
|
||||
+++ mariadb-10.0.12/mysys/my_default.c 2014-07-25 08:39:04.875937851 +0200
|
||||
@@ -1224,9 +1224,6 @@ static const char **init_default_directo
|
||||
|
||||
#else
|
||||
|
||||
- errors += add_directory(alloc, "/etc/", dirs);
|
||||
- errors += add_directory(alloc, "/etc/mysql/", dirs);
|
||||
-
|
||||
#if defined(DEFAULT_SYSCONFDIR)
|
||||
if (DEFAULT_SYSCONFDIR[0])
|
||||
errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
|
||||
diff -up mariadb-10.0.12/scripts/mysqlaccess.sh.cmakepaths mariadb-10.0.12/scripts/mysqlaccess.sh
|
||||
--- mariadb-10.0.12/scripts/mysqlaccess.sh.cmakepaths 2014-06-12 11:26:06.000000000 +0200
|
||||
+++ mariadb-10.0.12/scripts/mysqlaccess.sh 2014-07-25 08:39:04.877937855 +0200
|
||||
@@ -483,9 +483,6 @@ MySQLaccess::Report::Print_Header();
|
||||
elsif (-f "@sysconfdir@/$script_conf") {
|
||||
require "@sysconfdir@/$script_conf";
|
||||
}
|
||||
- elsif (-f "/etc/$script_conf") {
|
||||
- require "/etc/$script_conf";
|
||||
- }
|
||||
|
||||
# ****************************
|
||||
# Read in all parameters
|
||||
@@ -951,7 +948,6 @@ sub MergeConfigFile {
|
||||
sub MergeConfigFiles {
|
||||
my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
|
||||
MergeConfigFile("@sysconfdir@/my.cnf");
|
||||
- MergeConfigFile("/etc/my.cnf");
|
||||
MergeConfigFile("$dir/.my.cnf");
|
||||
}
|
||||
|
||||
diff -up mariadb-10.0.12/scripts/mysqld_multi.sh.cmakepaths mariadb-10.0.12/scripts/mysqld_multi.sh
|
||||
--- mariadb-10.0.12/scripts/mysqld_multi.sh.cmakepaths 2014-06-12 11:26:04.000000000 +0200
|
||||
+++ mariadb-10.0.12/scripts/mysqld_multi.sh 2014-07-25 08:39:04.878937857 +0200
|
||||
@@ -499,9 +499,7 @@ sub list_defaults_files
|
||||
|
||||
my %seen; # Don't list the same file more than once
|
||||
return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
|
||||
- ('/etc/my.cnf',
|
||||
- '/etc/mysql/my.cnf',
|
||||
- '@sysconfdir@/my.cnf',
|
||||
+ ('@sysconfdir@/my.cnf',
|
||||
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
|
||||
$opt{'extra-file'},
|
||||
($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
|
||||
diff -up mariadb-10.0.12/scripts/mytop.sh.cmakepaths mariadb-10.0.12/scripts/mytop.sh
|
||||
--- mariadb-10.0.12/scripts/mytop.sh.cmakepaths 2014-06-12 11:26:06.000000000 +0200
|
||||
+++ mariadb-10.0.12/scripts/mytop.sh 2014-07-25 08:39:04.879937858 +0200
|
||||
@@ -1829,8 +1829,8 @@ sub FindProg($)
|
||||
{
|
||||
my $prog = shift;
|
||||
my $found = undef;
|
||||
- my @search_dirs = ("/bin", "/usr/bin", "/usr/sbin",
|
||||
- "/usr/local/bin", "/usr/local/sbin");
|
||||
+ my @search_dirs = ("@prefix@", "@prefix@/bin", "@prefix@/sbin",
|
||||
+ "@prefix@/local/bin", "@prefix@/local/sbin");
|
||||
|
||||
for (@search_dirs)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
diff -up mariadb-10.0.12/scripts/CMakeLists.txt.systemd mariadb-10.0.12/scripts/CMakeLists.txt
|
||||
--- mariadb-10.0.12/scripts/CMakeLists.txt.systemd 2014-07-21 10:49:58.491470586 +0200
|
||||
+++ mariadb-10.0.12/scripts/CMakeLists.txt 2014-07-21 14:21:22.673329708 +0200
|
||||
@@ -368,6 +368,32 @@ ELSE()
|
||||
@@ -368,6 +368,33 @@ ELSE()
|
||||
COMPONENT ${${file}_COMPONENT}
|
||||
)
|
||||
ENDFOREACH()
|
||||
@ -18,6 +18,7 @@ diff -up mariadb-10.0.12/scripts/CMakeLists.txt.systemd mariadb-10.0.12/scripts/
|
||||
+ mysql.init
|
||||
+ mysql-compat.service
|
||||
+ mysql-compat.conf
|
||||
+ my.cnf
|
||||
+ )
|
||||
+ FOREACH(file ${SYSTEMD_SCRIPTS})
|
||||
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
|
||||
@ -34,3 +35,15 @@ diff -up mariadb-10.0.12/scripts/CMakeLists.txt.systemd mariadb-10.0.12/scripts/
|
||||
ENDIF()
|
||||
|
||||
# Install libgcc as mylibgcc.a
|
||||
diff -up mariadb-10.0.12/support-files/CMakeLists.txt.cmakescripts mariadb-10.0.12/support-files/CMakeLists.txt
|
||||
--- mariadb-10.0.12/support-files/CMakeLists.txt.cmakescripts 2014-07-24 22:31:38.116002679 +0200
|
||||
+++ mariadb-10.0.12/support-files/CMakeLists.txt 2014-07-24 22:35:00.532233645 +0200
|
||||
@@ -110,6 +110,8 @@ IF(UNIX)
|
||||
COMPONENT SharedLibraries)
|
||||
INSTALL(FILES rpm/mysql-clients.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
|
||||
COMPONENT Client)
|
||||
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/rpm/server.cnf
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/rpm/server.cnf @ONLY )
|
||||
INSTALL(FILES rpm/server.cnf DESTINATION ${INSTALL_SYSCONF2DIR}
|
||||
COMPONENT IniFiles)
|
||||
ENDIF()
|
||||
|
17
mariadb.spec
17
mariadb.spec
@ -117,7 +117,7 @@ License: GPLv2 with exceptions and LGPLv2 and BSD
|
||||
|
||||
Source0: http://mirrors.syringanetworks.net/mariadb/mariadb-%{version}/source/mariadb-%{version}.tar.gz
|
||||
Source2: mysql_config_multilib.sh
|
||||
Source3: my.cnf
|
||||
Source3: my.cnf.in
|
||||
Source4: my_config.h
|
||||
Source5: README.mysql-cnf
|
||||
Source6: README.mysql-docs
|
||||
@ -148,6 +148,7 @@ Patch5: %{pkgname}-cipherspec.patch
|
||||
Patch6: %{pkgname}-file-contents.patch
|
||||
Patch7: %{pkgname}-dh1024.patch
|
||||
Patch8: %{pkgname}-scripts.patch
|
||||
Patch9: %{pkgname}-paths.patch
|
||||
|
||||
# Patches specific for this mysql package
|
||||
Patch30: %{pkgname}-errno.patch
|
||||
@ -442,6 +443,7 @@ MariaDB is a community developed branch of MySQL.
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
@ -476,8 +478,8 @@ cat %{SOURCE53} >> mysql-test/rh-skipped-tests.list
|
||||
cat %{SOURCE54} >> mysql-test/rh-skipped-tests.list
|
||||
%endif
|
||||
|
||||
cp %{SOURCE2} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} \
|
||||
%{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} scripts
|
||||
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
|
||||
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} scripts
|
||||
|
||||
%build
|
||||
|
||||
@ -522,8 +524,12 @@ cmake . -DBUILD_CONFIG=mysql_release \
|
||||
-DINSTALL_LAYOUT=RPM \
|
||||
-DDAEMON_NAME="%{daemon_name}" \
|
||||
%if 0%{?mysqld_unit:1}
|
||||
-DDAEMON_NAME2="%{mysqld_unit}" \
|
||||
-DDAEMON_NAME_COMPAT="%{mysqld_unit}" \
|
||||
%endif
|
||||
-DLOG_LOCATION="%{logfile}" \
|
||||
-DLOG_LOCATION_COMPAT="%{old_logfile}" \
|
||||
-DPID_FILE_DIR="%{_localstatedir}/run/%{daemon_name}" \
|
||||
-DPID_FILE_DIR_COMAPT="%{_localstatedir}/run/%{mysqld_unit}" \
|
||||
-DNICE_PROJECT_NAME="MariaDB" \
|
||||
-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \
|
||||
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
|
||||
@ -556,7 +562,7 @@ cmake . -DBUILD_CONFIG=mysql_release \
|
||||
%{?with_pcre: -DWITH_PCRE=system}\
|
||||
-DWITH_JEMALLOC=no \
|
||||
%{!?with_tokudb: -DWITHOUT_TOKUDB=ON}\
|
||||
-DTMPDIR=%{_localstatedir}/tmp \
|
||||
-DTMPDIR=/var/tmp \
|
||||
-DWITH_MYSQLD_LDFLAGS="-Wl,-z,relro,-z,now"
|
||||
|
||||
make %{?_smp_mflags} VERBOSE=1
|
||||
@ -1101,6 +1107,7 @@ fi
|
||||
|
||||
%changelog
|
||||
* Tue Jul 22 2014 Honza Horak <hhorak@redhat.com> - 1:10.0.12-5
|
||||
- Hardcoded paths removed to work fine in chroot
|
||||
- Spec rewrite to be more similar to oterh MySQL implementations
|
||||
- Use variable for daemon unit name
|
||||
- Include SysV init script if built on older system
|
||||
|
@ -14,16 +14,16 @@ symbolic-links=0
|
||||
# Otherwise the RPMs would be in conflict.
|
||||
# Settings for particular implementations like MariaDB are then
|
||||
# defined in appropriate sections; for MariaDB server in [mariadb] section in
|
||||
# /etc/my.cnf.d/server.cnf (part of mariadb-server).
|
||||
# @sysconfdir@/my.cnf.d/server.cnf (part of mariadb-server).
|
||||
# It doesn't matter that we set these settings only for [mysqld] here,
|
||||
# because they will be read and used in mysqld_safe as well.
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
log-error=@LOG_LOCATION_COMPAT@
|
||||
pid-file=@PID_FILE_DIR_COMAPT@/@DAEMON_NAME_COMPAT@.pid
|
||||
|
||||
[mysqld_safe]
|
||||
|
||||
#
|
||||
# include all files from the config directory
|
||||
#
|
||||
!includedir /etc/my.cnf.d
|
||||
!includedir @sysconfdir@/my.cnf.d
|
||||
|
@ -18,7 +18,7 @@ get_mysql_option(){
|
||||
sections="$1"
|
||||
option_name="$2"
|
||||
default_value="$3"
|
||||
result=`/usr/bin/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1`
|
||||
result=`@bindir@/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1`
|
||||
if [ -z "$result" ]; then
|
||||
# not found, use default
|
||||
result="${default_value}"
|
||||
@ -30,7 +30,7 @@ get_mysql_option(){
|
||||
# on the default installation:
|
||||
# 1) default values are hardcoded in the code of mysqld daemon or
|
||||
# mysqld_safe script
|
||||
# 2) configurable values are defined in /etc/my.cnf
|
||||
# 2) configurable values are defined in @sysconfdir@/my.cnf
|
||||
# 3) default values for helper scripts are specified bellow
|
||||
# So, in case values are defined in my.cnf, we need to get that value.
|
||||
# In case they are not defined in my.cnf, we need to get the same value
|
||||
|
@ -1,2 +1,2 @@
|
||||
d /var/run/@DAEMON_NAME2@ 0755 mysql mysql -
|
||||
d /var/run/@DAEMON_NAME@ 0755 mysql mysql -
|
||||
d @PID_FILE_DIR@ 0755 mysql mysql -
|
||||
d @PID_FILE_DIR_COMAPT@ 0755 mysql mysql -
|
||||
|
Loading…
Reference in New Issue
Block a user