gem2rpm 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +6 -0
- data/README +1 -1
- data/bin/gem2rpm +21 -12
- data/lib/gem2rpm/dependency.rb +22 -0
- data/lib/gem2rpm/distro.rb +22 -0
- data/lib/gem2rpm/helpers.rb +31 -0
- data/lib/gem2rpm/specification.rb +48 -0
- data/lib/gem2rpm.rb +15 -126
- data/templates/default.spec.erb +69 -0
- data/templates/fedora.spec.erb +149 -0
- data/templates/opensuse.spec.erb +72 -0
- metadata +30 -11
- data/rubygem-gem2rpm.spec +0 -67
data/AUTHORS
CHANGED
@@ -5,8 +5,14 @@ Initiated and maintained by:
|
|
5
5
|
|
6
6
|
David Lutterkort lutter@watzmann.net
|
7
7
|
|
8
|
+
Maintained by:
|
9
|
+
Vít Ondruch vondruch at gmail dot com
|
10
|
+
|
8
11
|
Patches from:
|
9
12
|
|
10
13
|
Brian Candler B.Candler at pobox dot com
|
11
14
|
Josh Kelley joshkel at gmail dot com
|
12
15
|
Paul Nasrat pauln at truemesh.com
|
16
|
+
Chris Ess caess at ithiriel.com
|
17
|
+
Matthew Kent mattkent at rubyforge.com
|
18
|
+
Michal Fojtík mi at mifo dot sk
|
data/README
CHANGED
data/bin/gem2rpm
CHANGED
@@ -13,16 +13,17 @@ opts.separator(" Convert ruby Gems to source RPMs and specfiles")
|
|
13
13
|
opts.separator(" Uses a template to generate the RPM specfile")
|
14
14
|
opts.separator(" from the Gem spec")
|
15
15
|
|
16
|
+
print_template_file = nil
|
16
17
|
template_file = nil
|
17
18
|
output_file = nil
|
18
19
|
local = false
|
19
20
|
srpm = false
|
20
21
|
deps = false
|
21
22
|
nongem = false
|
23
|
+
doc_subpackage = true
|
22
24
|
|
23
|
-
opts.on("-T", "--
|
24
|
-
|
25
|
-
exit 0
|
25
|
+
opts.on("-T", "--current-template", "Print the current template") do |val|
|
26
|
+
print_template_file = true
|
26
27
|
end
|
27
28
|
opts.on("-t", "--template TEMPLATE", "Use TEMPLATE for the specfile") do |val|
|
28
29
|
template_file = val
|
@@ -47,14 +48,10 @@ end
|
|
47
48
|
opts.on("-n", "--nongem", "Generate a subpackage for non-gem use") do |val|
|
48
49
|
nongem = true
|
49
50
|
end
|
50
|
-
|
51
|
-
|
52
|
-
if rest.size != 1
|
53
|
-
$stderr.puts "Missing GEMFILE"
|
54
|
-
$stderr.puts opts
|
55
|
-
exit(1)
|
51
|
+
opts.on("--no-doc", "Disable document subpackage") do |val|
|
52
|
+
doc_subpackage = false
|
56
53
|
end
|
57
|
-
|
54
|
+
rest = opts.permute(ARGV)
|
58
55
|
|
59
56
|
template = nil
|
60
57
|
if template_file.nil?
|
@@ -70,6 +67,18 @@ else
|
|
70
67
|
f.close
|
71
68
|
end
|
72
69
|
|
70
|
+
if print_template_file
|
71
|
+
puts template
|
72
|
+
exit 0
|
73
|
+
end
|
74
|
+
|
75
|
+
if rest.size != 1
|
76
|
+
$stderr.puts "Missing GEMFILE"
|
77
|
+
$stderr.puts opts
|
78
|
+
exit(1)
|
79
|
+
end
|
80
|
+
gemfile = rest[0]
|
81
|
+
|
73
82
|
srpmdir = nil
|
74
83
|
gemname = nil
|
75
84
|
srpmdir = nil
|
@@ -85,11 +94,11 @@ end
|
|
85
94
|
|
86
95
|
# Produce a specfile
|
87
96
|
if output_file.nil?
|
88
|
-
Gem2Rpm::convert(gemfile, template, $stdout, nongem, local) unless deps
|
97
|
+
Gem2Rpm::convert(gemfile, template, $stdout, nongem, local, doc_subpackage) unless deps
|
89
98
|
else
|
90
99
|
begin
|
91
100
|
out = open(output_file, "w")
|
92
|
-
Gem2Rpm::convert(gemfile, template, out, nongem, local)
|
101
|
+
Gem2Rpm::convert(gemfile, template, out, nongem, local, doc_subpackage)
|
93
102
|
ensure
|
94
103
|
out.close()
|
95
104
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
require 'gem2rpm/helpers'
|
3
|
+
|
4
|
+
module Gem2Rpm
|
5
|
+
class Dependency < SimpleDelegator
|
6
|
+
# What does this dependency require?
|
7
|
+
def requirement
|
8
|
+
r = begin
|
9
|
+
super
|
10
|
+
rescue
|
11
|
+
version_requirements # For RubyGems < 1.3.6
|
12
|
+
end
|
13
|
+
|
14
|
+
Helpers::requirement_versions_to_rpm r
|
15
|
+
end
|
16
|
+
|
17
|
+
# Dependency type. Needs to be explicitly reimplemented.
|
18
|
+
def type
|
19
|
+
__getobj__.type
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Gem2Rpm
|
2
|
+
class Distro
|
3
|
+
FEDORA = :fedora
|
4
|
+
OPENSUSE = :opensuse
|
5
|
+
DEFAULT = :default
|
6
|
+
|
7
|
+
def self.nature
|
8
|
+
if !release_files.grep(/fedora/).empty?
|
9
|
+
FEDORA
|
10
|
+
elsif !release_files.grep(/SuSe/).empty?
|
11
|
+
OPENSUSE
|
12
|
+
else
|
13
|
+
DEFAULT
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.release_files
|
18
|
+
@@release_files ||= Dir.glob '/etc/*{_version,-release}*'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Gem2Rpm
|
2
|
+
module Helpers
|
3
|
+
# Taken with modification from the word_wrap method in ActionPack.
|
4
|
+
# Text::Format does the same thing better.
|
5
|
+
def self.word_wrap(text, line_width = 80)
|
6
|
+
text.gsub(/\n/, "\n\n").gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip
|
7
|
+
end
|
8
|
+
|
9
|
+
# Expands the pesimistic version operator '~>' into equivalent '>=' and
|
10
|
+
# '<' pair.
|
11
|
+
def self.expand_pessimistic_requirement(requirements)
|
12
|
+
requirements.inject([]) do |output, r|
|
13
|
+
if r.first == '~>'
|
14
|
+
next_version = Gem::Version.create(r.last).bump
|
15
|
+
output << ['=>', r.last]
|
16
|
+
output << ['<', next_version]
|
17
|
+
else
|
18
|
+
output << r
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Converts Gem::Requirement into array of requirements strings compatible
|
24
|
+
# with RPM .spec file.
|
25
|
+
def self.requirement_versions_to_rpm(requirement)
|
26
|
+
self.expand_pessimistic_requirement(requirement.requirements).map do |op, version|
|
27
|
+
version == Gem::Version.new(0) ? "" : "#{op} #{version}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
require 'gem2rpm/dependency'
|
3
|
+
require 'gem2rpm/helpers'
|
4
|
+
|
5
|
+
module Gem2Rpm
|
6
|
+
class Specification < SimpleDelegator
|
7
|
+
# A long description of gem wrapped to 78 characters.
|
8
|
+
def description
|
9
|
+
Helpers::word_wrap(super.to_s.chomp, 78) + "\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
# A list of Gem::Dependency objects this gem depends on (includes every
|
13
|
+
# runtime or development dependency).
|
14
|
+
def dependencies
|
15
|
+
super.map {|d| Gem2Rpm::Dependency.new d}
|
16
|
+
end
|
17
|
+
|
18
|
+
# List of dependencies that are used for development.
|
19
|
+
def development_dependencies
|
20
|
+
super.map {|d| Gem2Rpm::Dependency.new d}
|
21
|
+
end
|
22
|
+
|
23
|
+
# List of dependencies that will automatically be activated at runtime.
|
24
|
+
def runtime_dependencies
|
25
|
+
super.map {|d| Gem2Rpm::Dependency.new d}
|
26
|
+
end
|
27
|
+
|
28
|
+
# The version of Ruby required by the gem. Returns array with
|
29
|
+
# empty string if the method is not provided by RubyGems yet.
|
30
|
+
def required_ruby_version
|
31
|
+
@required_ruby_version ||= begin
|
32
|
+
Helpers.requirement_versions_to_rpm(super)
|
33
|
+
rescue
|
34
|
+
['']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# The RubyGems version required by gem. For RubyGems < 0.9.5 returns only
|
39
|
+
# array with empty string. However, this should happen only in rare cases.
|
40
|
+
def required_rubygems_version
|
41
|
+
@required_rubygems_version ||= begin
|
42
|
+
Helpers::requirement_versions_to_rpm(super)
|
43
|
+
rescue
|
44
|
+
['']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/gem2rpm.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'socket'
|
3
3
|
require 'rubygems/format'
|
4
|
+
require 'gem2rpm/distro'
|
5
|
+
require 'gem2rpm/specification'
|
4
6
|
|
5
7
|
# Adapt to the differences between rubygems < 1.0.0 and after
|
6
8
|
# Once we can be reasonably certain that everybody has version >= 1.0.0
|
@@ -12,34 +14,8 @@ if HAS_REMOTE_INSTALLER
|
|
12
14
|
require 'rubygems/remote_installer'
|
13
15
|
end
|
14
16
|
|
15
|
-
# Extend String with a word_wrap method, which we use in the ERB template
|
16
|
-
# below. Taken with modification from the word_wrap method in ActionPack.
|
17
|
-
# Text::Format does the smae thing better.
|
18
|
-
class String
|
19
|
-
def word_wrap(line_width = 80)
|
20
|
-
gsub(/\n/, "\n\n").gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module Gem
|
25
|
-
class Requirement
|
26
|
-
def rpm_version_transform(version)
|
27
|
-
if version == "> 0.0.0"
|
28
|
-
version = ""
|
29
|
-
end
|
30
|
-
version
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_rpm
|
34
|
-
result = as_list
|
35
|
-
return result.map { |version| rpm_version_transform(version) }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
17
|
module Gem2Rpm
|
42
|
-
Gem2Rpm::VERSION = "0.
|
18
|
+
Gem2Rpm::VERSION = "0.7.0"
|
43
19
|
|
44
20
|
if HAS_REMOTE_INSTALLER
|
45
21
|
def self.find_download_url(name, version)
|
@@ -59,9 +35,9 @@ module Gem2Rpm
|
|
59
35
|
end
|
60
36
|
|
61
37
|
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
62
|
-
nongem=true, local=false)
|
38
|
+
nongem=true, local=false, doc_subpackage = true)
|
63
39
|
format = Gem::Format.from_file_by_path(fname)
|
64
|
-
spec = format.spec
|
40
|
+
spec = Gem2Rpm::Specification.new(format.spec)
|
65
41
|
spec.description ||= spec.summary
|
66
42
|
download_path = ""
|
67
43
|
unless local
|
@@ -72,7 +48,7 @@ module Gem2Rpm
|
|
72
48
|
$stderr.puts "#{e.inspect}"
|
73
49
|
end
|
74
50
|
end
|
75
|
-
template = ERB.new(template, 0, '
|
51
|
+
template = ERB.new(template, 0, '-')
|
76
52
|
out.puts template.result(binding)
|
77
53
|
end
|
78
54
|
|
@@ -80,107 +56,20 @@ module Gem2Rpm
|
|
80
56
|
# gem2spec). Taken from RPM macros if present, constructed from system
|
81
57
|
# username and hostname otherwise.
|
82
58
|
def Gem2Rpm.packager()
|
83
|
-
packager = `
|
84
|
-
|
59
|
+
packager = `rpmdev-packager`.chomp
|
60
|
+
|
61
|
+
if packager.empty?
|
62
|
+
packager = `rpm --eval '%{packager}'`.chomp
|
63
|
+
end
|
64
|
+
|
65
|
+
if packager.empty? or packager == '%{packager}'
|
85
66
|
packager = "#{Etc::getpwnam(Etc::getlogin).gecos} <#{Etc::getlogin}@#{Socket::gethostname}>"
|
86
67
|
end
|
68
|
+
|
87
69
|
packager
|
88
70
|
end
|
89
71
|
|
90
|
-
TEMPLATE =
|
91
|
-
%q{# Generated from <%= File::basename(format.gem_path) %> by gem2rpm -*- rpm-spec -*-
|
92
|
-
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
93
|
-
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
94
|
-
%define gemname <%= spec.name %>
|
95
|
-
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
96
|
-
|
97
|
-
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
98
|
-
Name: rubygem-%{gemname}
|
99
|
-
Version: <%= spec.version %>
|
100
|
-
Release: 1%{?dist}
|
101
|
-
Group: Development/Languages
|
102
|
-
License: GPLv2+ or Ruby
|
103
|
-
URL: <%= spec.homepage %>
|
104
|
-
Source0: <%= download_path %>%{gemname}-%{version}.gem
|
105
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
106
|
-
Requires: rubygems
|
107
|
-
<% for d in spec.dependencies %>
|
108
|
-
<% for req in d.version_requirements.to_rpm %>
|
109
|
-
Requires: rubygem(<%= d.name %>) <%= req %>
|
110
|
-
<% end %>
|
111
|
-
<% end %>
|
112
|
-
BuildRequires: rubygems
|
113
|
-
<% if spec.extensions.empty? %>
|
114
|
-
BuildArch: noarch
|
115
|
-
<% end %>
|
116
|
-
Provides: rubygem(%{gemname}) = %{version}
|
117
|
-
|
118
|
-
%description
|
119
|
-
<%= spec.description.to_s.chomp.word_wrap(78) + "\n" %>
|
120
|
-
|
121
|
-
<% if nongem %>
|
122
|
-
%package -n ruby-%{gemname}
|
123
|
-
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
124
|
-
Group: Development/Languages
|
125
|
-
Requires: rubygem(%{gemname}) = %{version}
|
126
|
-
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.reject { |f| f =~ /\.rb$/ }.collect { |f| File::basename(f) }.each do |p| %>
|
127
|
-
Provides: ruby(<%= p %>) = %{version}
|
128
|
-
<% end %>
|
129
|
-
%description -n ruby-%{gemname}
|
130
|
-
<%= spec.description.to_s.chomp.word_wrap(78) + "\n" %>
|
131
|
-
<% end # if nongem %>
|
132
|
-
|
133
|
-
%prep
|
134
|
-
|
135
|
-
%build
|
136
|
-
|
137
|
-
%install
|
138
|
-
rm -rf %{buildroot}
|
139
|
-
mkdir -p %{buildroot}%{gemdir}
|
140
|
-
<% rdoc_opt = spec.has_rdoc ? "--rdoc " : "" %>
|
141
|
-
gem install --local --install-dir %{buildroot}%{gemdir} \
|
142
|
-
--force <%= rdoc_opt %>%{SOURCE0}
|
143
|
-
<% unless spec.executables.empty? %>
|
144
|
-
mkdir -p %{buildroot}/%{_bindir}
|
145
|
-
mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
|
146
|
-
rmdir %{buildroot}%{gemdir}/bin
|
147
|
-
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
|
148
|
-
<% end %>
|
149
|
-
<% if nongem %>
|
150
|
-
mkdir -p %{buildroot}%{ruby_sitelib}
|
151
|
-
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.each do |p| %>
|
152
|
-
ln -s %{gemdir}/gems/%{gemname}-%{version}/<%= p %> %{buildroot}%{ruby_sitelib}
|
153
|
-
<% end %>
|
154
|
-
<% end # if nongem %>
|
155
|
-
|
156
|
-
%clean
|
157
|
-
rm -rf %{buildroot}
|
158
|
-
|
159
|
-
%files
|
160
|
-
%defattr(-, root, root, -)
|
161
|
-
<% for f in spec.executables %>
|
162
|
-
%{_bindir}/<%= f %>
|
163
|
-
<% end %>
|
164
|
-
%{gemdir}/gems/%{gemname}-%{version}/
|
165
|
-
<% if spec.has_rdoc %>
|
166
|
-
%doc %{gemdir}/doc/%{gemname}-%{version}
|
167
|
-
<% end %>
|
168
|
-
<% for f in spec.extra_rdoc_files %>
|
169
|
-
%doc %{geminstdir}/<%= f %>
|
170
|
-
<% end %>
|
171
|
-
%{gemdir}/cache/%{gemname}-%{version}.gem
|
172
|
-
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
173
|
-
|
174
|
-
<% if nongem %>
|
175
|
-
%files -n ruby-%{gemname}
|
176
|
-
%defattr(-, root, root, -)
|
177
|
-
%{ruby_sitelib}/*
|
178
|
-
<% end # if nongem %>
|
179
|
-
|
180
|
-
%changelog
|
181
|
-
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1
|
182
|
-
- Initial package
|
183
|
-
}
|
72
|
+
TEMPLATE = File.read File.join(File.dirname(__FILE__), '..', 'templates', "#{Distro.nature.to_s}.spec.erb")
|
184
73
|
end
|
185
74
|
|
186
75
|
# Local Variables:
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated from <%= format.gem_path %> by gem2rpm -*- rpm-spec -*-
|
2
|
+
%define rbname <%= spec.name %>
|
3
|
+
%define version <%= spec.version %>
|
4
|
+
%define release 1
|
5
|
+
|
6
|
+
Summary: <%= spec.summary %>
|
7
|
+
Name: ruby-gems-%{rbname}
|
8
|
+
|
9
|
+
Version: %{version}
|
10
|
+
Release: %{release}
|
11
|
+
Group: Development/Ruby
|
12
|
+
License: Distributable
|
13
|
+
URL: <%= spec.homepage %>
|
14
|
+
Source0: %{rbname}-%{version}.gem
|
15
|
+
# Make sure the spec template is included in the SRPM
|
16
|
+
Source1: ruby-gems-%{rbname}.spec.in
|
17
|
+
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
18
|
+
Requires: ruby <%= spec.required_ruby_version %>
|
19
|
+
Requires: ruby-gems >= <%= Gem::RubyGemsVersion %>
|
20
|
+
<% for d in spec.dependencies -%>
|
21
|
+
<% for req in d.requirement -%>
|
22
|
+
Requires: ruby-gems-<%= d.name %> <%= req %>
|
23
|
+
<% end -%>
|
24
|
+
<% end -%>
|
25
|
+
BuildRequires: ruby <%= spec.required_ruby_version %>
|
26
|
+
BuildRequires: ruby-gems >= <%= Gem::RubyGemsVersion %>
|
27
|
+
BuildArch: noarch
|
28
|
+
Provides: ruby(<%= spec.name.capitalize %>) = %{version}
|
29
|
+
|
30
|
+
%define gemdir <%= Gem.dir %>
|
31
|
+
%define gembuilddir %{buildroot}%{gemdir}
|
32
|
+
|
33
|
+
%description
|
34
|
+
<%= spec.description %>
|
35
|
+
|
36
|
+
%prep
|
37
|
+
%setup -T -c
|
38
|
+
|
39
|
+
%build
|
40
|
+
|
41
|
+
%install
|
42
|
+
%{__rm} -rf %{buildroot}
|
43
|
+
mkdir -p %{gembuilddir}
|
44
|
+
gem install --local --install-dir %{gembuilddir} --force %{SOURCE0}
|
45
|
+
<% if ! spec.executables.empty? -%>
|
46
|
+
mkdir -p %{buildroot}/%{_bindir}
|
47
|
+
mv %{gembuilddir}/bin/* %{buildroot}/%{_bindir}
|
48
|
+
rmdir %{gembuilddir}/bin
|
49
|
+
<% end -%>
|
50
|
+
|
51
|
+
%clean
|
52
|
+
%{__rm} -rf %{buildroot}
|
53
|
+
|
54
|
+
%files
|
55
|
+
%defattr(-, root, root)
|
56
|
+
<% for f in spec.executables -%>
|
57
|
+
%{_bindir}/<%= f %>
|
58
|
+
<% end -%>
|
59
|
+
<% format.file_entries.each do |entry, data| -%>
|
60
|
+
<% path = entry['path'] -%>
|
61
|
+
<% doc_prefix = spec.extra_rdoc_files.include?(path) ? "%doc " : "" -%>
|
62
|
+
<%= doc_prefix %>%{gemdir}/gems/<%= spec.name %>-<%= spec.version %>/<%= path %>
|
63
|
+
<% end %>
|
64
|
+
|
65
|
+
%doc %{gemdir}/doc/<%= spec.name %>-<%= spec.version %>
|
66
|
+
%{gemdir}/cache/<%= format.gem_path %>
|
67
|
+
%{gemdir}/specifications/<%= format.gem_path %>spec
|
68
|
+
|
69
|
+
%changelog
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# Generated from <%= File::basename(format.gem_path) %> by gem2rpm -*- rpm-spec -*-
|
2
|
+
%global gemname <%= spec.name %>
|
3
|
+
|
4
|
+
<% if nongem -%>
|
5
|
+
%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
6
|
+
<% end -%>
|
7
|
+
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
8
|
+
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
9
|
+
%global rubyabi 1.8
|
10
|
+
|
11
|
+
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
12
|
+
Name: rubygem-%{gemname}
|
13
|
+
Version: <%= spec.version %>
|
14
|
+
Release: 1%{?dist}
|
15
|
+
Group: Development/Languages
|
16
|
+
License: <%= spec.licenses.empty? ? "GPLv2+ or Ruby" : spec.licenses.join(" and ") %>
|
17
|
+
<% if spec.homepage -%>
|
18
|
+
URL: <%= spec.homepage %>
|
19
|
+
<% end -%>
|
20
|
+
Source0: <%= download_path %>%{gemname}-%{version}.gem
|
21
|
+
Requires: ruby(abi) = %{rubyabi}
|
22
|
+
<% for req in spec.required_rubygems_version -%>
|
23
|
+
Requires: ruby(rubygems) <%= req %>
|
24
|
+
<% end -%>
|
25
|
+
<%# TODO: Unfortunatelly this do not match with ruby(abi) yet -%>
|
26
|
+
<% for req in spec.required_ruby_version -%>
|
27
|
+
Requires: ruby <%= req %>
|
28
|
+
<% end -%>
|
29
|
+
<% for d in spec.runtime_dependencies -%>
|
30
|
+
<% for req in d.requirement -%>
|
31
|
+
Requires: rubygem(<%= d.name %>) <%= req %>
|
32
|
+
<% end -%>
|
33
|
+
<% end -%>
|
34
|
+
BuildRequires: ruby(abi) = %{rubyabi}
|
35
|
+
<% for req in spec.required_rubygems_version -%>
|
36
|
+
BuildRequires: ruby(rubygems) <%= req %>
|
37
|
+
<% end -%>
|
38
|
+
<%# TODO: Unfortunatelly this do not match with ruby(abi) yet -%>
|
39
|
+
<% for req in spec.required_ruby_version -%>
|
40
|
+
BuildRequires: ruby <%= req %>
|
41
|
+
<% end -%>
|
42
|
+
<% if spec.extensions.empty? -%>
|
43
|
+
BuildArch: noarch
|
44
|
+
<% end -%>
|
45
|
+
Provides: rubygem(%{gemname}) = %{version}
|
46
|
+
|
47
|
+
%description
|
48
|
+
<%= spec.description %>
|
49
|
+
|
50
|
+
<% if doc_subpackage -%>
|
51
|
+
%package doc
|
52
|
+
Summary: Documentation for %{name}
|
53
|
+
Group: Documentation
|
54
|
+
Requires: %{name} = %{version}-%{release}
|
55
|
+
BuildArch: noarch
|
56
|
+
|
57
|
+
%description doc
|
58
|
+
Documentation for %{name}
|
59
|
+
<% end # if doc_subpackage -%>
|
60
|
+
|
61
|
+
<% if nongem -%>
|
62
|
+
%package -n ruby-%{gemname}
|
63
|
+
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
64
|
+
Group: Development/Languages
|
65
|
+
Requires: rubygem(%{gemname}) = %{version}
|
66
|
+
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.reject { |f| f =~ /\.rb$/ }.collect { |f| File::basename(f) }.each do |p| -%>
|
67
|
+
Provides: ruby(<%= p %>) = %{version}
|
68
|
+
<% end -%>
|
69
|
+
%description -n ruby-%{gemname}
|
70
|
+
<%= spec.description -%>
|
71
|
+
<% end # if nongem -%>
|
72
|
+
|
73
|
+
%prep
|
74
|
+
%setup -q -c -T
|
75
|
+
mkdir -p .%{gemdir}
|
76
|
+
<% unless spec.extensions.empty? -%>
|
77
|
+
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
|
78
|
+
<% end -%>
|
79
|
+
gem install --local --install-dir .%{gemdir} \
|
80
|
+
<% unless spec.executables.nil? or spec.executables.empty? -%>
|
81
|
+
--bindir .%{_bindir} \
|
82
|
+
<% end -%>
|
83
|
+
<% unless spec.extensions.empty? -%>
|
84
|
+
-V \
|
85
|
+
<% end -%>
|
86
|
+
--force %{SOURCE0}
|
87
|
+
|
88
|
+
%build
|
89
|
+
|
90
|
+
%install
|
91
|
+
mkdir -p %{buildroot}%{gemdir}
|
92
|
+
cp -a .%{gemdir}/* \
|
93
|
+
%{buildroot}%{gemdir}/
|
94
|
+
<% unless spec.executables.nil? or spec.executables.empty? -%>
|
95
|
+
|
96
|
+
mkdir -p %{buildroot}%{_bindir}
|
97
|
+
cp -a .%{_bindir}/* \
|
98
|
+
%{buildroot}%{_bindir}/
|
99
|
+
<% end -%>
|
100
|
+
|
101
|
+
<% unless spec.executables.empty? -%>
|
102
|
+
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
|
103
|
+
<% end -%>
|
104
|
+
<% if nongem -%>
|
105
|
+
mkdir -p %{buildroot}%{ruby_sitelib}
|
106
|
+
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.each do |p| -%>
|
107
|
+
ln -s %{gemdir}/gems/%{gemname}-%{version}/<%= p %> %{buildroot}%{ruby_sitelib}
|
108
|
+
<% end -%>
|
109
|
+
<% end # if nongem -%>
|
110
|
+
<% unless spec.extensions.empty? -%>
|
111
|
+
<%# TODO: Is it possible to delete the folder specified by the spec.extensions? -%>
|
112
|
+
# Remove the binary extension sources and build leftovers.
|
113
|
+
rm -rf %{buildroot}%{geminstdir}/ext
|
114
|
+
<% end -%>
|
115
|
+
|
116
|
+
%files
|
117
|
+
%dir %{geminstdir}
|
118
|
+
<% unless spec.executables.nil? or spec.executables.empty? -%>
|
119
|
+
<% for f in spec.executables -%>
|
120
|
+
%{_bindir}/<%= f %>
|
121
|
+
<% end -%>
|
122
|
+
%{geminstdir}/bin
|
123
|
+
<% end -%>
|
124
|
+
%{geminstdir}/lib
|
125
|
+
<% unless doc_subpackage -%>
|
126
|
+
%doc %{gemdir}/doc/%{gemname}-%{version}
|
127
|
+
<% for f in spec.extra_rdoc_files -%>
|
128
|
+
%doc %{geminstdir}/<%= f %>
|
129
|
+
<% end -%>
|
130
|
+
<% end -%>
|
131
|
+
%{gemdir}/cache/%{gemname}-%{version}.gem
|
132
|
+
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
133
|
+
|
134
|
+
<% if doc_subpackage -%>
|
135
|
+
%files doc
|
136
|
+
%doc %{gemdir}/doc/%{gemname}-%{version}
|
137
|
+
<% for f in spec.extra_rdoc_files -%>
|
138
|
+
%doc %{geminstdir}/<%= f %>
|
139
|
+
<% end -%>
|
140
|
+
<% end # if doc_subpackage -%>
|
141
|
+
|
142
|
+
<% if nongem -%>
|
143
|
+
%files -n ruby-%{gemname}
|
144
|
+
%{ruby_sitelib}/*
|
145
|
+
<% end # if nongem -%>
|
146
|
+
|
147
|
+
%changelog
|
148
|
+
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1
|
149
|
+
- Initial package
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#
|
2
|
+
# spec file for package rubygem-<%= spec.name %> (Version <%= spec.version %>)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
5
|
+
#
|
6
|
+
# All modifications and additions to the file contributed by third parties
|
7
|
+
# remain the property of their copyright owners, unless otherwise agreed
|
8
|
+
# upon. The license for this file, and modifications and additions to the
|
9
|
+
# file, is the same license as for the pristine package itself (unless the
|
10
|
+
# license for the pristine package is not an Open Source License, in which
|
11
|
+
# case the license is the MIT License). An "Open Source License" is a
|
12
|
+
# license that conforms to the Open Source Definition (Version 1.9)
|
13
|
+
# published by the Open Source Initiative.
|
14
|
+
|
15
|
+
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
16
|
+
#
|
17
|
+
|
18
|
+
# norootforbuild
|
19
|
+
Name: rubygem-<%= spec.name %>
|
20
|
+
Version: <%= spec.version %>
|
21
|
+
Release: 0
|
22
|
+
%define mod_name <%= spec.name %>
|
23
|
+
#
|
24
|
+
Group: Development/Languages/Ruby
|
25
|
+
License: GPLv2+ or Ruby
|
26
|
+
#
|
27
|
+
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
28
|
+
BuildRequires: rubygems_with_buildroot_patch
|
29
|
+
Requires: rubygems >= <%= Gem::RubyGemsVersion %>
|
30
|
+
<%
|
31
|
+
# no need to add a requires ruby >= 0 here. will be pulled in via rubygems already
|
32
|
+
unless spec.required_ruby_version == ['']
|
33
|
+
-%>
|
34
|
+
Requires: ruby <%= spec.required_ruby_version %>
|
35
|
+
BuildRequires: ruby-devel <%= spec.required_ruby_version %>
|
36
|
+
<% end -%>
|
37
|
+
<% for d in spec.dependencies -%>
|
38
|
+
<% for req in d.requirement -%>
|
39
|
+
BuildRequires: rubygem-<%= d.name %> <%= req %>
|
40
|
+
Requires: rubygem-<%= d.name %> <%= req %>
|
41
|
+
<% end -%>
|
42
|
+
<% end -%>
|
43
|
+
#
|
44
|
+
Url: <%= spec.homepage %>
|
45
|
+
Source: %{mod_name}-%{version}.gem
|
46
|
+
#
|
47
|
+
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
48
|
+
%description
|
49
|
+
<%= spec.description %>
|
50
|
+
|
51
|
+
%prep
|
52
|
+
%build
|
53
|
+
%install
|
54
|
+
%gem_install %{S:0}
|
55
|
+
<% unless spec.extensions.empty? %>
|
56
|
+
%gem_cleanup
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
%clean
|
60
|
+
%{__rm} -rf %{buildroot}
|
61
|
+
|
62
|
+
%files
|
63
|
+
%defattr(-,root,root,-)
|
64
|
+
<% spec.executables.each do |executable| %>
|
65
|
+
%{_bindir}/<%= executable %>
|
66
|
+
<% end %>
|
67
|
+
%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_name}-%{version}.gem
|
68
|
+
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/
|
69
|
+
%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_name}-%{version}.gemspec
|
70
|
+
%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_name}-%{version}/
|
71
|
+
|
72
|
+
%changelog
|
metadata
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem2rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- David Lutterkort
|
14
|
+
- Vit Ondruch
|
8
15
|
autorequire:
|
9
16
|
bindir: bin
|
10
17
|
cert_chain: []
|
11
18
|
|
12
|
-
date:
|
13
|
-
default_executable: gem2rpm
|
19
|
+
date: 2011-06-29 00:00:00 Z
|
14
20
|
dependencies: []
|
15
21
|
|
16
|
-
description: Generate source rpms and rpm spec files from a Ruby Gem. The spec file tries to follow the gem as closely as possible
|
22
|
+
description: " Generate source rpms and rpm spec files from a Ruby Gem. \n The spec file tries to follow the gem as closely as possible\n"
|
17
23
|
email: gem2rpm-devel@rubyforge.org
|
18
24
|
executables:
|
19
25
|
- gem2rpm
|
@@ -25,36 +31,49 @@ extra_rdoc_files:
|
|
25
31
|
- LICENSE
|
26
32
|
files:
|
27
33
|
- bin/gem2rpm
|
34
|
+
- lib/gem2rpm/distro.rb
|
35
|
+
- lib/gem2rpm/specification.rb
|
36
|
+
- lib/gem2rpm/helpers.rb
|
37
|
+
- lib/gem2rpm/dependency.rb
|
28
38
|
- lib/gem2rpm.rb
|
39
|
+
- templates/fedora.spec.erb
|
40
|
+
- templates/opensuse.spec.erb
|
41
|
+
- templates/default.spec.erb
|
29
42
|
- LICENSE
|
30
43
|
- README
|
31
|
-
- rubygem-gem2rpm.spec
|
32
44
|
- AUTHORS
|
33
|
-
|
34
|
-
|
45
|
+
homepage: https://github.com/lutter/gem2rpm/
|
46
|
+
licenses: []
|
47
|
+
|
35
48
|
post_install_message:
|
36
49
|
rdoc_options: []
|
37
50
|
|
38
51
|
require_paths:
|
39
52
|
- lib
|
40
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
41
55
|
requirements:
|
42
56
|
- - ">="
|
43
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
44
61
|
version: "0"
|
45
|
-
version:
|
46
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
47
64
|
requirements:
|
48
65
|
- - ">="
|
49
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
50
70
|
version: "0"
|
51
|
-
version:
|
52
71
|
requirements: []
|
53
72
|
|
54
73
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.2
|
74
|
+
rubygems_version: 1.7.2
|
56
75
|
signing_key:
|
57
|
-
specification_version:
|
76
|
+
specification_version: 3
|
58
77
|
summary: Generate rpm specfiles from gems
|
59
78
|
test_files: []
|
60
79
|
|
data/rubygem-gem2rpm.spec
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# Generated from gem2rpm-0.5.2.gem by gem2rpm -*- rpm-spec -*-
|
2
|
-
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
3
|
-
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
4
|
-
%define gemname gem2rpm
|
5
|
-
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
6
|
-
|
7
|
-
Summary: Generate rpm specfiles from gems
|
8
|
-
Name: rubygem-%{gemname}
|
9
|
-
Version: @VERSION@
|
10
|
-
Release: 1%{?dist}
|
11
|
-
Group: Development/Languages
|
12
|
-
License: GPLv2+ or Ruby
|
13
|
-
URL: http://rubyforge.org/projects/gem2rpm/
|
14
|
-
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
|
15
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
16
|
-
Requires: rubygems
|
17
|
-
BuildRequires: rubygems
|
18
|
-
BuildArch: noarch
|
19
|
-
Provides: rubygem(%{gemname}) = %{version}
|
20
|
-
|
21
|
-
%description
|
22
|
-
Generate source rpms and rpm spec files from a Ruby Gem. The spec file
|
23
|
-
tries to follow the gem as closely as possible, and be compliant with the
|
24
|
-
Fedora rubygem packaging guidelines
|
25
|
-
|
26
|
-
|
27
|
-
%prep
|
28
|
-
|
29
|
-
%build
|
30
|
-
|
31
|
-
%install
|
32
|
-
rm -rf %{buildroot}
|
33
|
-
mkdir -p %{buildroot}%{gemdir}
|
34
|
-
gem install --local --install-dir %{buildroot}%{gemdir} \
|
35
|
-
--force %{SOURCE0}
|
36
|
-
mkdir -p %{buildroot}/%{_bindir}
|
37
|
-
mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
|
38
|
-
rmdir %{buildroot}%{gemdir}/bin
|
39
|
-
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
|
40
|
-
|
41
|
-
%clean
|
42
|
-
rm -rf %{buildroot}
|
43
|
-
|
44
|
-
%files
|
45
|
-
%defattr(-, root, root, -)
|
46
|
-
%{_bindir}/gem2rpm
|
47
|
-
%dir %{geminstdir}
|
48
|
-
%doc %{geminstdir}/AUTHORS
|
49
|
-
%{geminstdir}/bin
|
50
|
-
%{geminstdir}/lib
|
51
|
-
%doc %{geminstdir}/README
|
52
|
-
%doc %{geminstdir}/LICENSE
|
53
|
-
%{geminstdir}/rubygem-gem2rpm.spec
|
54
|
-
%{gemdir}/cache/%{gemname}-%{version}.gem
|
55
|
-
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
56
|
-
|
57
|
-
|
58
|
-
%changelog
|
59
|
-
* Tue Mar 11 2008 David Lutterkort <dlutter@redhat.com> - @VERSION@-1
|
60
|
-
- Bring in accordance with Fedora guidelines
|
61
|
-
|
62
|
-
* Thu Jan 3 2008 David Lutterkort <dlutter@redhat.com> - 0.5.2-2
|
63
|
-
- Own geminstdir
|
64
|
-
- Fix Source URL
|
65
|
-
|
66
|
-
* Mon Dec 10 2007 David Lutterkort <dlutter@redhat.com> - 0.5.2-1
|
67
|
-
- Initial package
|