Skip to content

Commit 6f746c2

Browse files
committed
BUG#22322685 ERROR LOG DEFINED PATH MIS-ALIGNS WITH LOGROTATE.D CONFIG IN RPM INSTALL
Use cmake variables to align paths.
1 parent d4359ee commit 6f746c2

20 files changed

+95
-163
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ IF(NOT WITHOUT_SERVER)
637637
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
638638
ADD_SUBDIRECTORY(internal)
639639
ENDIF()
640+
ADD_SUBDIRECTORY(packaging/rpm-common)
640641
ADD_SUBDIRECTORY(packaging/rpm-oel)
641642
ADD_SUBDIRECTORY(packaging/rpm-fedora)
642643
ADD_SUBDIRECTORY(packaging/rpm-sles)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
#
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program; if not, write to the Free Software
14+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15+
16+
IF ("${PIDFILE_RPM}" STREQUAL "")
17+
SET(PIDFILE_RPM "/var/run/mysqld/mysqld.pid")
18+
ENDIF()
19+
20+
IF ("${LOGFILE_RPM}" STREQUAL "")
21+
SET(LOGFILE_RPM "/var/log/mysqld.log")
22+
ENDIF()
23+
24+
SET(bindir "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
25+
26+
FOREACH(cfile my.cnf mysql.logrotate)
27+
CONFIGURE_FILE(${cfile}.in ${CMAKE_CURRENT_BINARY_DIR}/${cfile} @ONLY)
28+
ENDFOREACH()
29+
30+
FOREACH(cfile filter-provides.sh filter-requires.sh mysql_config.sh my_config.h)
31+
CONFIGURE_FILE(${cfile} ${CMAKE_CURRENT_BINARY_DIR}/${cfile} COPYONLY)
32+
ENDFOREACH()
File renamed without changes.
File renamed without changes.

packaging/rpm-fedora/my.cnf renamed to packaging/rpm-common/my.cnf.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# For advice on how to change settings please see
2-
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
2+
# http://dev.mysql.com/doc/refman/@MYSQL_BASE_VERSION@/en/server-configuration-defaults.html
33

44
[mysqld]
55
#
@@ -17,11 +17,11 @@
1717
# join_buffer_size = 128M
1818
# sort_buffer_size = 2M
1919
# read_rnd_buffer_size = 2M
20-
datadir=/var/lib/mysql
21-
socket=/var/lib/mysql/mysql.sock
20+
datadir=@INSTALL_MYSQLDATADIR@
21+
socket=@MYSQL_UNIX_ADDR@
2222

2323
# Disabling symbolic-links is recommended to prevent assorted security risks
2424
symbolic-links=0
2525

26-
log-error=/var/log/mysqld.log
27-
pid-file=/var/run/mysqld/mysqld.pid
26+
log-error=@LOGFILE_RPM@
27+
pid-file=@PIDFILE_RPM@
File renamed without changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# The log file name and location can be set in
2+
# /etc/my.cnf by setting the "log-error" option
3+
# in [mysqld] section as follows:
4+
#
5+
# [mysqld]
6+
# log-error=@LOGFILE_RPM@
7+
#
8+
# For the mysqladmin commands below to work, root account
9+
# password is required. Use mysql_config_editor(1) to store
10+
# authentication credentials in the encrypted login path file
11+
# ~/.mylogin.cnf
12+
#
13+
# Example usage:
14+
#
15+
# mysql_config_editor set --login-path=client --user=root --host=localhost --password
16+
#
17+
# When these actions has been done, un-comment the following to
18+
# enable rotation of mysqld's log error.
19+
#
20+
21+
#@LOGFILE_RPM@ {
22+
# create 640 mysql mysql
23+
# notifempty
24+
# daily
25+
# rotate 5
26+
# missingok
27+
# compress
28+
# postrotate
29+
# # just if mysqld is really running
30+
# if test -x @bindir@/mysqladmin && \
31+
# @bindir@/mysqladmin ping &>/dev/null
32+
# then
33+
# @bindir@/mysqladmin flush-logs
34+
# fi
35+
# endscript
36+
#}
File renamed without changes.

packaging/rpm-fedora/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,5 @@ IF(UNIX)
2626
# Left in current directory, to be taken during build
2727
CONFIGURE_FILE(mysql.spec.in ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY)
2828

29-
FOREACH(fedfile my.cnf mysql_config.sh)
30-
CONFIGURE_FILE(${fedfile} ${CMAKE_CURRENT_BINARY_DIR}/${fedfile} COPYONLY)
31-
ENDFOREACH()
3229
ENDIF()
3330

packaging/rpm-fedora/mysql.spec.in

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All
6666
Source0: https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
6767
Source1: http://downloads.sourceforge.net/boost/@[email protected]
6868
Source2: %{compatsrc}
69-
Source3: mysql_config.sh
7069
URL: http://www.mysql.com/
7170
Packager: MySQL Release Engineering <[email protected]>
7271
Vendor: %{mysql_vendor}
@@ -464,11 +463,10 @@ install -d -m 0750 %{buildroot}/var/lib/mysql-keyring
464463
# Install all binaries
465464
pushd $MBD/release
466465
make DESTDIR=%{buildroot} install
467-
popd
468466

469-
# Install logrotate and autostart
470-
install -D -m 0644 $MBD/release/support-files/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysql
471-
install -D -m 0644 $MBD/release/packaging/rpm-fedora/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
467+
# Install config and logrotate
468+
install -D -m 0644 packaging/rpm-common/mysql.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/mysql
469+
install -D -m 0644 packaging/rpm-common/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
472470
install -d %{buildroot}%{_sysconfdir}/my.cnf.d
473471

474472
# Add libdir to linker
@@ -479,7 +477,7 @@ echo "%{_libdir}/mysql" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/mysql-%{_arch}
479477
%multilib_fix_c_header --file %{_includedir}/mysql/my_config.h
480478
if %multilib_capable ; then
481479
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits}
482-
install -p -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/mysql_config
480+
install -p -m 0755 packaging/rpm-common/mysql_config.sh %{buildroot}%{_bindir}/mysql_config
483481
fi
484482

485483
# Remove files pages we explicitly do not want to package

0 commit comments

Comments
 (0)