Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > 55c07d5226c68a041f75317a24a4f6cd > files > 3

couchdb-1.0.2-1.1.mga1.src.rpm

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

Name:           couchdb
Version:        1.0.2
Release:        %mkrel 1.1
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
Requires:	erlang-public_key

%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

* Thu Dec 29 2011 misc <misc> 1.0.2-1.1.mga1
+ Revision: 188794
- add Requires on erlang_public_key, fix #2196

* Sat Apr 16 2011 misc <misc> 1.0.2-1.mga1
+ Revision: 86162
- update to 1.0.2

* Sat Mar 26 2011 dmorgan <dmorgan> 1.0.1-2.mga1
+ Revision: 77595
- imported package couchdb