forked from pool/rubygem-gem2rpm
121 lines
6.5 KiB
Diff
121 lines
6.5 KiB
Diff
|
diff --git a/gem2rpm.yml.documentation b/gem2rpm.yml.documentation
|
||
|
index bb4893d..5b9e4e3 100644
|
||
|
--- a/gem2rpm.yml.documentation
|
||
|
+++ b/gem2rpm.yml.documentation
|
||
|
@@ -28,6 +28,8 @@
|
||
|
# :sources:
|
||
|
# - foo.desktop
|
||
|
# - bar.desktop
|
||
|
+# :binary_map:
|
||
|
+# annotate: annotate-rb
|
||
|
# :gem_install_args: '....'
|
||
|
# ## used by gem2rpm
|
||
|
# :pre_install: |-
|
||
|
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
|
||
|
index 6add6a7..257c719 100644
|
||
|
--- a/templates/gem_packages.spec.erb
|
||
|
+++ b/templates/gem_packages.spec.erb
|
||
|
@@ -30,6 +30,14 @@
|
||
|
weight=v1*10000+v2*100+v3
|
||
|
end
|
||
|
|
||
|
+ def self.map_executable(config, executable)
|
||
|
+ if not(config[:binary_map].nil? or
|
||
|
+ config[:binary_map][executable].nil?)
|
||
|
+ executable=config[:binary_map][executable]
|
||
|
+ end
|
||
|
+ executable
|
||
|
+ end
|
||
|
+
|
||
|
def self.filecontent_or_value(path)
|
||
|
(path and File.exists?(path)) ? File.read(path) : path
|
||
|
end
|
||
|
@@ -54,6 +62,8 @@
|
||
|
end
|
||
|
|
||
|
rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
|
||
|
+ # TODO: "ruby" hardcoded here is wrong. it should support jruby/rubinius or so
|
||
|
+ rb_abi = "ruby:#{RbConfig::CONFIG['ruby_version']}"
|
||
|
rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
|
||
|
if rb_suffix =~ /\A\d+\.\d+\z/
|
||
|
rb_suffix = '.ruby' + rb_suffix
|
||
|
@@ -70,6 +80,7 @@
|
||
|
gem_spec = Gem::Specification.new
|
||
|
gem_base_dir = patch_libdir(gem_spec.base_dir)
|
||
|
gem_cache_dir = patch_libdir(gem_spec.cache_dir)
|
||
|
+ gem_build_info_dir = patch_libdir(gem_spec.build_info_dir)
|
||
|
gem_gems_dir = patch_libdir(gem_spec.gems_dir)
|
||
|
gem_spec_dir = patch_libdir(gem_spec.spec_dir)
|
||
|
gem_bin_dir = patch_libdir(patch_mod_full_name(gem_spec.bin_dir , mod_full_name ))
|
||
|
@@ -101,7 +112,7 @@ PreReq: update-alternatives
|
||
|
%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||
|
Summary: RDoc documentation for <%= spec.name %>
|
||
|
Group: Development/Languages/Ruby
|
||
|
-Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||
|
+Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||
|
|
||
|
%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||
|
Documentation generated at gem installation time.
|
||
|
@@ -146,7 +157,7 @@ Usually in RDoc and RI formats.
|
||
|
%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||
|
Summary: Test suite for <%= spec.name %>
|
||
|
Group: Development/Languages/Ruby
|
||
|
-Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||
|
+Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||
|
|
||
|
%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||
|
Test::Unit or RSpec files, useful for developers.
|
||
|
@@ -157,19 +168,19 @@ Test::Unit or RSpec files, useful for developers.
|
||
|
%post -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||
|
<% spec.executables.each do |executable| -%>
|
||
|
/usr/sbin/update-alternatives --install \
|
||
|
- <%= rb_bindir %>/<%= executable %> <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
+ <%= rb_bindir %>/<%= map_executable(config, executable) %> <%= map_executable(config, executable) %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
/usr/sbin/update-alternatives --install \
|
||
|
- <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
+ <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %> <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
/usr/sbin/update-alternatives --install \
|
||
|
- <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
+ <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %> <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %> <%= mod_weight %>
|
||
|
<% end -%>
|
||
|
|
||
|
%preun -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||
|
if [ "$1" = 0 ] ; then
|
||
|
<% spec.executables.each do |executable| -%>
|
||
|
- /usr/sbin/update-alternatives --remove <%= executable %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
- /usr/sbin/update-alternatives --remove <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
- /usr/sbin/update-alternatives --remove <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
+ /usr/sbin/update-alternatives --remove <%= map_executable(config, executable) %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
+ /usr/sbin/update-alternatives --remove <%= "#{executable}-#{spec.version}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
+ /usr/sbin/update-alternatives --remove <%= "#{executable}#{rb_suffix}" %> <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
<% end -%>
|
||
|
fi
|
||
|
<% end -%>
|
||
|
@@ -188,14 +199,15 @@ fi
|
||
|
<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||
|
<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %>
|
||
|
<%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %>
|
||
|
-<%= rb_bindir %>/<%= executable %>
|
||
|
-%ghost <%= rb_sysconfdir %>/alternatives/<%= executable %>
|
||
|
+<%= rb_bindir %>/<%= map_executable(config, executable) %>
|
||
|
+%ghost <%= rb_sysconfdir %>/alternatives/<%= map_executable(config, executable) %>
|
||
|
%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}#{rb_suffix}" %>
|
||
|
%ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}-#{spec.version}" %>
|
||
|
<% end -%>
|
||
|
# cache file
|
||
|
<%= gem_cache_dir %>/<%= mod_full_name %>.gem
|
||
|
<%= gem_gem_dir %>
|
||
|
+<%= gem_build_info_dir %>
|
||
|
<% unless spec.extensions.empty? or gem_extension_dir.nil? -%>
|
||
|
<%= gem_extension_dir %>
|
||
|
<% end -%>
|
||
|
@@ -231,7 +243,7 @@ fi
|
||
|
Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
|
||
|
Group: Development/Languages/Ruby
|
||
|
<% end %>
|
||
|
-Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||
|
+Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||
|
%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
|
||
|
<% if data[:description] and data[:description] != '' -%>
|
||
|
<%= data[:description] %>
|