rpms/mysql/devel my.cnf, 1.3, 1.4 mysql.init, 1.20, 1.21 mysql.spec, 1.88, 1.89

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 29 22:47:51 UTC 2007


Author: tgl

Update of /cvs/dist/rpms/mysql/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2610

Modified Files:
	my.cnf mysql.init mysql.spec 
Log Message:
initscript and packaging cleanups, per bugs 233771, 233731


Index: my.cnf
===================================================================
RCS file: /cvs/dist/rpms/mysql/devel/my.cnf,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- my.cnf	9 Feb 2006 21:25:10 -0000	1.3
+++ my.cnf	29 Mar 2007 22:47:48 -0000	1.4
@@ -1,13 +1,10 @@
 [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
+user=mysql
 # Default to using old password format for compatibility with mysql 3.x
 # clients (those using the mysqlclient10 compatibility package).
 old_passwords=1
-     
-[mysql.server]
-user=mysql
-basedir=/var/lib
 
 [mysqld_safe]
 log-error=/var/log/mysqld.log


Index: mysql.init
===================================================================
RCS file: /cvs/dist/rpms/mysql/devel/mysql.init,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mysql.init	9 Feb 2007 20:32:52 -0000	1.20
+++ mysql.init	29 Mar 2007 22:47:48 -0000	1.21
@@ -18,38 +18,26 @@
 
 prog="MySQL"
 
-# extract value of a MySQL option from /etc/my.cnf
-# Usage: get_mysql_option FILE VARNAME DEFAULT
+# extract value of a MySQL option from config files
+# Usage: get_mysql_option SECTION VARNAME DEFAULT
 # result is returned in $result
-# Ugly as this is, it knows nothing of option file sections ...
+# 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=`sed -n "s/^[ \t]*$2[ \t]*=[ \t]*//p" "$1" 2>/dev/null | tail -n 1`
+	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"
-	else
-	    # found, still have to deal with quoting and end-of-line comments
-	    dequoted=`echo "$result" | sed "s/^'\([^']*\)'.*$/\1/"`
-	    if [ x"$dequoted" != x"$result" ]; then
-		result="$dequoted"
-	    else
-		dequoted=`echo "$result" | sed 's/^"\([^"]*\)".*$/\1/'`
-		if [ x"$dequoted" != x"$result" ]; then
-		    result="$dequoted"
-		else
-		    result=`echo "$result" | sed 's/^\([^ \t#]*\).*$/\1/'`
-		fi
-	    fi
 	fi
 }
 
-get_mysql_option /etc/my.cnf datadir "/var/lib/mysql"
+get_mysql_option mysqld datadir "/var/lib/mysql"
 datadir="$result"
-get_mysql_option /etc/my.cnf socket "$datadir/mysql.sock"
+get_mysql_option mysqld socket "$datadir/mysql.sock"
 socketfile="$result"
-get_mysql_option /etc/my.cnf log-error "/var/log/mysqld.log"
+get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
 errlogfile="$result"
