packages: sphinx/sphinx.spec, sphinx/sphinx.conf.sh (NEW) - add include sup...

glen glen at pld-linux.org
Fri Nov 25 15:50:01 CET 2011


Author: glen                         Date: Fri Nov 25 14:50:01 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add include support from main config; trigger included, but you need to start daemon after upgrade

---- Files affected:
packages/sphinx:
   sphinx.spec (1.39 -> 1.40) , sphinx.conf.sh (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/sphinx/sphinx.spec
diff -u packages/sphinx/sphinx.spec:1.39 packages/sphinx/sphinx.spec:1.40
--- packages/sphinx/sphinx.spec:1.39	Thu Mar 31 20:13:07 2011
+++ packages/sphinx/sphinx.spec	Fri Nov 25 15:49:56 2011
@@ -20,13 +20,14 @@
 Summary(pl.UTF-8):	Silnik przeszukiwania pełnotekstowego SQL open-source
 Name:		sphinx
 Version:	0.9.9
-Release:	7
+Release:	8
 License:	GPL v2
 Group:		Applications/Databases
 Source0:	http://www.sphinxsearch.com/downloads/%{name}-%{version}.tar.gz
 # Source0-md5:	7b9b618cb9b378f949bb1b91ddcc4f54
 Source1:	%{name}.init
 Source2:	%{name}.logrotate
+Source3:	%{name}.conf.sh
 Patch0:		%{name}-system-libstemmer.patch
 Patch1:		bug-468.patch
 Patch2:		bug-297.patch
@@ -204,15 +205,18 @@
 rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx.conf.dist
 
 # create default config with no index definition
-sed -e '/## data source definition/,/## indexer settings/d' sphinx.conf > $RPM_BUILD_ROOT%{_sysconfdir}/sphinx.conf
+sed -e '/## data source definition/,/## indexer settings/d' sphinx.conf > $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-common.conf
+# dir for indexes definition
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/index.d
 
 rm $RPM_BUILD_ROOT%{_sysconfdir}/sphinx-min.conf.dist
 mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/searchd
 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
-cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
 
 install -d $RPM_BUILD_ROOT%{php_data_dir}
-cp -a api/sphinxapi.php $RPM_BUILD_ROOT%{php_data_dir}
+cp -p api/sphinxapi.php $RPM_BUILD_ROOT%{php_data_dir}
 
 # libsphinxclient
 %{__make} -C api/libsphinxclient install \
@@ -220,7 +224,7 @@
 
 # python api
 install -d $RPM_BUILD_ROOT%{py_sitescriptdir}
-cp -a api/sphinxapi.py $RPM_BUILD_ROOT%{py_sitescriptdir}
+cp -p api/sphinxapi.py $RPM_BUILD_ROOT%{py_sitescriptdir}
 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
 %py_postclean
@@ -230,7 +234,7 @@
 # java api
 %if %{with java}
 install -d $RPM_BUILD_ROOT%{_javadir}
-cp -a api/java/sphinxapi.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
+cp -p api/java/sphinxapi.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
 ln -s %{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
 %endif
 
@@ -254,11 +258,25 @@
 	/sbin/chkconfig --del sphinx
 fi
 
+%triggerpostun -- %{name} < 0.9.9-7.6
+if [ -f %{_sysconfdir}/sphinx.conf.rpmsave ]; then
+	cp -f %{_sysconfdir}/sphinx-common.conf{,.rpmnew}
+	mv -f %{_sysconfdir}/sphinx.conf.rpmsave %{_sysconfdir}/sphinx-common.conf
+	%service -q sphinx restart
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc doc/sphinx.txt example.sql sphinx.conf sphinx-min.conf
+
 %dir %attr(750,root,sphinx) %{_sysconfdir}
-%config(noreplace) %verify(not md5 mtime size) %attr(640,root,sphinx) %{_sysconfdir}/sphinx.conf
+# main sphinx config
+%config(noreplace) %verify(not md5 mtime size) %attr(640,root,sphinx) %{_sysconfdir}/sphinx-common.conf
+# shell wrapper which loads main config and extra indexes config
+%attr(755,root,sphinx) %{_sysconfdir}/sphinx.conf
+# put here *.conf files defining extra indexes
+%dir %attr(750,root,sphinx) %{_sysconfdir}/index.d
+
 %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) %{_bindir}/indexer
@@ -308,6 +326,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.40  2011/11/25 14:49:56  glen
+- add include support from main config; trigger included, but you need to start daemon after upgrade
+
 Revision 1.39  2011/03/31 18:13:07  arekm
 - release 7
 

================================================================
Index: packages/sphinx/sphinx.conf.sh
diff -u /dev/null packages/sphinx/sphinx.conf.sh:1.1
--- /dev/null	Fri Nov 25 15:50:01 2011
+++ packages/sphinx/sphinx.conf.sh	Fri Nov 25 15:49:56 2011
@@ -0,0 +1,16 @@
+#!/bin/sh
+# include support for sphinx configs
+# until real include directive added, which may be never
+# http://sphinxsearch.com/bugs/view.php?id=964
+
+dir=$(dirname "$0")
+
+# load global config: indexer, searchd
+cat $dir/sphinx-common.conf
+
+# load extra indexes definitons
+for config in $dir/index.d/*.conf; do
+	if [ -f "$config" ]; then
+		cat "$config"
+	fi
+done
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/sphinx/sphinx.spec?r1=1.39&r2=1.40&f=u



More information about the pld-cvs-commit mailing list