Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 5e403fa0177e951da8108a985d6f237c > files > 3

couchdb-0.11.0-3mdv2010.1.src.rpm

%define tarname apache-couchdb
%define couchdb_user couchdb
%define couchdb_group couchdb
%define couchdb_home %{_localstatedir}/lib/couchdb

Name:           couchdb
Version:        0.11.0
Release:        %mkrel 3
Summary:        A document database server, accessible via a RESTful JSON API

Group:          Databases
License:        Apache License
URL:            http://couchdb.apache.org/
Source0:        http://www.apache.org/dist/%{name}/%{version}/%{tarname}-%{version}.tar.gz
Source1:        %{name}.init

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:  erlang-devel erlang-compiler
BuildRequires:  libicu-devel 
BuildRequires:  js-devel 
BuildRequires:  help2man
BuildRequires:  curl-devel

Requires:       couchdb-bin
#Initscripts
Requires(post): chkconfig
Requires(preun): chkconfig initscripts

Requires(pre): shadow-utils


%description
Apache CouchDB is a distributed, fault-tolerant and schema-free 
document-oriented database accessible via a RESTful HTTP/JSON API. 
Among other features, it provides robust, incremental replication 
with bi-directional conflict detection and resolution, and is 
queryable and indexable using a table-oriented view engine with 
JavaScript acting as the default view definition language.

This package contains the initscript needed to start a systemwide instance
of CouchDB.

%package bin
Group: Databases
Summary: Binary for Couchdb, a document database server

Requires:   erlang 
Requires:	erlang-crypto
Requires:	erlang-ssl
Requires:	erlang-xmerl
Requires:	erlang-inets
Requires:	erlang-tools


%description bin
Apache CouchDB is a distributed, fault-tolerant and schema-free 
document-oriented database accessible via a RESTful HTTP/JSON API. 
Among other features, it provides robust, incremental replication 
with bi-directional conflict detection and resolution, and is 
queryable and indexable using a table-oriented view engine with 
JavaScript acting as the default view definition language.

This package contains the binary needed to run a CouchDB instance.

%prep
%setup -q -n %{tarname}-%{version}

%build
%configure2_5x  \
    --with-js-include=$(pkg-config --cflags libjs | sed 's/-I//') \
    --with-erlang=%_libdir/erlang%_includedir 

# build seems to fail on klodia, with make -j16
# (no error logger present) error: "Failed to create 16 scheduler-threads(no er (eagain:11); ror logger present) 
# error: "Failed to creaonly 15 scheduler-threads te 16 scheduler-twhreerae dcs (eagain:11); on(rno erealy 1ror 
# logger present) teed.\n"
# 3 scheduler-threads rror: "Failed to create 16were created.\n"
make 

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

## Install couchdb initscript
install -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/%{name}

# Create /var/log/couchdb
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}

# Create /var/run/couchdb
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}

# Create /var/lib/couchdb
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}

# Create /etc/couchdb/default.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/default.d

# Create /etc/couchdb/local.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/local.d

## Use /etc/sysconfig instead of /etc/default
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mv $RPM_BUILD_ROOT%{_sysconfdir}/default/couchdb \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/default

# Remove unecessary files
rm $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/couchdb
rm -rf  $RPM_BUILD_ROOT%{_datadir}/doc/couchdb

# clean-up .la archives
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'


%clean
rm -rf $RPM_BUILD_ROOT


%pre bin
%_pre_useradd %{couchdb_user}  %{couchdb_home} /bin/bash 

%post
%_post_service %{name}

%postun bin
%_postun_userdel %{couchdb_user}

%preun 
%_preun_service %{name}

%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS CHANGES LICENSE NEWS NOTICE README THANKS
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_initrddir}/%{name}

%files bin
%defattr(-,root,root,-)
%{_bindir}/*
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/local.d
%dir %{_sysconfdir}/%{name}/default.d
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/default.ini
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/local.ini
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man1/*
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/log/%{name}
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/run/%{name}
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/lib/%{name}




%changelog
* Mon Apr 19 2010 Frederik Himpe <fhimpe@mandriva.org> 0.11.0-3mdv2010.1
+ Revision: 536791
- Fix mix-up of different rpm scripts

* Sat Apr 17 2010 Frederik Himpe <fhimpe@mandriva.org> 0.11.0-2mdv2010.1
+ Revision: 536039
- Move user creation to bin subpackage (fixes bug #58683:
  installs files as unexisting user couchdb)

* Fri Apr 16 2010 Frederik Himpe <fhimpe@mandriva.org> 0.11.0-1mdv2010.1
+ Revision: 535632
- Update to new version 0.11.0 (fixes CVE-2010-0009)
- Remove icu-config patch: no longer needed

* Wed Apr 07 2010 Michael Scherer <misc@mandriva.org> 0.10.1-5mdv2010.1
+ Revision: 532835
- place requirement on couchdb-bin subpackages

* Sun Mar 21 2010 Funda Wang <fwang@mandriva.org> 0.10.1-4mdv2010.1
+ Revision: 526061
- fix includedir
- rebuild for new icu

* Sun Feb 14 2010 Frederik Himpe <fhimpe@mandriva.org> 0.10.1-3mdv2010.1
+ Revision: 505918
- Some more Requires (via Debian)
- Fix Requires
- Don't depend on icu-config (Debian patch)

* Thu Feb 11 2010 Michael Scherer <misc@mandriva.org> 0.10.1-2mdv2010.1
+ Revision: 504017
- split couchdb binary in another rpm, so desktopcouch do not autostart the server

* Thu Dec 10 2009 Eugeni Dodonov <eugeni@mandriva.com> 0.10.1-1mdv2010.1
+ Revision: 476022
- Updated to 0.10.1

* Tue Nov 10 2009 Michael Scherer <misc@mandriva.org> 0.10.0-1mdv2010.1
+ Revision: 463885
- disable parralel build, as it seems there is some trouble on klodia
- fix BuildRequires, as erlang compiler is not in erlang-devel
- import couchdb, based on Fedora specfile