forked from pool/rubygem-gem2rpm
Accepting request 617125 from home:darix:ruby
- added binary_map.patch: add way to avoid conflicts with non rubygems packages in /usr/bin - added template_loader.patch (boo#1092585) OBS-URL: https://build.opensuse.org/request/show/617125 OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/rubygem-gem2rpm?expand=0&rev=28
This commit is contained in:
parent
20d52f2785
commit
a5edb94472
120
binary_map.patch
Normal file
120
binary_map.patch
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
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] %>
|
12
enhances.patch
Normal file
12
enhances.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
|
||||||
|
index 6add6a7..4119bdf 100644
|
||||||
|
--- a/templates/gem_packages.spec.erb
|
||||||
|
+++ b/templates/gem_packages.spec.erb
|
||||||
|
@@ -93,6 +93,7 @@ Group: Development/Languages/Ruby
|
||||||
|
<% unless spec.executables.empty? -%>
|
||||||
|
PreReq: update-alternatives
|
||||||
|
<% end -%>
|
||||||
|
+Enhances: <%= rb_pkgname %>
|
||||||
|
|
||||||
|
%description -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||||||
|
<%= config[:description] or spec.description -%>
|
@ -69,4 +69,8 @@
|
|||||||
# bar
|
# bar
|
||||||
# :post: |-
|
# :post: |-
|
||||||
# /bin/echo foo
|
# /bin/echo foo
|
||||||
#
|
# :preamble: |-
|
||||||
|
# %if 0%{?suse_version} && 0%{?suse_version} < 1330
|
||||||
|
# %define rb_build_versions ruby24 ruby25
|
||||||
|
# %define rb_default_ruby_abi ruby:2.4.0 ruby:2.5.0
|
||||||
|
# %endif
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 6 15:17:48 UTC 2018 - mrueckert@suse.de
|
||||||
|
|
||||||
|
- added binary_map.patch:
|
||||||
|
add way to avoid conflicts with non rubygems packages in /usr/bin
|
||||||
|
- added template_loader.patch (boo#1092585)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Nov 8 18:07:59 UTC 2017 - mrueckert@suse.de
|
Wed Nov 8 18:07:59 UTC 2017 - mrueckert@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package rubygem-gem2rpm
|
# spec file for package rubygem-gem2rpm
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -78,8 +78,10 @@ Patch24: 0024-add-ability-to-provide-alternative-main-Source.patch
|
|||||||
Patch25: 0025-allow-running-commands-after-patching.patch
|
Patch25: 0025-allow-running-commands-after-patching.patch
|
||||||
Patch26: 0026-use-https-instead-of-http-for-rubygems.org.patch
|
Patch26: 0026-use-https-instead-of-http-for-rubygems.org.patch
|
||||||
# Patch27: enhances.patch
|
# Patch27: enhances.patch
|
||||||
|
Patch27: binary_map.patch
|
||||||
|
Patch28: template_loader.patch
|
||||||
Summary: Generate rpm specfiles from gems
|
Summary: Generate rpm specfiles from gems
|
||||||
License: GPL-2.0+
|
License: GPL-2.0-or-later
|
||||||
Group: Development/Languages/Ruby
|
Group: Development/Languages/Ruby
|
||||||
PreReq: update-alternatives
|
PreReq: update-alternatives
|
||||||
|
|
||||||
@ -115,8 +117,11 @@ The spec file tries to follow the gem as closely as possible
|
|||||||
%patch24 -p1
|
%patch24 -p1
|
||||||
%patch25 -p1
|
%patch25 -p1
|
||||||
%patch26 -p1
|
%patch26 -p1
|
||||||
#patch27 -p1
|
%patch27 -p1
|
||||||
|
%patch28 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
perl -p -i -e 's|("templates/opensuse.spec.erb".freeze)|$1, "templates/gem_packages.spec.erb".freeze|g' *gemspec
|
||||||
%gem_build
|
%gem_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
14
template_loader.patch
Normal file
14
template_loader.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
diff --git a/bin/gem2rpm b/bin/gem2rpm
|
||||||
|
old mode 100755
|
||||||
|
new mode 100644
|
||||||
|
index 45ed21c..c613c12
|
||||||
|
--- a/bin/gem2rpm
|
||||||
|
+++ b/bin/gem2rpm
|
||||||
|
@@ -73,6 +73,7 @@ opts.separator("")
|
||||||
|
rest = opts.permute(ARGV)
|
||||||
|
|
||||||
|
template = nil
|
||||||
|
+template_file ||= 'opensuse'
|
||||||
|
if template_file.nil?
|
||||||
|
f = open("/etc/os-release", "r") if File.exists?("/etc/os-release")
|
||||||
|
if f
|
Loading…
Reference in New Issue
Block a user