Tomohiro "Tomo-p" KATO преди 2 години
родител
ревизия
b1b25b5b88
променени са 1 файла, в които са добавени 57 реда и са изтрити 18 реда
  1. 57 18
      m/mariadb/mariadb-vl.spec

+ 57 - 18
m/mariadb/mariadb-vl.spec

@@ -7,6 +7,16 @@
 %define mysqld_user		mysql
 %define mysqld_group		mysql
 %define mysqldatadir /var/lib/mysql
+%if %{with systemd}
+%define pidfiledir %{_rundir}/mariadb
+%else
+%define pidfiledir /var/run/mariadb
+%endif
+# We define some system's well known locations here so we can use them easily
+# later when building to another location (like SCL)
+%global logrotateddir %{_sysconfdir}/logrotate.d
+%global logfiledir %{_localstatedir}/log/%{daemon_name}
+%global logfile %{logfiledir}/%{daemon_name}.log
 
 # Working around perl dependency problem
 %global __perl_requires %{SOURCE998}
@@ -25,7 +35,7 @@
 Name:		mariadb
 Summary:	MariaDB: a very fast and robust SQL database server
 Version:	%{mariadb_version}
-Release:	1%{_dist_release}%{?with_systemd:.systemd}
+Release:	2%{_dist_release}%{?with_systemd:.systemd}
 Group:		servers
 Vendor:		Project Vine
 Distribution:	Vine Linux
@@ -43,12 +53,14 @@ Source14:	mysql-check-socket.sh
 Source15:	mysql-scripts-common.sh
 Source16:	mysql-check-upgrade.sh
 Source18:	mysql@.service.in
+Source20:	mysql-log-rotate.sh
 
 # Don't depend on lib::mtr*
 Source998:	perl-requires.sh
 Source1000:	macros.mariadb.in
 
 Patch0:		mariadb-scripts.patch
+Patch1:		mariadb-ownsetup.patch
 
 # replace mroonga to the newest version.
 Patch1000:	0001-MariaDB-%{mariadb_version}-Mroonga-v%{mroonga_version}-Groonga-v%{groonga_version}.patch
@@ -242,6 +254,7 @@ into a client application instead of running as a separate process.
 %if %{with systemd}
 %patch0 -p1
 %endif
+%patch1 -p1
 git --git-dir= apply -p1 %{PATCH1000}
 pushd storage/mroonga
 %patch1001 -p1
@@ -252,6 +265,8 @@ cp -f \
 	%{SOURCE15} %{SOURCE16} %{SOURCE18} \
 	scripts/
 
+cp -f %{SOURCE20} support-files/
+
 
 %build
 # Be strict about variables, bail at earliest opportunity, etc.
@@ -267,15 +282,17 @@ export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS}}
 # workaround: force TOKUDB_OK=1
 # https://jira.mariadb.org/browse/MDEV-14524?workflowName=MariaDB+v3&stepId=1
 
-mkdir release
-(
-  cd release
-  cmake ../ \
+%cmake \
       -DINSTALL_LAYOUT=RPM \
+      -DINSTALL_SBINDIR=libexec \
+      -DINSTALL_SCRIPTDIR=bin \
+      -DLOG_LOCATION="%{logfile}" \
+      -DPID_FILE_DIR="%{pidfiledir}" \
       -DBUILD_CONFIG=mysql_release \
       -DCMAKE_BUILD_TYPE=Release \
       -DINSTALL_UNIX_ADDRDIR="/var/lib/mysql/mysql.sock" \
       -DCOMPILATION_COMMENT="Vine Linux MariaDB RPM" \
+      -DDAEMON_NO_PREFIX="%{name}" \
       -DWITH_PIC="ON" \
       -DWITH_EMBEDDED_SERVER="ON" \
       -DWITH_ZLIB="system" \
@@ -291,11 +308,10 @@ mkdir release
 %endif
       -DWITH_PCRE="system" 
 
-ln -sf ../../../../../../release/storage/mroonga/vendor/groonga/include/groonga/version.h ../storage/mroonga/vendor/groonga/include/groonga/version.h
+ln -sf $(pwd)/%{_vpath_builddir}/storage/mroonga/vendor/groonga/include/groonga/version.h storage/mroonga/vendor/groonga/include/groonga/version.h
 
-  echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG
-  make %{?_smp_mflags} VERBOSE=1
-)
+echo BEGIN_NORMAL_CONFIG ; egrep '^#define' %{_vpath_builddir}/include/config.h ; echo END_NORMAL_CONFIG
+%cmake_build VERBOSE=1
 
 
 %install
