aboutsummaryrefslogtreecommitdiff
path: root/bigtop-packages/src/rpm/ignite-hadoop/SPECS/ignite-hadoop.spec
blob: b360b0a58ecada7d8f3ad1442aad8bc45dad094c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
%define etc_ignite_conf %{_sysconfdir}/%{name}/conf
%define etc_ignite_conf_dist %{etc_ignite_conf}.dist
%define ignite_home /usr/lib/%{name}
%define bin_ignite %{ignite_home}/bin
%define lib_ignite %{ignite_home}/lib
%define conf_ignite %{ignite_home}/config
%define logs_ignite %{ignite_home}/logs
%define pids_ignite %{ignite_home}/pids
%define man_dir %{_mandir}
%define ignite_username ignite
%define service_name %{name}-service
%define vcs_tag %{ignite_hadoop_version}

%if  %{?suse_version:1}0

# Only tested on openSUSE 11.4. le'ts update it for previous release when confirmed
%if 0%{suse_version} > 1130
%define suse_check \# Define an empty suse_check for compatibility with older sles
%endif

# SLES is more strict anc check all symlinks point to valid path
# But we do point to a hadoop jar which is not there at build time
# (but would be at install time).
# Since our package build system does not handle dependencies,
# these symlink checks are deactivated
%define __os_install_post \
    %{suse_check} ; \
    /usr/lib/rpm/brp-compress ; \
    %{nil}

%define doc_ignite %{_docdir}/%{name}
%global initd_dir %{_sysconfdir}/rc.d
%define alternatives_cmd update-alternatives

%else

# CentOS 5 does not have any dist macro
# So I will suppose anything that is not Mageia or a SUSE will be a RHEL/CentOS/Fedora
%if %{!?mgaversion:1}0

# FIXME: brp-repack-jars uses unzip to expand jar files
# Unfortunately guice-2.0.jar pulled by ivy contains some files and directories without any read permission
# and make whole process to fail.
# So for now brp-repack-jars is being deactivated until this is fixed.
# See BIGTOP-294
#%define __os_install_post \
#    %{_rpmconfigdir}/brp-compress ; \
#    %{_rpmconfigdir}/brp-strip-static-archive %{__strip} ; \
#   %{_rpmconfigdir}/brp-strip-comment-note %{__strip} %{__objdump} ; \
#   /usr/lib/rpm/brp-python-bytecompile ; \
#   %{nil}
%endif

%define doc_ignite %{_docdir}/%{name}-%{ignite_hadoop_version}
%global initd_dir %{_sysconfdir}/rc.d/init.d
%define alternatives_cmd alternatives

%endif


Name: ignite-hadoop
Version: %{ignite_hadoop_version}
Release: %{ignite_hadoop_release}
Summary: Ignite Hadoop accelerator. The system provides for in-memory caching of HDFS data and MR performance improvements
URL: http://ignite.apache.org/
Group: Development/Libraries
Buildroot: %{_topdir}/INSTALL/%{name}-%{version}
License: APL2
Source0: ignite-hadoop-%{ignite_hadoop_base_version}.tar.gz
Source1: do-component-build
Source2: install_ignite.sh
Source3: ignite-hadoop.svc
Source4: init.d.tmpl
Source5: ignite-hadoop.default
BuildArch: noarch
## This package _explicitly_ turns off the auto-discovery of required dependencies
## to work around OSGI corner case, added to RPM lately. See BIGTOP-2421 for more info.
Requires: coreutils, /usr/sbin/useradd, /sbin/chkconfig, /sbin/service
Requires: hadoop-hdfs, hadoop-mapreduce, bigtop-utils >= 0.7
AutoReq: no

%if  0%{?mgaversion}
Requires: bsh-utils
%else
Requires: sh-utils
%endif

%description
Ignite is an open-source, distributed, in-memory computation platform

    * HDFS caching and MR performance booster

%package service
Summary: Hadoop Accelerator platform
Group: System/Daemons
Requires: %{name} = %{version}-%{release}
Requires(pre): %{name} = %{version}-%{release}

%if  %{?suse_version:1}0
# Required for init scripts
Requires: insserv
%endif

%if  0%{?mgaversion}
# Required for init scripts
Requires: initscripts
%endif

# CentOS 5 does not have any dist macro
# So I will suppose anything that is not Mageia or a SUSE will be a RHEL/CentOS/Fedora
%if %{!?suse_version:1}0 && %{!?mgaversion:1}0
# Required for init scripts
Requires: redhat-lsb
%endif

%description service
Ignite Hadoop accelerator package

%package doc
Summary: Ignite Documentation
Group: Documentation
BuildArch: noarch

%description doc
Documentation for Ignite platform

%prep
%setup -n ignite-hadoop-%{vcs_tag}

%build
bash %{SOURCE1}

%install
%__rm -rf $RPM_BUILD_ROOT
env IGNITE_HADOOP_VERSION=%{version} bash %{SOURCE2} \
  --build-dir=target/bin \
  --doc-dir=%{doc_ignite} \
  --conf-dir=%{etc_ignite_conf_dist} \
	--prefix=$RPM_BUILD_ROOT

%__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir}/

%__install -d -m 0755 $RPM_BUILD_ROOT/etc/default/
%__install -m 0644 %{SOURCE5} $RPM_BUILD_ROOT/etc/default/%{name}

%__install -d  -m 0755  %{buildroot}/%{_localstatedir}/log/%{name}

ln -s %{_localstatedir}/log/%{name} %{buildroot}/%{logs_ignite}

%__install -d  -m 0755  %{buildroot}/%{_localstatedir}/run/%{name}
ln -s %{_localstatedir}/run/%{name} %{buildroot}/%{pids_ignite}

init_file=$RPM_BUILD_ROOT/%{initd_dir}/%{service_name}
bash %{SOURCE4} ${RPM_SOURCE_DIR}/ignite-hadoop.svc rpm $init_file
chmod 755 $init_file

%__install -d -m 0755 $RPM_BUILD_ROOT/usr/bin

# Pull hadoop from their packages
rm -f $RPM_BUILD_ROOT/%{lib_ignite}/libs/{hadoop}*.jar

%pre
getent group ignite 2>/dev/null >/dev/null || /usr/sbin/groupadd -r ignite
getent passwd ignite 2>&1 > /dev/null || /usr/sbin/useradd -c "ignite" -s /sbin/nologin -g ignite -r -d /var/run/ignite ignite 2> /dev/null || :

%post
%{alternatives_cmd} --install %{etc_ignite_conf} %{name}-conf %{etc_ignite_conf_dist} 30

%preun
if [ "$1" = 0 ]; then
        %{alternatives_cmd} --remove %{name}-conf %{etc_ignite_conf_dist} || :
fi

#######################
#### FILES SECTION ####
#######################
%files
%defattr(-,ignite,ignite)
%dir %{_localstatedir}/log/%{name}
%dir %{_localstatedir}/run/%{name}

%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/default/%{name}
%{ignite_home}
/usr/bin/%{name}
%config(noreplace) %{etc_ignite_conf_dist}

%files doc
%defattr(-,root,root)
%doc %{doc_ignite}/

%define service_macro() \
%files %1 \
%attr(0755,root,root)/%{initd_dir}/%{service_name} \
%post %1 \
chkconfig --add %{service_name} \
\
%preun %1 \
if [ $1 = 0 ] ; then \
        service %{service_name} stop > /dev/null 2>&1 \
        chkconfig --del %{service_name} \
fi \
%postun %1 \
if [ $1 -ge 1 ]; then \
        service %{service_name} condrestart >/dev/null 2>&1 \
fi
%service_macro service