-get_mysql_option /etc/my.cnf pid-file "/var/run/mysqld/mysqld.pid"
+get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
 mypidfile="$result"
 
 start(){
@@ -67,11 +55,12 @@
 	fi
 	chown mysql:mysql "$datadir"
 	chmod 0755 "$datadir"
-	# The reason for explicitly specifying --pid-file is that there may
-	# be no such entry in my.cnf, and the default behavior will be to not
-	# create it at all.  Likewise, we specify --log-error in case there
-	# was not an entry in my.cnf.
-	/usr/bin/mysqld_safe  --defaults-file=/etc/my.cnf --pid-file="$mypidfile" --log-error="$errlogfile" >/dev/null 2>&1 &
+	# Pass all the options determined above, to ensure consistent behavior.
+	# In many cases mysqld_safe would arrive at the same conclusions anyway
+	# but we need to be sure.
+	/usr/bin/mysqld_safe   --datadir="$datadir" --socket="$socketfile" \
+		--log-error="$errlogfile" --pid-file="$mypidfile" \
+		>/dev/null 2>&1 &
 	ret=$?
 	# Spin for a maximum of N seconds waiting for the server to come up.
 	# Rather than assuming we know a valid username, accept an "access


Index: mysql.spec
===================================================================
RCS file: /cvs/dist/rpms/mysql/devel/mysql.spec,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- mysql.spec	12 Mar 2007 18:30:39 -0000	1.88
+++ mysql.spec	29 Mar 2007 22:47:48 -0000	1.89
@@ -1,6 +1,6 @@
 Name: mysql
 Version: 5.0.37
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: MySQL client programs and shared libraries
 License: GPL
 Group: Applications/Databases
@@ -70,7 +70,6 @@
 Group: Applications/Databases
 Prereq: /sbin/chkconfig, /usr/sbin/useradd
 Requires: %{name} = %{version}-%{release}
-Requires: %{name}-libs = %{version}-%{release}
 Requires: sh-utils
 # mysqlhotcopy needs DBI/DBD support
 Requires: perl-DBI, perl-DBD-MySQL
@@ -88,7 +87,6 @@
 License: GPL
 Group: Applications/Databases
 Requires: %{name} = %{version}-%{release}
-Requires: %{name}-libs = %{version}-%{release}
 Requires: openssl-devel
 Conflicts: MySQL-devel
 
@@ -257,6 +255,8 @@
 rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/postinstall
 rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec
 rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/ndbd.1*
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/ndb_*.1*
 
 mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
 echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf
@@ -332,16 +332,16 @@
 %{_mandir}/man1/mysqldump.1*
 %{_mandir}/man1/mysqlshow.1*
 
-%dir %{_libdir}/mysql
 %{_libdir}/mysql/mysqlbug
 %{_libdir}/mysql/mysql_config
 
-# perhaps my.cnf should be in the server package?
-%config(noreplace) /etc/my.cnf
-
 %files libs
 %defattr(-,root,root)
 
+# 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) /etc/my.cnf
+
 %dir %{_libdir}/mysql
 %{_libdir}/mysql/libmysqlclient*.so.*
 /etc/ld.so.conf.d/*
@@ -434,29 +434,9 @@
 %{_mandir}/man1/my_print_defaults.1*
 %{_mandir}/man1/mysql_tzinfo_to_sql.1*
 %{_mandir}/man1/mysql_install_db.1*
-%{_mandir}/man1/ndb_config.1*
-%{_mandir}/man1/ndb_cpcd.1*
-%{_mandir}/man1/ndb_delete_all.1*
-%{_mandir}/man1/ndb_desc.1*
-%{_mandir}/man1/ndb_drop_index.1*
-%{_mandir}/man1/ndb_drop_table.1*
-%{_mandir}/man1/ndb_error_reporter.1*
-%{_mandir}/man1/ndb_mgm.1*
-%{_mandir}/man1/ndb_mgmd.1*
-%{_mandir}/man1/ndb_print_backup_file.1*
-%{_mandir}/man1/ndb_print_schema_file.1*
-%{_mandir}/man1/ndb_print_sys_file.1*
-%{_mandir}/man1/ndb_restore.1*
-%{_mandir}/man1/ndb_select_all.1*
-%{_mandir}/man1/ndb_select_count.1*
-%{_mandir}/man1/ndb_show_tables.1*
-%{_mandir}/man1/ndb_size.pl.1*
-%{_mandir}/man1/ndb_waiter.1*
-%{_mandir}/man1/ndbd.1*
 %{_mandir}/man8/mysqld.8*
 %{_mandir}/man8/mysqlmanager.8*
 
-%dir %{_datadir}/mysql
 %{_datadir}/mysql/errmsg.txt
 %{_datadir}/mysql/fill_help_tables.sql
 %{_datadir}/mysql/mysql_fix_privilege_tables.sql
@@ -468,7 +448,6 @@
 %files devel
 %defattr(-,root,root)
 /usr/include/mysql
-%dir %{_libdir}/mysql
 %{_libdir}/mysql/*.a
 %{_libdir}/mysql/libmysqlclient*.so
 
@@ -482,6 +461,13 @@
 %attr(-,mysql,mysql) %{_datadir}/mysql-test
 
 %changelog
+* Thu Mar 29 2007 Tom Lane <tgl at redhat.com> 5.0.37-2
+- Use a less hacky method of getting default values in initscript
+Related: #233771, #194596
+- Improve packaging of mysql-libs per suggestions from Remi Collet
+Resolves: #233731
+- Update default /etc/my.cnf ([mysql.server] has been bogus for a long time)
+
 * Mon Mar 12 2007 Tom Lane <tgl at redhat.com> 5.0.37-1
 - Update to MySQL 5.0.37
 Resolves: #231838




More information about the fedora-cvs-commits mailing list