@@ -305,14 +321,11 @@ install -d %{buildroot}%{mysqldatadir}/mysql
 install -d %{buildroot}%{_infodir}
 
 # Install all binaries
-(
-  cd release
-  make DESTDIR=%{buildroot} install
-)
+%cmake_install
 
 %if %{with systemd}
 install -d %{buildroot}%{_libexecdir}
-pushd release
+pushd %{_vpath_builddir}
 rm -rf %{buildroot}/usr/lib/systemd/system
 # install systemd unit files and scripts for handling server startup
 install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service
@@ -328,11 +341,26 @@ install -p -m 755 scripts/mysql-check-upgrade %{buildroot}%{_libexecdir}/mysql-c
 install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common
 popd
 mkdir -p %{buildroot}%{_unitdir}/mariadb.service.d
+rm -f %{buildroot}%{_sysconfdir}/init.d/*
+rm -f %{buildroot}%{_libexecdir}/rcmysql
 %else
+mkdir -p %{buildroot}%{pidfiledir}
 # drop systemd files.
 rm -rf %{buildroot}%{_sysconfdir}/systemd
 %endif
 
+# Logfile creation
+mkdir -p %{buildroot}%{logfiledir}
+chmod 0750 %{buildroot}%{logfiledir}
+#touch %{buildroot}%{logfile}
+
+# for compatibility with upstream RPMs, create mysqld symlink in sbin
+mkdir -p %{buildroot}%{_sbindir}
+ln -s ../libexec/mysqld %{buildroot}%{_sbindir}/mysqld
+ln -s ../libexec/mariadbd %{buildroot}%{_sbindir}/mariadbd
+
+mkdir -p %{buildroot}%{_localstatedir}/run
+
 install -m 0644  Docs/mysql.info %{buildroot}%{_infodir}
 rm -rf ./doc
 mv -f %{buildroot}%{_docdir} ./
@@ -397,6 +425,14 @@ useradd -M -r -d $datadir -s /bin/bash -c "MySQL server" -g mysql mysql 2> /dev/
 # The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
 usermod -g mysql mysql 2> /dev/null || true
 
+# upgrade from mariadb-server <= 10.6.4-1
+if [ ! -L %{_sbindir}/mysqld ]; then
+  rm -f %{_sbindir}/mysqld
+fi 
+if [ ! -L %{_sbindir}/mariadbd ]; then
+  rm -f %{_sbindir}/mariadbd
+fi 
+
 %post server
 # Make MySQL start/shutdown automatically when the machine does it.
 
@@ -529,8 +565,6 @@ fi
 %license COPYING*
 
 %doc doc/*
-%doc support-files/rpm/*.cnf
-%doc release/support-files/*.cnf
 %doc %{_infodir}/mysql.info*
 
 %doc %{_mandir}/man1/aria_*.1*
@@ -625,7 +659,7 @@ fi
 %{_bindir}/wsrep*
 %{_sbindir}/mariadbd
 %{_sbindir}/mysqld
-%{_sbindir}/rcmysql
+%{_libexecdir}/*
 %dir %{_libdir}/mysql
 %dir %{_libdir}/mysql/plugin
 %attr(0700,mysql,root) %dir %{_libdir}/mysql/plugin/auth_pam_tool_dir
@@ -636,6 +670,7 @@ fi
 %exclude %{_libdir}/mysql/plugin/ha_mroonga.so
 %exclude %{_datadir}/mysql/mroonga
 #exclude %{_datadir}/mysql/systemd/use_galera_new_cluster.conf
+%attr(0750,mysql,mysql) %dir %{logfiledir}
 %dir %{_sysconfdir}/my.cnf.d
 %config(noreplace) %{_sysconfdir}/my.cnf.d/enable_encryption.preset
 %config(noreplace) %{_sysconfdir}/my.cnf.d/server.cnf
@@ -647,10 +682,10 @@ fi
 %{_unitdir}/*.service
 %{_tmpfilesdir}/%{name}.conf
 %dir %{_unitdir}/mariadb.service.d
-%{_libexecdir}/*
 %{_sysusersdir}/%{name}.conf
 %else
 %{_sysconfdir}/init.d/mysql
+%attr(0755,mysql,mysql) %dir %{pidfiledir}
 %endif
 %{_datadir}/mysql
 %attr(755, mysql, mysql) %dir %{mysqldatadir}
@@ -799,6 +834,10 @@ fi
 
 
 %changelog
+* Sun Aug 29 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.6.4-2
+- fixed systemd-unit.
+- fixed locations of pidfile and logfile.
+
 * Sat Aug 07 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.6.4-1
 - new upstream release.
 - updated patch1000.