From: Gerd von Egidy Date: Thu, 27 Jan 2011 14:49:26 +0000 (+0100) Subject: import current state into packaging-git X-Git-Url: http://developer.intra2net.com/git/?p=mnogosearch-rpm;a=commitdiff_plain;h=a3f8605291ba0dda7ed9a7a16dba1cfc43198df8 import current state into packaging-git --- a3f8605291ba0dda7ed9a7a16dba1cfc43198df8 diff --git a/httpd.conf b/httpd.conf new file mode 100644 index 0000000..44ca2ff --- /dev/null +++ b/httpd.conf @@ -0,0 +1,9 @@ +# default configuration for the local search engine mnogosearch +# +# makes available the search engine at +# http:///search/search.cgi +# +# to configure mnogosearch, see /etc/mnogosearch +# and /usr/share/doc/mnogosearch-* + +ScriptAlias /search/ /usr/libexec/mnogosearch/ diff --git a/mnogosearch-3.3.11.tar.gz b/mnogosearch-3.3.11.tar.gz new file mode 100644 index 0000000..672317d Binary files /dev/null and b/mnogosearch-3.3.11.tar.gz differ diff --git a/mnogosearch-reindex b/mnogosearch-reindex new file mode 100644 index 0000000..003e6d0 --- /dev/null +++ b/mnogosearch-reindex @@ -0,0 +1,32 @@ +#!/bin/sh +# update mnogosearch database +# +# to configure mnogosearch, see /etc/mnogosearch +# and /usr/share/doc/mnogosearch-* +# +MAINCONFIG=/etc/mnogosearch/indexer.conf + +if [ ! -f $MAINCONFIG ]; then + # no config: exit quietly + exit 0 +fi + +if [ ! -x /usr/bin/indexer ]; then + echo "can't execute /usr/bin/indexer" >&2 + exit 1 +fi + +# are we called by the correct user? +if [ ! -O /var/lib/mnogosearch ]; then + echo "indexing can only be done by the mnogosearch user" >&2 + exit 1 +fi + +BASICOPTIONS="-v 0 -d $MAINCONFIG" + +# crawl the URLs +/usr/bin/indexer $BASICOPTIONS --crawl -b -e +# create a search index +/usr/bin/indexer $BASICOPTIONS --index +# create word statistics for suggestions +/usr/bin/indexer $BASICOPTIONS --wordstat diff --git a/mnogosearch.crond b/mnogosearch.crond new file mode 100644 index 0000000..29ef201 --- /dev/null +++ b/mnogosearch.crond @@ -0,0 +1,7 @@ +SHELL=/bin/bash +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root +# +# update the mnogosearch index daily +# +20 3 * * * mnogosearch nice -n 20 /usr/bin/mnogosearch-reindex diff --git a/mnogosearch.spec b/mnogosearch.spec new file mode 100644 index 0000000..607a765 --- /dev/null +++ b/mnogosearch.spec @@ -0,0 +1,358 @@ +%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) +%global php_extdir %(php-config --extension-dir 2>/dev/null || echo "undefined") +%global php_version %(php-config --version 2>/dev/null || echo 0) + +# do not add php module to provides, it is no regular library +%{?filter_setup: +%filter_provides_in %{php_extdir}/.*\.so$ +%filter_setup +} + +Summary: Web indexing and search system for a small domain or intranet +Name: mnogosearch +Version: 3.3.11 +Release: 1 +License: GPLv2+ +Group: Applications/Internet +URL: http://www.mnogosearch.org/ + +# md5sum 257c6bedb0113667654aaa7c47d0a9b3 +Source0: http://www.mnogosearch.org/Download/mnogosearch-%{version}.tar.gz + +Source1: mnogosearch-reindex +Source2: mnogosearch.crond +Source3: httpd.conf + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Requires: %{name}-libs = %{version}-%{release} +Requires: catdoc +Requires: xlhtml +Requires(pre): shadow-utils + +# user "apache" is added to mnogosearch group so we need the user to be present +Requires(post): httpd + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: openssl-devel +BuildRequires: zlib-devel +BuildRequires: expat-devel +BuildRequires: openssl-devel +BuildRequires: openjade +BuildRequires: docbook-utils +BuildRequires: mysql-devel +BuildRequires: readline-devel +BuildRequires: ncurses-devel +BuildRequires: sqlite-devel +BuildRequires: unixODBC-devel +BuildRequires: postgresql-devel +BuildRequires: freetds-devel +BuildRequires: firebird-devel +BuildRequires: catdoc +BuildRequires: xlhtml + +# build is done with unit testing by default, but it can be disabled +# by --without tests to save time +%define with_tests %{?_without_tests: 0} %{?!_without_tests: 1} + +%description +mnoGoSearch (formerly known as UdmSearch) is a full-featured Web search engine +that you can use to build search engines over HTTP, HTTPS, FTP, and NTTP +servers, local files, and database big text fields. It supports Oracle, MS SQL +Server, MySQL, PostgreSQL, InterBase/Firebird, Openlink Virtuoso, Intersystems +Cach, iODBC, EasySoft ODBC, and unixODBC database backends. It has XML, HTML, +and TEXT built-in support, and external converters support for other document +types. An automatic language/charset guesser for more 70 language/charset +combinations is included, along with basic authorization support, and you may +index password-protected intranet HTTP servers with proxy authorization +support. + +mnoGoSearch is built with support for mysql (including fulltext extension), +sqlite, postgresql, firebird, unixODBC and freetds. + +%package libs +Summary: Libraries for %{name} +Group: System Environment/Libraries + +%description libs +This package contains the %{name} library files. + +%package devel +Summary: Development headers and libraries for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the %{name} development files. + +%package php +Summary: PHP-extension for %{name} +Group: Applications/Internet +Requires: %{name}-libs = %{version}-%{release} +BuildRequires: php-devel +BuildRequires: php-cli + +%if 0%{?php_zend_api} +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} +%else +Requires: php-api = %{php_apiver} +%endif + +%description php +This package contains the PHP extension for %{name} + +%prep +%setup -q -n mnogosearch-%{version} + +%build +autoreconf -fi + +%configure \ + --sysconfdir=%{_sysconfdir}/mnogosearch \ + --datadir=%{_datadir}/mnogosearch \ + --localstatedir=%{_localstatedir}/lib/mnogosearch \ + --includedir=%{_includedir}/mnogosearch \ + --enable-syslog \ + --enable-syslog=LOG_LOCAL6 \ + --enable-parser \ + --enable-mp3 \ + --enable-file \ + --enable-http \ + --enable-ftp \ + --enable-news \ + --with-openssl=%{_prefix} \ + --with-zlib \ + --with-readline \ + --with-extra-charsets=all \ + --with-mysql \ + --enable-mysql-fulltext-plugin \ + --with-pgsql \ + --with-sqlite3 \ + --with-unixODBC \ + --with-freetds=%{_prefix} \ + --with-ibase \ + --with-docs \ + --enable-fhs-layout + +make %{?_smp_mflags} + +%install +rm -rf %{buildroot} + +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT \ + doc_FILES='$(HTML_ALL)' + +# no need to call the config files *-dist +(cd %{buildroot}%{_sysconfdir}/%{name} +for f in *-dist ; do + mv -f $f `basename $f -dist` +done +) + +# fix header of config file +sed -i 's|/usr/local/mnogosearch/sbin/indexer|%{_bindir}/indexer|g' \ + %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf + +# change default configuration +sed -i 's|DBAddr.mysql://root@localhost/test/?dbmode=blob|DBAddr sqlite3://localhost/%{_localstatedir}/lib/mnogosearch/default.db/?dbmode=blob|g' \ + %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf \ + %{buildroot}%{_sysconfdir}/mnogosearch/search.htm \ + +sed -i 's|#LocalCharset UTF-8|LocalCharset UTF-8|g' \ + %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf + +sed -i 's|#Server http://localhost/|Server http://localhost/|g' \ + %{buildroot}%{_sysconfdir}/mnogosearch/indexer.conf + +# the cgi is no regular binary, move it to libexec +install -d %{buildroot}%{_libexecdir}/mnogosearch +mv -f %{buildroot}%{_bindir}/*.cgi %{buildroot}%{_libexecdir}/mnogosearch/ + +# the .la's confuse libtool when building the php lib and they should not +# be packaged at all, so remove them +rm -f %{buildroot}%{_libdir}/*.la + +install -m0755 %{SOURCE1} %{buildroot}%{_bindir}/ + +install -d %{buildroot}%{_sysconfdir}/cron.d/ +install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.d/mnogosearch + +install -d %{buildroot}%{_sysconfdir}/httpd/conf.d/ +install -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/httpd/conf.d/mnogosearch.conf + + +# --------------------- +# make & install php stuff +# must be in install-section because it needs an already installed mnogosearch +cd php + +/usr/bin/phpize +%configure --with-mnogosearch=%{buildroot}%{_prefix} + +# get rid of rpath +sed -i 's|-Wl,-rpath,[^ ]*||g' Makefile + +make %{?_smp_mflags} EXTRA_LDFLAGS="-L%{buildroot}%{_libdir}" EXTRA_CFLAGS="-I%{buildroot}%{_includedir}/mnogosearch" +make install \ + INSTALL_ROOT=$RPM_BUILD_ROOT +cd .. + +install -d %{buildroot}%{_sysconfdir}/php.d +cat >%{buildroot}%{_sysconfdir}/php.d/mnogosearch.ini </dev/null || groupadd -r mnogosearch +getent passwd mnogosearch >/dev/null || \ + useradd -r -g mnogosearch -d %{_localstatedir}/lib/mnogosearch \ + -c "User the indexer of the mnoGoSearch search engine is executed with" \ + -s /sbin/nologin mnogosearch +exit 0 + +%post +# the cgi (executed with the apache user) must be able to read the database: +# the apache user must be in the mnogosearch group +usermod -a -G mnogosearch apache || : + +# we brought our own apache config snippet and new group rights +service httpd condrestart > /dev/null 2>&1 || : + +# create default mnogosearch database (only during install) +if [ $1 -eq 1 ] ; then + /usr/bin/indexer --create >/dev/null + chown mnogosearch:mnogosearch %{_localstatedir}/lib/mnogosearch/default.db + # db must be group writeable to allow query tracking + chmod 0660 %{_localstatedir}/lib/mnogosearch/default.db +fi + +%postun +service httpd condrestart > /dev/null 2>&1 || : + +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%{_bindir}/indexer +%{_bindir}/mconv +%{_bindir}/mguesser +%{_bindir}/mnogosearch-reindex +%dir %{_libexecdir}/mnogosearch +%{_libexecdir}/mnogosearch/search.cgi +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cron.d/mnogosearch +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/mnogosearch.conf + +%defattr (0644,root,root,0755) +%doc ChangeLog README README.XML README.CVS TODO COPYING AUTHORS INSTALL NEWS FAQ html doc/samples +%{_mandir}/man?/* +%{_datadir}/mnogosearch + +# the config files of mnogosearch often contain database passwords -> should not be world readable +%defattr (0640,root,mnogosearch,0750) +%dir %{_sysconfdir}/mnogosearch + +# indexer.conf is executable: has a correct shebang to run the indexer with this configuration +%attr(0755,root,mnogosearch) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/indexer.conf +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/langmap.conf +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/stopwords.conf +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/search.htm +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/mnogosearch/node.xml + +# default dir for search databases should not be world-readable: +# the search engine could have indexed secret files +%attr (0750,mnogosearch,mnogosearch) %dir %{_localstatedir}/lib/mnogosearch + +%files libs +%defattr(-,root,root,-) +%{_libdir}/lib*-*.so + +%files devel +%defattr(-,root,root,-) +%{_bindir}/udm-config +%{_includedir}/mnogosearch +%{_libdir}/*.a +%{_libdir}/libmnogosearch.so +%{_libdir}/libmnogocharset.so + +%files php +%defattr(-,root,root,-) +%{_sysconfdir}/php.d/mnogosearch.ini +%{php_extdir} + +%changelog +* Thu Jan 27 2011 Gerd v. Egidy 3.3.11-1 +- mnogosearch 3.3.11 +- unit testing with two databases +- require catdoc and xlhtml for install and during build +- move make check into check-section + +* Thu Jan 27 2011 Gerd v. Egidy 3.3.10-7.20110127cvs +- new cvs version with fix for directory names +- fix commandline options in mnogosearch-reindex + +* Wed Jan 26 2011 Gerd v. Egidy 3.3.10-6.20110126cvs +- import new upstream fixes for issues found during packaging +- group writeable default.db +- reindex option improvements by Alexander Barkov +- only create db on install +- create databases not with sqlite, but with the --create option of indexer + +* Tue Jan 25 2011 Gerd v. Egidy 3.3.10-5.20110124cvs +- update cvs version to get lib64 fix +- don't package *.la files as per Fedora review policy +- filter php module from provides +- create mnogosearch user and group during installation +- tighten file permissions to protect passwords and data +- create default configuration suitable for Fedora + +* Fri Jan 21 2011 Gerd v. Egidy 3.3.10-4.20110121cvs +- don't rename udm-config anymore +- better differentiation between release and cvs snapshots +- don't use $RPM_BUILD_DIR anymore + +* Thu Jan 20 2011 Gerd v. Egidy 3.3.10-3.20110120cvs +- make use of the new fhs configure option +- move language files to /usr/share +- move cgi to /usr/libexec +- clean up unneeded stuff left over from Mandriva +- link firebird database +- run supplied unit tests after build + +* Mon Jan 17 2011 Gerd v. Egidy 3.3.10-2.20110117cvs +- use current CVS as there are/will be some patches making packaging more easy + +* Thu Jan 13 2011 Gerd v. Egidy 3.3.10-1 +- add building of the php module +- initial packaging for Fedora +- based on the Mandriva .spec by Oden Eriksson +