1
0
rubygem-gem2rpm/0028-add-binary_map-support.patch
Stephan Kulow 9f40853891 - Update from git. Add:
A    0027-quote-version_suffix-in-gem2rpm.yml.documentation-to.patch
A    0028-add-binary_map-support.patch
A    0029-Use-or-for-the-conditions-instead-of-and.patch
A    0030-gem_package.spec.erb-sync-with-ruby-common.patch
A    0031-use-template-opensuse-on-openSUSE-Tumbleweed-where-e.patch
A    0032-Replace-no-rdoc-no-ri-with-no-document.patch
And refresh all others
Remove:
D    binary_map.patch
D    enhances.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/rubygem-gem2rpm?expand=0&rev=35
2019-02-23 07:09:23 +00:00

90 lines
4.6 KiB
Diff

From fdf7e5ceb4c165babfb7486fe6640faa21ab5e12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20R=C3=BCckert?= <darix@nordisch.org>
Date: Wed, 6 Jun 2018 16:15:39 +0200
Subject: [PATCH 28/32] add binary_map support
---
gem2rpm.yml.documentation | 2 ++
templates/gem_packages.spec.erb | 24 ++++++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
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..4861bbd 100644
--- a/templates/gem_packages.spec.erb
+++ b/templates/gem_packages.spec.erb
@@ -30,6 +30,13 @@
weight=v1*10000+v2*100+v3
end
+ def self.map_executable(config, executable)
+ if not(config[:binary_map].nil? and 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
@@ -93,6 +100,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 -%>
@@ -157,19 +165,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,8 +196,8 @@ 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 -%>
--
2.20.1