comparison Kibana.spec @ 27:76544ad0561d

switch kibana to ruby gem rather than jruby
author Carl Byington <carl@five-ten-sg.com>
date Mon, 06 May 2013 23:31:24 -0700
parents 610835fb4209
children
comparison
equal deleted inserted replaced
26:610835fb4209 27:76544ad0561d
1 # prevent brp repack jar files 1 # prevent brp repack jar files
2 %define __os_install_post %{nil} 2 %define __os_install_post %{nil}
3 3
4 %global commit df8ae2344433e5072a8dfe77082acfd1c9b6ed62 4 %global commit df8ae2344433e5072a8dfe77082acfd1c9b6ed62
5 %global shortcommit %(c=%{commit}; echo ${c:0:8}) 5 %global shortcommit %(c=%{commit}; echo ${c:0:8})
6 %global name2 kibana 6 %global name2 kibana
7 %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
8 %global gem_name kibana
9 %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}
7 10
8 Name: Kibana 11 Name: Kibana
9 Version: 0.2.0 12 Version: 0.2.0
10 Release: 0%{?dist} 13 Release: 1%{?dist}
11 Summary: Kibana is a user friendly way to view, search and visualize your log data 14 Summary: Kibana is a user friendly way to view, search and visualize your log data
12 15
13 Group: System Environment/Daemons 16 Group: System Environment/Daemons
14 License: MIT 17 License: MIT
15 URL: http://kibana.org/ 18 URL: http://kibana.org/
16 BuildArch: noarch 19 BuildArch: noarch
17 Source0: https://nodeload.github.com/rashidkpc/Kibana/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz 20 Source0: https://nodeload.github.com/rashidkpc/Kibana/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
18 Source1: Kibana-external-config-patch 21 Source1: Kibana-external-config-patch
22 Source2: Kibana-no-git-patch
19 Source10: %{name}.rc 23 Source10: %{name}.rc
20 Source13: %{name}.sysconfig 24 Source13: %{name}.sysconfig
21 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) 25 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
22 Autoreq: 0 26 Autoreq: 0
23 27
24 BuildRequires: jruby java-devel 28 BuildRequires: ruby
29 BuildRequires: ruby-devel
30 BuildRequires: rubygems
31 Provides: rubygem(%{gem_name}) = %{version}
25 32
26 Requires: jruby java-devel elasticsearch logstash 33 Requires: ruby
34 Requires: rubygems
35 Requires: rubygem(sinatra)
36 Requires: rubygem(json)
37 Requires: rubygem(fastercsv)
38 Requires: rubygem(daemons)
39 Requires: rubygem(tzinfo)
40 Requires: rubygem(thin)
41 Requires: elasticsearch logstash
27 Requires(pre): /usr/sbin/useradd 42 Requires(pre): /usr/sbin/useradd
28 Requires(pre): /usr/bin/getent 43 Requires(pre): /usr/bin/getent
29 Requires(postun): /usr/sbin/userdel 44 Requires(postun): /usr/sbin/userdel
30 Requires(post,preun): /sbin/chkconfig 45 Requires(post,preun): /sbin/chkconfig
31 Requires(post,preun): /sbin/service 46 Requires(post,preun): /sbin/service
37 52
38 53
39 %prep 54 %prep
40 %setup -qn %{name}-%{commit} 55 %setup -qn %{name}-%{commit}
41 patch <%SOURCE1 56 patch <%SOURCE1
57 patch <%SOURCE2
42 58
43 59
44 %build 60 %build
45 if [ "$(which jruby)" == '' ]; then 61 mkdir -p ./%{gem_dir}
46 JRUBY_CMD="java -jar /usr/share/jruby.jar" 62 gem build %{gem_name}.gemspec
47 else 63 gem install --local --install-dir ./%{gem_dir} -V --force --no-rdoc --no-ri %{gem_name}-%{version}.gem
48 JRUBY_CMD="jruby"
49 fi
50 export GEM_HOME=$(pwd)
51 export GEM_PATH=
52 $JRUBY_CMD -S gem install bundler
53 $JRUBY_CMD bin/bundle install
54 rm -rf gems/*/test
55 rm -rf gems/*/spec
56 rm -rf gems/*/examples
57 rm -rf sample spec
58 64
59 65
60 %install 66 %install
61 rm -rf $RPM_BUILD_ROOT 67 rm -rf $RPM_BUILD_ROOT
62 install -d $RPM_BUILD_ROOT/var/log/%{name} 68 mkdir -p $RPM_BUILD_ROOT/%{gem_dir}
63 install -d $RPM_BUILD_ROOT/%{_javadir}/%{name} 69 mkdir -p $RPM_BUILD_ROOT/%{_prefix}
64 cp -a * $RPM_BUILD_ROOT/%{_javadir}/%{name} 70 cp -pa ./%{gem_dir}/* $RPM_BUILD_ROOT/%{gem_dir}
65 install -D -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} 71 mv -f $RPM_BUILD_ROOT/%{gem_dir}/bin $RPM_BUILD_ROOT/%{_prefix}
66 install -D -m 640 %SOURCE13 $RPM_BUILD_ROOT/etc/sysconfig/%{name} 72 install -d $RPM_BUILD_ROOT/var/log/%{name}
73 install -D -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
74 install -D -m 640 %SOURCE13 $RPM_BUILD_ROOT/etc/sysconfig/%{name}
75 mv -f %{name}Config.rb $RPM_BUILD_ROOT/etc/sysconfig/%{name}Config.rb
67 76
68 77
69 %pre 78 %pre
70 /usr/bin/getent passwd %{name2} >/dev/null || /usr/sbin/useradd -r -c "%{name} pseudo-user" %{name2} >/dev/null 79 /usr/bin/getent passwd %{name2} >/dev/null || /usr/sbin/useradd -r -m -c "%{name} pseudo-user" %{name2} >/dev/null
71 80
72 81
73 %post 82 %post
74 /sbin/chkconfig --add %{name} 83 /sbin/chkconfig --add %{name}
75 84
86 %clean 95 %clean
87 rm -rf $RPM_BUILD_ROOT 96 rm -rf $RPM_BUILD_ROOT
88 97
89 98
90 %files 99 %files
91 %defattr(-,root,root,-) 100 %defattr(-, root, root, -)
92 %attr(0750,%{name2},root) %{_javadir}/* 101 %{_bindir}/%{gem_name}
102 %{gem_dir}/cache/%{gem_name}-%{version}.gem
103 %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec
104 %{gem_instdir}
93 %config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name} 105 %config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name}
106 %config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name}Config.rb
94 %dir %attr(0750,%{name2},root) /var/log/%{name} 107 %dir %attr(0750,%{name2},root) /var/log/%{name}
95 /etc/rc.d/init.d/%{name} 108 /etc/rc.d/init.d/%{name}
96 109
97 110
111 %changelog
112 * Mon May 06 2013 <carl@five-ten-sg.com> - 0.2.0-1
113 - switch to building standard ruby gem, avoid jruby
98 114
99 %changelog
100 * Fri Apr 25 2013 <carl@five-ten-sg.com> - 0.2.0-0 115 * Fri Apr 25 2013 <carl@five-ten-sg.com> - 0.2.0-0
101 - Initial build. 116 - Initial build.
102 117