1
0

Accepting request 671139 from devel:languages:ruby

- [42.3/sle12] disable ruby 2.3 and 2.4 so we can enable 2.6

- add ruby 2.6 support

- enhances.patch is a WIP but we add it to the filelist for the
  source validator

- 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/671139
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rubygem-gem2rpm?expand=0&rev=25
This commit is contained in:
Stephan Kulow 2019-02-08 11:02:12 +00:00 committed by Git OBS Bridge
commit a35ad91b49
6 changed files with 243 additions and 7 deletions

120
binary_map.patch Normal file
View 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
View 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 -%>

View File

@ -69,4 +69,8 @@
# bar
# :post: |-
# /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

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Fri Jan 18 15:32:43 UTC 2019 - Marcus Rueckert <mrueckert@suse.de>
- [42.3/sle12] disable ruby 2.3 and 2.4 so we can enable 2.6
-------------------------------------------------------------------
Fri Jun 29 14:00:54 UTC 2018 - mrueckert@suse.de
- add ruby 2.6 support
-------------------------------------------------------------------
Fri Jun 15 17:19:13 UTC 2018 - mrueckert@suse.de
- enhances.patch is a WIP but we add it to the filelist for the
source validator
-------------------------------------------------------------------
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

View File

@ -1,7 +1,7 @@
#
# spec file for package rubygem-gem2rpm
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 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
@ -12,7 +12,7 @@
# 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/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -23,10 +23,11 @@
%bcond_with ruby21
%if ! (0%{?suse_version} == 1315)
%bcond_with ruby22
%endif
%bcond_with ruby23
%bcond_with ruby24
%endif
%bcond_with ruby25
%bcond_with ruby26
%bcond_with rubinius25
Name: rubygem-gem2rpm
@ -77,9 +78,11 @@ Patch23: 0023-Also-tag-APACHE-LICENSE-2.0-as-docfile.patch
Patch24: 0024-add-ability-to-provide-alternative-main-Source.patch
Patch25: 0025-allow-running-commands-after-patching.patch
Patch26: 0026-use-https-instead-of-http-for-rubygems.org.patch
# Patch27: enhances.patch
Patch27: binary_map.patch
Patch28: template_loader.patch
Patch29: enhances.patch
Summary: Generate rpm specfiles from gems
License: GPL-2.0+
License: GPL-2.0-or-later
Group: Development/Languages/Ruby
PreReq: update-alternatives
@ -115,8 +118,12 @@ The spec file tries to follow the gem as closely as possible
%patch24 -p1
%patch25 -p1
%patch26 -p1
#patch27 -p1
%patch27 -p1
%patch28 -p1
#patch29 -p1
%build
perl -p -i -e 's|("templates/opensuse.spec.erb".freeze)|$1, "templates/gem_packages.spec.erb".freeze|g' *gemspec
%gem_build
%install
@ -574,6 +581,62 @@ fi
%doc %{_libdir}/ruby/gems/2.5.0/doc/gem2rpm-%{version}
%endif
%if %{with ruby26}
%package -n ruby2.6-rubygem-gem2rpm
Summary: Generate rpm specfiles from gems
Group: Development/Languages/Ruby
PreReq: update-alternatives
%description -n ruby2.6-rubygem-gem2rpm
Generate source rpms and rpm spec files from a Ruby Gem.
The spec file tries to follow the gem as closely as possible
%package -n ruby2.6-rubygem-gem2rpm-doc
Summary: RDoc documentation for %{mod_name}
Group: Development/Languages/Ruby
Requires: ruby2.6-rubygem-gem2rpm = %{version}
%description -n ruby2.6-rubygem-gem2rpm-doc
Documentation generated at gem installation time.
Usually in RDoc and RI formats.
%post -n ruby2.6-rubygem-gem2rpm
/usr/sbin/update-alternatives --install \
%{_bindir}/gem2rpm gem2rpm %{_bindir}/gem2rpm.ruby2.6-%{version} %{mod_weight}
/usr/sbin/update-alternatives --install \
%{_bindir}/gem2rpm-%{version} gem2rpm-%{version} %{_bindir}/gem2rpm.ruby2.6-%{version} %{mod_weight}
/usr/sbin/update-alternatives --install \
%{_bindir}/gem2rpm.ruby2.6 gem2rpm.ruby2.6 %{_bindir}/gem2rpm.ruby2.6-%{version} %{mod_weight}
%preun -n ruby2.6-rubygem-gem2rpm
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove gem2rpm %{_bindir}/gem2rpm.ruby2.6-%{version}
/usr/sbin/update-alternatives --remove gem2rpm-%{version} %{_bindir}/gem2rpm.ruby2.6-%{version}
/usr/sbin/update-alternatives --remove gem2rpm.ruby2.6 %{_bindir}/gem2rpm.ruby2.6-%{version}
fi
%files -n ruby2.6-rubygem-gem2rpm
%defattr(-,root,root,-)
%{_docdir}/ruby2.6-rubygem-gem2rpm
#{_bindir}/gem2rpm-opensuse
%{_bindir}/gem2rpm.ruby2.6-%{version}
%ghost %{_bindir}/gem2rpm.ruby2.6
%ghost %{_bindir}/gem2rpm-%{version}
%ghost %{_bindir}/gem2rpm
%ghost %{_sysconfdir}/alternatives/gem2rpm
%ghost %{_sysconfdir}/alternatives/gem2rpm.ruby2.6
%ghost %{_sysconfdir}/alternatives/gem2rpm-%{version}
# cache file
%{_libdir}/ruby/gems/2.6.0/cache/gem2rpm-%{version}.gem
%{_libdir}/ruby/gems/2.6.0/gems/gem2rpm-%{version}
%{_libdir}/ruby/gems/2.6.0/specifications/gem2rpm-%{version}.gemspec
%files -n ruby2.6-rubygem-gem2rpm-doc
%defattr(-,root,root,-)
%doc %{_libdir}/ruby/gems/2.6.0/doc/gem2rpm-%{version}
%endif
%if %{with rubinius25}
%package -n rbx2.5-rubygem-gem2rpm
# MANUAL

14
template_loader.patch Normal file
View 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