forked from fedora-ruby/gem2rpm
-
Notifications
You must be signed in to change notification settings - Fork 7
/
opensuse.spec.erb
252 lines (232 loc) · 6.71 KB
/
opensuse.spec.erb
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#
# spec file for package rubygem-<%= spec.name %><%= config[:version_suffix] %>
#
# Copyright (c) <%= Time.now.year %> SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
<% if config && not(config.empty?) -%>
#
# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
# All sections marked as MANUAL, license headers, summaries and descriptions
# can be maintained in that file. Please consult this file before editing any
# of those fields
#
<% end -%>
Name: <%= config[:name] ? config[:name] : "rubygem-#{spec.name}#{config[:version_suffix]}" %>
Version: <%= spec.version %>
Release: 0
%define mod_name <%= spec.name %>
%define mod_full_name %{mod_name}-%{version}
<% if config[:version_suffix] -%>
%define mod_version_suffix <%= config[:version_suffix] %>
<% end -%>
<% if config[:preamble] -%>
# MANUAL
<%= config[:preamble] %>
# /MANUAL
<% end -%>
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ruby-macros >= 5
<% for req in spec.required_ruby_version -%>
<% unless req.empty? -%>
<% if spec.extensions.empty? -%>
BuildRequires: %{ruby <%= req %>}
<% else -%>
BuildRequires: %{rubydevel <%= req %>}
<% end -%>
<% else -%>
<% if spec.extensions.empty? -%>
BuildRequires: %{ruby}
<% else -%>
BuildRequires: %{rubydevel}
<% end -%>
<% end -%>
<% end -%>
<% for d in spec.runtime_dependencies -%>
<% if ['rdoc'].include? d.name.to_s -%>
# <%= d.name %> <%= d.__getobj__().requirement %>
<% for req in d.requirement -%>
BuildRequires: %{rubygem <%= d.name %> <%= req %>}
<% end -%>
<% end -%>
<% end -%>
BuildRequires: %{rubygem gem2rpm}
<% unless spec.rdoc_options.empty? || config[:disable_automatic_rdoc_dep] -%>
BuildRequires: %{rubygem rdoc > 3.10}
<% end -%>
<% unless spec.executables.empty? -%>
BuildRequires: update-alternatives
<% end -%>
<% unless spec.homepage.nil? || spec.homepage.empty? -%>
Url: <%= spec.homepage %>
<% end -%>
<% if config[:sourceurl] -%>
Source: <%= config[:sourceurl] %>
<% else -%>
Source: https://rubygems.org/gems/%{mod_full_name}.gem
<% end -%>
<% if config[:sources]
config[:sources].each_with_index do |src, i| -%>
Source<%= i+1 %>: <%= src %>
<% end
end -%>
<% if config[:patches] -%>
# MANUAL
<% config[:patches].each_with_index do |patch,i| -%>
Patch<%= i %>: <%= patch[0] %>
<% end -%>
# /MANUAL
<% end -%>
Summary: <%= config[:summary] or spec.summary %>
License: <%= config[:license] or (spec.licenses and spec.licenses.join(" and ")) or 'CHECK(Ruby)' %>
Group: Development/Languages/Ruby
<% unless spec.executables.empty? -%>
PreReq: update-alternatives
<% end -%>
%description
<%= config[:description] or spec.description -%>
<% # TODO move into gem2rpm as gem_packages.sh also need this and we only leave it here for getting the docfiles list
test_frameworks = Hash.new
docdirfiles = []
format.file_entries.each do |entry|
# new rubygems version has it different
if entry.kind_of?(Array)
path=entry[0]['path']
else
path=entry
end
path.gsub!(%r{^\./}, '')
%w(test spec).each { |framework|
test_frameworks[framework] = 1 if path.index(framework + "/") == 0
}
%w(changes
copying
history
legal
licence
license
license-mit
mit-license
apache-license-2.0
license-apache-2.0
changelog
news
release_notes
readme
).each { |file|
bpath = path.downcase.gsub(%r{\.rdoc$}, '').gsub(%r{\.txt$}, '').gsub(%r{\.md$}, '').gsub(%r{\.markdown$}, '')
#$stderr.puts "PATH #{path} #{bpath} #{file}"
docdirfiles << path if bpath == file
}
end
test_frameworks = test_frameworks.keys.sort
-%>
%prep
<% unless config[:patches].nil? or config[:patches].empty? -%>
%gem_unpack
<% config[:patches].each_with_index do |patch, i| -%>
%patch<%= i %> <%= patch[1] if patch[1] %>
<% end -%>
<% if config[:post_patch] -%>
# MANUAL
<%= config[:post_patch] %>
# /MANUAL
<% end -%>
find -type f -print0 | xargs -0 touch -r %{S:0}
%gem_build
<% end -%>
%build
%install
<% if config[:pre_install] -%>
# MANUAL
<%= config[:pre_install] %>
# /MANUAL
<% end -%>
%gem_install \
<% if config[:gem_install_args] -%>
<%= config[:gem_install_args] %> \
<% end -%>
<% if config[:disable_docs] -%>
--no-rdoc --no-ri \
<% end -%>
<% unless spec.executables.empty? -%>
--symlink-binaries \
<% end -%>
<% unless docdirfiles.empty? -%>
--doc-files="<%= docdirfiles.join(' ') %>" \
<% end -%>
-f
<% unless spec.extensions.empty? -%>
%gem_cleanup
<% end -%>
<% if config[:post_install] -%>
# MANUAL
<%= config[:post_install] %>
# /MANUAL
<% end -%>
<% if config[:testsuite_command] -%>
# MANUAL
%check
<%= config[:testsuite_command] %>
#/ MANUAL
<% end -%>
<% if config[:filelist] -%>
%files
%defattr(-,root,root,-)
<%= config[:filelist] %>
<% end -%>
<% if config[:scripts]
if config[:scripts].is_a? Hash
config[:scripts].each do |section, content| -%>
%<%= section %>
<%= content %>
<% end
else -%>
<%= config[:scripts] %>
<% end
end
-%>
<% if config[:custom_pkgs]
config[:custom_pkgs].each do |custom_pkg_name, data|
-%>
%package <%= custom_pkg_name %><%= config[:version_suffix] %>
<% if data[:preamble] and data[:preamble] != '' -%>
<%= data[:preamble] %>
<% else %>
Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
Group: Development/Languages/Ruby
<% end %>
# Requires: rubygem-<%= spec.name %><%= config[:version_suffix] %> = <%= spec.version %>
%description <%= custom_pkg_name %><%= config[:version_suffix] %>
<% if data[:description] and data[:description] != '' -%>
<%= data[:description] %>
<% else %>
<%= spec.description -%>
This package holds the <%= custom_pkg_name %> sub package for <%= spec.name -%>
<% end %>
%files <%= custom_pkg_name %><%= config[:version_suffix] %>
%defattr(-,root,root,-)
<%= data[:filelist] %>
<% if data[:scripts]
if data[:scripts].is_a? Hash
data[:scripts].each do |section, content| -%>
%<%=section %> <%=custom_pkg_name %>
<%= content %>
<% end
end
end
-%>
<% end
end
-%>
%gem_packages
%changelog