日本OpenSolaris Users Group有志による、レポジトリサーバ作成のためのspecファイル群です。
Revision | 10167c752ee9c1c31b40da0f4d3b7010243f2c11 (tree) |
---|---|
Time | 2015-12-08 01:46:47 |
Author | Fumihisa TONAKA <fumi.ftnk@gmai...> |
Commiter | Fumihisa TONAKA |
SFEruby-net-sftp: bump to 2.1.2 and build packge for ruby-22 and ruby-23
@@ -1,121 +1,344 @@ | ||
1 | 1 | %include Solaris.inc |
2 | 2 | %include default-depend.inc |
3 | 3 | |
4 | -%define gemname net-sftp | |
5 | - | |
6 | -%define bindir19 /usr/ruby/1.9/bin | |
7 | -%define gemdir19 %(%{bindir19}/ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) | |
8 | -%define geminstdir19 %{gemdir19}/gems/%{gemname}-%{version} | |
9 | - | |
10 | -%define bindir20 /usr/ruby/2.0/bin | |
11 | -%define gemdir20 %(%{bindir20}/ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) | |
12 | -%define geminstdir20 %{gemdir20}/gems/%{gemname}-%{version} | |
4 | +%define build19 %( if [ -x /usr/ruby/1.9/bin/ruby ]; then echo '1'; else echo '0'; fi) | |
5 | +%define build20 %( if [ -x /usr/ruby/2.0/bin/ruby ]; then echo '1'; else echo '0'; fi) | |
6 | +%define build21 %( if [ -x /usr/ruby/2.1/bin/ruby ]; then echo '1'; else echo '0'; fi) | |
7 | +%define build22 %( if [ -x /usr/ruby/2.2/bin/ruby ]; then echo '1'; else echo '0'; fi) | |
8 | +%define build23 %( if [ -x /usr/ruby/2.3/bin/ruby ]; then echo '1'; else echo '0'; fi) | |
9 | +%define generate_executable 0 | |
10 | +%define keep_dependency 1 | |
13 | 11 | |
14 | -%define bindir21 /usr/ruby/2.1/bin | |
15 | -%define gemdir21 %(%{bindir21}/ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) | |
16 | -%define geminstdir21 %{gemdir21}/gems/%{gemname}-%{version} | |
12 | +%define gemname net-sftp | |
13 | +%define sfe_gemname net-sftp | |
17 | 14 | |
18 | -Summary: A pure Ruby implementation of the SFTP client protocol | |
19 | -Name: SFEruby-%{gemname} | |
20 | -IPS_package_name: library/ruby-21/net-sftp | |
21 | -Version: 2.1.1 | |
22 | -License: MIT License | |
23 | -URL: http://rubygems.org/gems/%{gemname} | |
24 | -Source0: http://rubygems.org/downloads/%{gemname}-%{version}.gem | |
25 | -BuildRoot: %{_tmppath}/%{name}-%{version}-build | |
15 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
16 | +Name: SFEruby-%{sfe_gemname} | |
17 | +IPS_package_name: library/ruby/%{gemname} | |
18 | +Version: 2.1.2 | |
19 | +License: MIT | |
20 | +URL: https://github.com/net-ssh/net-sftp | |
21 | +Source0: http://rubygems.org/downloads/%{gemname}-%{version}.gem | |
22 | +BuildRoot: %{_tmppath}/%{name}-%{version}-build | |
26 | 23 | |
27 | -BuildRequires: runtime/ruby-21 | |
28 | -Requires: runtime/ruby-21 = * | |
29 | -Requires: library/ruby-21/net-ssh | |
24 | + | |
30 | 25 | |
31 | 26 | %description |
32 | 27 | A pure Ruby implementation of the SFTP client protocol |
33 | 28 | |
29 | +%if %{build19} | |
30 | +%if %{keep_dependency} | |
31 | +%package 19-old | |
32 | +IPS_package_name: library/ruby-19/%{gemname} | |
33 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
34 | +BuildRequires: runtime/ruby-19 = * | |
35 | +Requires: runtime/ruby-19 = * | |
36 | +Requires: library/ruby/%{gemname}-19 | |
37 | + | |
38 | +%description 19-old | |
39 | +A pure Ruby implementation of the SFTP client protocol | |
40 | +%endif | |
41 | + | |
34 | 42 | %package 19 |
35 | -IPS_package_name: library/ruby-19/net-sftp | |
36 | -Summary: A pure Ruby implementation of the SFTP client protocol | |
37 | -BuildRequires: runtime/ruby-19 | |
38 | -Requires: runtime/ruby-19 = * | |
39 | -Requires: library/ruby-19/net-ssh | |
43 | +IPS_package_name: library/ruby/%{gemname}-19 | |
44 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
45 | +BuildRequires: runtime/ruby-19 = * | |
46 | +Requires: runtime/ruby-19 = * | |
47 | +# net-ssh >= 2.6.5 | |
48 | +Requires: library/ruby/net-ssh-19 | |
49 | +Requires: library/ruby/%{gemname} | |
40 | 50 | |
41 | 51 | %description 19 |
42 | 52 | A pure Ruby implementation of the SFTP client protocol |
53 | +%endif | |
54 | + | |
55 | +%if %{build20} | |
56 | +%if %{keep_dependency} | |
57 | +%package 20-old | |
58 | +IPS_package_name: library/ruby-20/%{gemname} | |
59 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
60 | +BuildRequires: runtime/ruby-20 = * | |
61 | +Requires: runtime/ruby-20 = * | |
62 | +Requires: library/ruby/%{gemname}-20 | |
63 | + | |
64 | +%description 20-old | |
65 | +A pure Ruby implementation of the SFTP client protocol | |
66 | +%endif | |
43 | 67 | |
44 | 68 | %package 20 |
45 | -IPS_package_name: library/ruby-20/net-sftp | |
46 | -Summary: A pure Ruby implementation of the SFTP client protocol | |
47 | -BuildRequires: runtime/ruby-20 | |
48 | -Requires: runtime/ruby-20 = * | |
49 | -Requires: library/ruby-20/net-ssh | |
69 | +IPS_package_name: library/ruby/%{gemname}-20 | |
70 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
71 | +BuildRequires: runtime/ruby-20 = * | |
72 | +Requires: runtime/ruby-20 = * | |
73 | +# net-ssh >= 2.6.5 | |
74 | +Requires: library/ruby/net-ssh-20 | |
75 | +Requires: library/ruby/%{gemname} | |
50 | 76 | |
51 | 77 | %description 20 |
52 | 78 | A pure Ruby implementation of the SFTP client protocol |
79 | +%endif | |
80 | + | |
81 | +%if %{build21} | |
82 | +%if %{keep_dependency} | |
83 | +%package 21-old | |
84 | +IPS_package_name: library/ruby-21/%{gemname} | |
85 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
86 | +BuildRequires: runtime/ruby-21 = * | |
87 | +Requires: runtime/ruby-21 = * | |
88 | +Requires: library/ruby/%{gemname}-21 | |
89 | + | |
90 | +%description 21-old | |
91 | +A pure Ruby implementation of the SFTP client protocol | |
92 | +%endif | |
93 | + | |
94 | +%package 21 | |
95 | +IPS_package_name: library/ruby/%{gemname}-21 | |
96 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
97 | +BuildRequires: runtime/ruby-21 = * | |
98 | +Requires: runtime/ruby-21 = * | |
99 | +# net-ssh >= 2.6.5 | |
100 | +Requires: library/ruby/net-ssh-21 | |
101 | +Requires: library/ruby/%{gemname} | |
102 | + | |
103 | +%description 21 | |
104 | +A pure Ruby implementation of the SFTP client protocol | |
105 | +%endif | |
106 | + | |
107 | +%if %{build22} | |
108 | +%if %{keep_dependency} | |
109 | +%package 22-old | |
110 | +IPS_package_name: library/ruby-22/%{gemname} | |
111 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
112 | +BuildRequires: runtime/ruby-22 = * | |
113 | +Requires: runtime/ruby-22 = * | |
114 | +Requires: library/ruby/%{gemname}-22 | |
115 | + | |
116 | +%description 22-old | |
117 | +A pure Ruby implementation of the SFTP client protocol | |
118 | +%endif | |
119 | + | |
120 | +%package 22 | |
121 | +IPS_package_name: library/ruby/%{gemname}-22 | |
122 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
123 | +BuildRequires: runtime/ruby-22 = * | |
124 | +Requires: runtime/ruby-22 = * | |
125 | +# net-ssh >= 2.6.5 | |
126 | +Requires: library/ruby/net-ssh-22 | |
127 | +Requires: library/ruby/%{gemname} | |
128 | + | |
129 | +%description 22 | |
130 | +A pure Ruby implementation of the SFTP client protocol | |
131 | +%endif | |
132 | + | |
133 | +%if %{build23} | |
134 | +%if %{keep_dependency} | |
135 | +%package 23-old | |
136 | +IPS_package_name: library/ruby-23/%{gemname} | |
137 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
138 | +BuildRequires: runtime/ruby-23 = * | |
139 | +Requires: runtime/ruby-23 = * | |
140 | +# net-ssh >= 2.6.5 | |
141 | +Requires: library/ruby/net-ssh-23 | |
142 | +Requires: library/ruby/%{gemname}-23 | |
143 | + | |
144 | +%description 23-old | |
145 | +A pure Ruby implementation of the SFTP client protocol | |
146 | +%endif | |
147 | + | |
148 | +%package 23 | |
149 | +IPS_package_name: library/ruby/%{gemname}-23 | |
150 | +Summary: A pure Ruby implementation of the SFTP client protocol | |
151 | +BuildRequires: runtime/ruby-23 = * | |
152 | +Requires: runtime/ruby-23 = * | |
153 | +# net-ssh >= 2.6.5 | |
154 | +Requires: library/ruby/net-ssh-23 | |
155 | + | |
156 | +%description 23 | |
157 | +A pure Ruby implementation of the SFTP client protocol | |
158 | +%endif | |
53 | 159 | |
54 | 160 | %prep |
55 | 161 | %setup -q -c -T |
56 | 162 | |
57 | 163 | %build |
164 | +build_for() { | |
165 | + ruby_ver=$1 | |
166 | + bindir="/usr/ruby/${ruby_ver}/bin" | |
167 | + gemdir="$(${bindir}/ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)" | |
168 | + geminstdir="${gemdir}/gems/%{gemname}-%{version}" | |
169 | + | |
170 | + ${bindir}/gem install --local \ | |
171 | + --no-env-shebang \ | |
172 | + --install-dir .${gemdir} \ | |
173 | + --bindir .${bindir} \ | |
174 | + --no-ri \ | |
175 | + --no-rdoc \ | |
176 | + -V \ | |
177 | + --force %{SOURCE0} | |
178 | +} | |
179 | + | |
180 | +%if %{build19} | |
58 | 181 | # ruby-19 |
59 | -%{bindir19}/gem install --local \ | |
60 | - --install-dir .%{gemdir19} \ | |
61 | - --bindir .%{bindir19} \ | |
62 | - -V \ | |
63 | - --force %{SOURCE0} | |
182 | +build_for 1.9 | |
183 | +%endif | |
64 | 184 | |
185 | +%if %{build20} | |
65 | 186 | # ruby-20 |
66 | -%{bindir20}/gem install --local \ | |
67 | - --install-dir .%{gemdir20} \ | |
68 | - --bindir .%{bindir20} \ | |
69 | - -V \ | |
70 | - --force %{SOURCE0} | |
187 | +build_for 2.0 | |
188 | +%endif | |
71 | 189 | |
190 | +%if %{build21} | |
72 | 191 | # ruby-21 |
73 | -%{bindir21}/gem install --local \ | |
74 | - --install-dir .%{gemdir21} \ | |
75 | - --bindir .%{bindir21} \ | |
76 | - -V \ | |
77 | - --force %{SOURCE0} | |
192 | +build_for 2.1 | |
193 | +%endif | |
194 | + | |
195 | +%if %{build22} | |
196 | +# ruby-22 | |
197 | +build_for 2.2 | |
198 | +%endif | |
199 | + | |
200 | +%if %{build23} | |
201 | +# ruby-23 | |
202 | +build_for 2.3 | |
203 | +%endif | |
78 | 204 | |
79 | 205 | %install |
80 | 206 | rm -rf %{buildroot} |
81 | 207 | |
82 | -# ruby-19 | |
83 | -mkdir -p %{buildroot}/%{gemdir19} | |
84 | -cp -a .%{gemdir19}/* \ | |
85 | - %{buildroot}/%{gemdir19}/ | |
208 | +%if %{generate_executable} | |
209 | +mkdir -p %{buildroot}/%{_bindir} | |
210 | +%endif | |
86 | 211 | |
87 | -# ruby-20 | |
88 | -mkdir -p %{buildroot}/%{gemdir20} | |
89 | -cp -a .%{gemdir20}/* \ | |
90 | - %{buildroot}/%{gemdir20}/ | |
212 | +install_for() { | |
213 | + ruby_ver=$1 | |
214 | + bindir="/usr/ruby/${ruby_ver}/bin" | |
215 | + gemdir="$(${bindir}/ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)" | |
216 | + geminstdir="${gemdir}/gems/%{gemname}-%{version}" | |
91 | 217 | |
218 | + mkdir -p %{buildroot}/usr/ruby/${ruby_ver} | |
219 | + cp -a ./usr/ruby/${ruby_ver}/* \ | |
220 | + %{buildroot}/usr/ruby/${ruby_ver}/ | |
221 | + | |
222 | + for dir in %{buildroot}${geminstdir}/bin %{buildroot}%{_bindir} | |
223 | + do | |
224 | + if [ -d ${dir} ] | |
225 | + then | |
226 | + pushd ${dir} | |
227 | + for i in ./* | |
228 | + do | |
229 | + if [ -f ${i} ] | |
230 | + then | |
231 | + mv ${i} ${i}.bak | |
232 | + sed -e "s!^\#\!/usr/bin/env ruby\$!\#\!/usr/ruby/${ruby_ver}/bin/ruby!" \ | |
233 | + -e "s!^\#\!/usr/bin/ruby\$!\#\!/usr/ruby/${ruby_ver}/bin/ruby!" \ | |
234 | + -e "s!^\#\!ruby\$!\#\!/usr/ruby/${ruby_ver}/bin/ruby!" \ | |
235 | + ${i}.bak > ${i} | |
236 | + rm ${i}.bak | |
237 | + fi | |
238 | + done | |
239 | + popd | |
240 | + fi | |
241 | + done | |
242 | + | |
243 | +%if %{generate_executable} | |
244 | + pushd %{buildroot}%{_bindir} | |
245 | + for i in $(ls ../ruby/${ruby_ver}/bin/*) | |
246 | + do | |
247 | + [ -f ${i} ] && ln -s ${i} $(basename ${i})$(echo ${ruby_ver}|sed -e 's/\.//') | |
248 | + done | |
249 | + popd | |
250 | +%endif | |
251 | + | |
252 | +} | |
253 | + | |
254 | +%if %{build19} | |
255 | +# ruby-19 | |
256 | +install_for 1.9 | |
257 | +%endif | |
258 | + | |
259 | +%if %{build20} | |
260 | +install_for 2.0 | |
261 | +%endif | |
262 | + | |
263 | +%if %{build21} | |
92 | 264 | # ruby-21 |
93 | -mkdir -p %{buildroot}/%{gemdir21} | |
94 | -cp -a .%{gemdir21}/* \ | |
95 | - %{buildroot}/%{gemdir21}/ | |
265 | +install_for 2.1 | |
266 | +%endif | |
96 | 267 | |
97 | -# rm -rf %{buildroot}%{geminstdir}/.yardoc/ | |
268 | +%if %{build22} | |
269 | +# ruby-22 | |
270 | +install_for 2.2 | |
271 | +%endif | |
272 | + | |
273 | +%if %{build23} | |
274 | +# ruby-23 | |
275 | +install_for 2.3 | |
276 | +%endif | |
98 | 277 | |
99 | 278 | %clean |
100 | 279 | rm -rf %{buildroot} |
101 | 280 | |
102 | - | |
103 | 281 | %files |
104 | 282 | %defattr(0755,root,bin,-) |
105 | -%dir %attr (0755, root, sys) /usr | |
106 | -/usr/ruby/2.1 | |
107 | 283 | |
284 | +%if %{build19} | |
108 | 285 | %files 19 |
109 | 286 | %defattr(0755,root,bin,-) |
110 | 287 | %dir %attr (0755, root, sys) /usr |
111 | 288 | /usr/ruby/1.9 |
289 | +%if %{generate_executable} | |
290 | +%dir %attr (0755, root, bin) /usr/bin | |
291 | +%attr (0755, root, bin) /usr/bin/*19 | |
292 | +%endif | |
293 | +%endif | |
112 | 294 | |
295 | +%if %{build20} | |
113 | 296 | %files 20 |
114 | 297 | %defattr(0755,root,bin,-) |
115 | 298 | %dir %attr (0755, root, sys) /usr |
116 | 299 | /usr/ruby/2.0 |
300 | +%if %{generate_executable} | |
301 | +%dir %attr (0755, root, bin) /usr/bin | |
302 | +%attr (0755, root, bin) /usr/bin/*20 | |
303 | +%endif | |
304 | +%endif | |
305 | + | |
306 | +%if %{build21} | |
307 | +%files 21 | |
308 | +%defattr(0755,root,bin,-) | |
309 | +%dir %attr (0755, root, sys) /usr | |
310 | +/usr/ruby/2.1 | |
311 | +%if %{generate_executable} | |
312 | +%dir %attr (0755, root, bin) /usr/bin | |
313 | +%attr (0755, root, bin) /usr/bin/*21 | |
314 | +%endif | |
315 | +%endif | |
316 | + | |
317 | +%if %{build22} | |
318 | +%files 22 | |
319 | +%defattr(0755,root,bin,-) | |
320 | +%dir %attr (0755, root, sys) /usr | |
321 | +/usr/ruby/2.2 | |
322 | +%if %{generate_executable} | |
323 | +%dir %attr (0755, root, bin) /usr/bin | |
324 | +%attr (0755, root, bin) /usr/bin/*22 | |
325 | +%endif | |
326 | +%endif | |
327 | + | |
328 | +%if %{build23} | |
329 | +%files 23 | |
330 | +%defattr(0755,root,bin,-) | |
331 | +%dir %attr (0755, root, sys) /usr | |
332 | +/usr/ruby/2.3 | |
333 | +%if %{generate_executable} | |
334 | +%dir %attr (0755, root, bin) /usr/bin | |
335 | +%attr (0755, root, bin) /usr/bin/*23 | |
336 | +%endif | |
337 | +%endif | |
117 | 338 | |
118 | 339 | %changelog |
340 | +* Tue Dec 08 2015 - Fumihisa TONAKA <fumi.ftnk@gmail.com> | |
341 | +- bump to 2.1.2 and build packge for ruby-22 and ruby-23 | |
119 | 342 | * Sun Jun 22 2014 - Fumihisa TONAKA <fumi.ftnk@gmail.com> |
120 | 343 | - generate packages for ruby-20 and ruby-21 instead of ruby-18 |
121 | 344 | * Tue Apr 23 2013 - Fumihisa TONAKA <fumi.ftnk@gmail.com> |