diff --git a/.gitignore b/.gitignore index b7cfe5a..e1c9f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ sphinx-0.9.9.tar.gz +/sphinx-2.0.3-release.tar.gz diff --git a/searchd.service b/searchd.service new file mode 100644 index 0000000..8f3e7e1 --- /dev/null +++ b/searchd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Sphinx - SQL Full Text Search Engine +After=local-fs.target network.target mysqld.service + +[Service] +User=sphinx +Type=forking +PIDFile=/run/sphinx/searchd.pid +ExecStart=/usr/bin/searchd --config /etc/sphinx/sphinx.conf + +[Install] +WantedBy=multi-user.target diff --git a/sources b/sources index 7694026..f2b3e3c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7b9b618cb9b378f949bb1b91ddcc4f54 sphinx-0.9.9.tar.gz +a1293aecd5034aa797811610beb7ba89 sphinx-2.0.3-release.tar.gz diff --git a/sphinx-2.0.3-default_listen.patch b/sphinx-2.0.3-default_listen.patch new file mode 100644 index 0000000..07b602d --- /dev/null +++ b/sphinx-2.0.3-default_listen.patch @@ -0,0 +1,24 @@ +diff -r -U3 sphinx-2.0.3-release.orig/sphinx.conf.in sphinx-2.0.3-release/sphinx.conf.in +--- sphinx-2.0.3-release.orig/sphinx.conf.in 2011-04-18 09:39:40.000000000 -0500 ++++ sphinx-2.0.3-release/sphinx.conf.in 2012-02-14 13:49:19.660872549 -0600 +@@ -716,7 +716,7 @@ + # listen = 192.168.0.1:9312 + # listen = 9312 + # listen = /var/run/searchd.sock +- listen = 9312 ++ listen = 127.0.0.1:9312 + listen = 9306:mysql41 + + # log file, searchd run info is logged here +diff -r -U3 sphinx-2.0.3-release.orig/sphinx-min.conf.in sphinx-2.0.3-release/sphinx-min.conf.in +--- sphinx-2.0.3-release.orig/sphinx-min.conf.in 2011-04-18 09:39:40.000000000 -0500 ++++ sphinx-2.0.3-release/sphinx-min.conf.in 2012-02-14 13:49:55.682449012 -0600 +@@ -54,7 +54,7 @@ + + searchd + { +- listen = 9312 ++ listen = 127.0.0.1:9312 + listen = 9306:mysql41 + log = @CONFDIR@/log/searchd.log + query_log = @CONFDIR@/log/query.log diff --git a/sphinx-2.0.3-fix_static.patch b/sphinx-2.0.3-fix_static.patch new file mode 100644 index 0000000..2e91ee3 --- /dev/null +++ b/sphinx-2.0.3-fix_static.patch @@ -0,0 +1,22 @@ +--- sphinx-2.0.3-release/api/libsphinxclient/sphinxclient.c~ 2011-11-13 06:40:26.000000000 -0600 ++++ sphinx-2.0.3-release/api/libsphinxclient/sphinxclient.c 2012-02-14 13:45:50.444826859 -0600 +@@ -290,7 +290,7 @@ + } + + +-void sock_close ( int sock ); ++static sock_close ( int sock ); + + + #define safe_free(_ptr) \ +--- sphinx-2.0.3-release/api/libsphinxclient/sphinxclient.c~ 2012-02-14 13:50:33.000000000 -0600 ++++ sphinx-2.0.3-release/api/libsphinxclient/sphinxclient.c 2012-02-14 13:54:50.527389085 -0600 +@@ -1253,7 +1253,7 @@ + } + + +-void sock_close ( int sock ) ++static sock_close ( int sock ) + { + if ( sock<0 ) + return; diff --git a/sphinx-2.0.3-gcc47.patch b/sphinx-2.0.3-gcc47.patch new file mode 100644 index 0000000..ed9e93a --- /dev/null +++ b/sphinx-2.0.3-gcc47.patch @@ -0,0 +1,29 @@ +--- src/sphinxexpr.cpp.orig 2012-02-15 08:49:22.012513635 -0600 ++++ src/sphinxexpr.cpp 2012-02-15 08:49:47.634770092 -0600 +@@ -1796,7 +1796,7 @@ + /// evaluate arg, return interval id + virtual int IntEval ( const CSphMatch & tMatch ) const + { +- T val = ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage ++ T val = this->ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage + ARRAY_FOREACH ( i, this->m_dValues ) // FIXME! OPTIMIZE! perform binary search here + if ( valm_dValues[i] ) + return i; +@@ -1827,7 +1827,7 @@ + /// evaluate arg, return interval id + virtual int IntEval ( const CSphMatch & tMatch ) const + { +- T val = ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage ++ T val = this->ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage + ARRAY_FOREACH ( i, m_dTurnPoints ) + if ( val < Expr_ArgVsSet_c::ExprEval ( m_dTurnPoints[i], tMatch ) ) + return i; +@@ -1873,7 +1873,7 @@ + /// evaluate arg, check if the value is within set + virtual int IntEval ( const CSphMatch & tMatch ) const + { +- T val = ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage ++ T val = this->ExprEval ( this->m_pArg, tMatch ); // 'this' fixes gcc braindamage + return this->m_dValues.BinarySearch ( val )!=NULL; + } + diff --git a/sphinx.spec b/sphinx.spec index af63479..b7ceb5a 100644 --- a/sphinx.spec +++ b/sphinx.spec @@ -3,17 +3,18 @@ %global sphinx_home %{_localstatedir}/lib/sphinx Name: sphinx -Version: 0.9.9 -Release: 7%{?dist} +Version: 2.0.3 +Release: 1%{?dist} Summary: Free open-source SQL full-text search engine Group: Applications/Text License: GPLv2+ URL: http://sphinxsearch.com -Source0: http://sphinxsearch.com/downloads/%{name}-%{version}.tar.gz -Source1: %{name}.init -Patch0: %{name}-%{version}-fix_static.patch -Patch1: %{name}-%{version}-default_listen.patch +Source0: http://sphinxsearch.com/downloads/%{name}-%{version}-release.tar.gz +Source1: searchd.service +Patch0: %{name}-2.0.3-fix_static.patch +Patch1: %{name}-2.0.3-default_listen.patch +Patch2: sphinx-2.0.3-gcc47.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: mysql-devel @@ -23,8 +24,12 @@ BuildRequires: expat-devel #Requires: #Initscripts -Requires(post): chkconfig -Requires(preun): chkconfig initscripts +#Requires(post): chkconfig +#Requires(preun): chkconfig initscripts +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + # Users and groups Requires(pre): shadow-utils @@ -100,9 +105,10 @@ designed with indexing database content in mind. %prep -%setup -q +%setup -qn %{name}-%{version}-release %patch0 -p1 -b .fix_static %patch1 -p1 -b .default_listen +%patch2 -p0 -b .gcc47 # Fix wrong-file-end-of-line-encoding sed -i 's/\r//' api/ruby/spec/sphinx/sphinx_test.sql @@ -131,7 +137,8 @@ rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p -c" # Install sphinx initscript -install -p -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/searchd +#install -p -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/searchd +install -p -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/searchd.service # Create /var/log/sphinx mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/sphinx @@ -215,23 +222,51 @@ useradd -r -g %{sphinx_group} -d %{sphinx_home} -s /bin/bash \ exit 0 %post -/sbin/chkconfig --add searchd +#/sbin/chkconfig --add searchd +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + %preun -if [ $1 = 0 ] ; then - /sbin/service searchd stop >/dev/null 2>&1 - /sbin/chkconfig --del searchd +#if [ $1 = 0 ] ; then +# /sbin/service searchd stop >/dev/null 2>&1 +# /sbin/chkconfig --del searchd +#fi +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable searchd.service > /dev/null 2>&1 || : + /bin/systemctl stop searchd.service > /dev/null 2>&1 || : fi + %post -p /sbin/ldconfig -n libsphinxclient -%postun -p /sbin/ldconfig -n libsphinxclient +%postun +/sbin/ldconfig -n libsphinxclient +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart searchd.service >/dev/null 2>&1 || : +fi + %posttrans chown -R %{sphinx_user}:root %{_localstatedir}/log/sphinx/ chown -R %{sphinx_user}:root %{_localstatedir}/run/sphinx/ chown -R %{sphinx_user}:root %{_localstatedir}/lib/sphinx/ +%triggerun -- sphinx < 2.0.3-1 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply httpd +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save searchd >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del searchd >/dev/null 2>&1 || : +/bin/systemctl try-restart searchd.service >/dev/null 2>&1 || : + %files %defattr(-,root,root,-) @@ -240,12 +275,14 @@ chown -R %{sphinx_user}:root %{_localstatedir}/lib/sphinx/ %config(noreplace) %{_sysconfdir}/sphinx/sphinx.conf %exclude %{_sysconfdir}/sphinx/*.conf.dist %exclude %{_sysconfdir}/sphinx/example.sql -%{_initrddir}/searchd +#%%{_initrddir}/searchd +%{_unitdir}/searchd.service %config(noreplace) %{_sysconfdir}/logrotate.d/sphinx %{_bindir}/* %dir %attr(0755, %{sphinx_user}, root) %{_localstatedir}/log/sphinx %dir %attr(0755, %{sphinx_user}, root) %{_localstatedir}/run/sphinx %dir %attr(0755, %{sphinx_user}, root) %{_localstatedir}/lib/sphinx +%{_mandir}/man1/* %ghost %{_localstatedir}/run/sphinx/searchd.log %ghost %{_localstatedir}/run/sphinx/query.log @@ -274,6 +311,10 @@ chown -R %{sphinx_user}:root %{_localstatedir}/lib/sphinx/ %{_datadir}/php/* %changelog +* Tue Feb 14 2012 Jon Ciesla - 2.0.3-1 +- New upstream, migrate to systemd, BZ 692157. +- Patched for gcc47. + * Sat Jan 14 2012 Fedora Release Engineering - 0.9.9-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild