view Kibana.spec @ 29:b37cde5bac95

switch kibana to ruby gem rather than jruby
author Carl Byington <carl@five-ten-sg.com>
date Tue, 07 May 2013 11:03:17 -0700
parents 76544ad0561d
children
line wrap: on
line source

# prevent brp repack jar files
%define __os_install_post %{nil}

%global commit df8ae2344433e5072a8dfe77082acfd1c9b6ed62
%global shortcommit %(c=%{commit}; echo ${c:0:8})
%global name2    kibana
%global gem_dir  %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global gem_name kibana
%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}

Name:           Kibana
Version:        0.2.0
Release:        1%{?dist}
Summary:        Kibana is a user friendly way to view, search and visualize your log data

Group:          System Environment/Daemons
License:        MIT
URL:            http://kibana.org/
BuildArch:      noarch
Source0:        https://nodeload.github.com/rashidkpc/Kibana/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
Source1:        Kibana-external-config-patch
Source2:        Kibana-no-git-patch
Source10:       %{name}.rc
Source13:       %{name}.sysconfig
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Autoreq:        0

BuildRequires: ruby
BuildRequires: ruby-devel
BuildRequires: rubygems
Provides: rubygem(%{gem_name}) = %{version}

Requires: ruby
Requires: rubygems
Requires: rubygem(sinatra)
Requires: rubygem(json)
Requires: rubygem(fastercsv)
Requires: rubygem(daemons)
Requires: rubygem(tzinfo)
Requires: rubygem(thin)
Requires: elasticsearch logstash
Requires(pre):          /usr/sbin/useradd
Requires(pre):          /usr/bin/getent
Requires(postun):       /usr/sbin/userdel
Requires(post,preun):   /sbin/chkconfig
Requires(post,preun):   /sbin/service

%description
Kibana is a highly scalable interface for Logstash and ElasticSearch
that allows you to efficiently search, graph, analyze and otherwise
make sense of a mountain of logs.


%prep
%setup -qn %{name}-%{commit}
patch <%SOURCE1
patch <%SOURCE2


%build
mkdir -p ./%{gem_dir}
gem build %{gem_name}.gemspec
gem install --local --install-dir ./%{gem_dir} -V --force --no-rdoc --no-ri %{gem_name}-%{version}.gem


%install
rm -rf                                  $RPM_BUILD_ROOT
mkdir -p                                $RPM_BUILD_ROOT/%{gem_dir}
mkdir -p                                $RPM_BUILD_ROOT/%{_prefix}
cp -pa ./%{gem_dir}/*                   $RPM_BUILD_ROOT/%{gem_dir}
mv -f $RPM_BUILD_ROOT/%{gem_dir}/bin    $RPM_BUILD_ROOT/%{_prefix}
install -d                              $RPM_BUILD_ROOT/var/log/%{name}
install -D -m 755 %SOURCE10             $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install -D -m 640 %SOURCE13             $RPM_BUILD_ROOT/etc/sysconfig/%{name}
mv -f %{name}Config.rb                  $RPM_BUILD_ROOT/etc/sysconfig/%{name}Config.rb


%pre
/usr/bin/getent passwd %{name2} >/dev/null || /usr/sbin/useradd -r -m -c "%{name} pseudo-user" %{name2} >/dev/null


%post
/sbin/chkconfig --add %{name}


%preun
[ $1 = 0 ] && /sbin/service %{name} stop    || :
[ $1 = 0 ] && /sbin/chkconfig --del %{name} || :


%postun
[ $1 = 0 ] && userdel %{name2} || :


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-, root, root, -)
%{_bindir}/%{gem_name}
%{gem_dir}/cache/%{gem_name}-%{version}.gem
%{gem_dir}/specifications/%{gem_name}-%{version}.gemspec
%{gem_instdir}
%config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name}
%config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name}Config.rb
%dir %attr(0750,%{name2},root) /var/log/%{name}
/etc/rc.d/init.d/%{name}


%changelog
* Mon May 06 2013  <carl@five-ten-sg.com> - 0.2.0-1
- switch to building standard ruby gem, avoid jruby

* Fri Apr 25 2013  <carl@five-ten-sg.com> - 0.2.0-0
- Initial build.