- update gem_packages.spec.erb by syncing with gem2rpm
- drop group tag - only emit manual comments if we actually put out content - mark docs explicitely with the %doc tag - stop using deprecated PreReq for update-alternatives - update suse.patch and sync in ruby-common/gem_packages.spec.erb OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/rubygem-gem2rpm?expand=0&rev=61
This commit is contained in:
parent
5cfa1a3148
commit
025213f027
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 8 00:26:29 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||||
|
|
||||||
|
- update suse.patch and sync in ruby-common/gem_packages.spec.erb
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Oct 7 23:08:35 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
Mon Oct 7 23:08:35 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||||
|
|
||||||
|
97
suse.patch
97
suse.patch
@ -248,10 +248,10 @@ index 9a8d5a1..2e4f7b2 100644
|
|||||||
super.map {|d| Gem2Rpm::Dependency.new d}
|
super.map {|d| Gem2Rpm::Dependency.new d}
|
||||||
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
|
diff --git a/templates/gem_packages.spec.erb b/templates/gem_packages.spec.erb
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..74da961
|
index 0000000..10b1d70
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/templates/gem_packages.spec.erb
|
+++ b/templates/gem_packages.spec.erb
|
||||||
@@ -0,0 +1,264 @@
|
@@ -0,0 +1,319 @@
|
||||||
+<%
|
+<%
|
||||||
+
|
+
|
||||||
+ begin
|
+ begin
|
||||||
@ -267,6 +267,34 @@ index 0000000..74da961
|
|||||||
+ path
|
+ path
|
||||||
+ end
|
+ end
|
||||||
+
|
+
|
||||||
|
+
|
||||||
|
+ def self.rpm_suffix_for_feature(feature)
|
||||||
|
+ rpm_prefix = nil
|
||||||
|
+
|
||||||
|
+ package_name = RbConfig::CONFIG['RUBY_SO_NAME']
|
||||||
|
+
|
||||||
|
+ IO.popen("rpm -q --provides #{package_name}") {|rpm_io|
|
||||||
|
+ rpm_provides = rpm_io.read
|
||||||
|
+ mo = /(?<rpm_prefix>with(out)?-#{feature})/.match(rpm_provides)
|
||||||
|
+
|
||||||
|
+ if mo
|
||||||
|
+ rpm_prefix = mo[:rpm_prefix]
|
||||||
|
+ end
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rpm_prefix
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ def self.requires_for_feature(feature)
|
||||||
|
+ found_rpm_prefix = rpm_suffix_for_feature(feature)
|
||||||
|
+
|
||||||
|
+ if found_rpm_prefix
|
||||||
|
+ return "Requires: #{RbConfig::CONFIG['RUBY_SO_NAME']}-#{found_rpm_prefix} >= #{RbConfig::CONFIG['RUBY_PROGRAM_VERSION']}"
|
||||||
|
+ end
|
||||||
|
+ #
|
||||||
|
+ return ""
|
||||||
|
+ end
|
||||||
|
+
|
||||||
+ def self.get_extension_doc_dir(gem_spec)
|
+ def self.get_extension_doc_dir(gem_spec)
|
||||||
+ return nil unless Gem.ruby_engine == 'ruby' && Gem::Requirement.new("~> 2.1.0").satisfied_by?(Gem.ruby_version)
|
+ return nil unless Gem.ruby_engine == 'ruby' && Gem::Requirement.new("~> 2.1.0").satisfied_by?(Gem.ruby_version)
|
||||||
+ if gem_spec.respond_to?(:extensions_dir)
|
+ if gem_spec.respond_to?(:extensions_dir)
|
||||||
@ -293,7 +321,7 @@ index 0000000..74da961
|
|||||||
+ end
|
+ end
|
||||||
+
|
+
|
||||||
+ def self.filecontent_or_value(path)
|
+ def self.filecontent_or_value(path)
|
||||||
+ (path and File.exist?(path)) ? File.read(path) : path
|
+ (path and File.exists?(path)) ? File.read(path) : path
|
||||||
+ end
|
+ end
|
||||||
+
|
+
|
||||||
+ def self.parse_custom_pkgs(env_value)
|
+ def self.parse_custom_pkgs(env_value)
|
||||||
@ -315,9 +343,23 @@ index 0000000..74da961
|
|||||||
+ custom_pkgs
|
+ custom_pkgs
|
||||||
+ end
|
+ end
|
||||||
+
|
+
|
||||||
|
+ def self.fix_up_rubygem_requires_with_rb_api(rb_api, preamble_text)
|
||||||
|
+ STDERR.puts(preamble_text)
|
||||||
|
+ preamble_text.lines.map do |line|
|
||||||
|
+ if mo = /^(?<pre_text>\s*\S+\s*:\s+rubygem\()(?<pkg_info>[^\)]+)(?<post_text>\).*)?$/.match(line)
|
||||||
|
+ if not(mo[:pkg_info] =~ /^ruby:\d\.\d\.\d/)
|
||||||
|
+ line = "#{mo[:pre_text]}#{rb_api}:#{mo[:pkg_info]}#{mo[:post_text]}"
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ line
|
||||||
|
+ end.join("\n")
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
+ rb_api = "#{RUBY_ENGINE}:#{RbConfig::CONFIG['ruby_version']}"
|
||||||
|
+
|
||||||
|
+ rb_pkg_abi = "#{rb_api}:#{spec.name}"
|
||||||
|
+
|
||||||
+ rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
|
+ 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\./, '')
|
+ rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
|
||||||
+ if rb_suffix =~ /\A\d+\.\d+\z/
|
+ if rb_suffix =~ /\A\d+\.\d+\z/
|
||||||
+ rb_suffix = '.ruby' + rb_suffix
|
+ rb_suffix = '.ruby' + rb_suffix
|
||||||
@ -346,29 +388,42 @@ index 0000000..74da961
|
|||||||
+ gem_extension_dir = gem_spec.respond_to?(:extension_dir) ? patch_libdir(patch_mod_full_name(gem_spec.extension_dir, mod_full_name)) : nil
|
+ gem_extension_dir = gem_spec.respond_to?(:extension_dir) ? patch_libdir(patch_mod_full_name(gem_spec.extension_dir, mod_full_name)) : nil
|
||||||
+ gem_extension_doc = patch_libdir(get_extension_doc_dir(gem_spec))
|
+ gem_extension_doc = patch_libdir(get_extension_doc_dir(gem_spec))
|
||||||
+ #/ruby2.1
|
+ #/ruby2.1
|
||||||
+ gem_plugins_dir = Gem::Version.new(Gem::VERSION) >= Gem::Version.new("3.2.0") ? File.join(gem_spec.base_dir, 'plugins') : nil
|
+ gem_plugins_dir = Gem.respond_to?(:plugindir) ? Gem.plugindir : nil
|
||||||
|
+ has_plugins = gem_plugins_dir && not( spec.files.select {|filename| filename =~ /rubygems_plugin#{Gem.suffix_regexp}\z/ }.empty? )
|
||||||
|
+ if config[:disable_docs].nil?
|
||||||
|
+ config[:disable_docs] ||= true
|
||||||
|
+ end
|
||||||
|
+ if config[:include_testsuite].nil?
|
||||||
|
+ config[:include_testsuite] ||= false
|
||||||
|
+ end
|
||||||
+%>
|
+%>
|
||||||
+%package -n <%= pkg_basename %><%= config[:version_suffix] %>
|
+%package -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||||||
+# MANUAL
|
+# MANUAL
|
||||||
+<% if config[:main] && config[:main][:preamble] -%>
|
+<% if config[:main] && config[:main][:preamble] -%>
|
||||||
+<%= config[:main][:preamble] %>
|
+<%= fix_up_rubygem_requires_with_rb_api(rb_api, config[:main][:preamble]) %>
|
||||||
+<% end -%>
|
+<% end -%>
|
||||||
+# /MANUAL
|
+# /MANUAL
|
||||||
|
+<% unless spec.extensions.empty? -%>
|
||||||
|
+<%= requires_for_feature('jemalloc') %>
|
||||||
|
+<%= requires_for_feature('yjit') %>
|
||||||
|
+<% end -%>
|
||||||
+Summary: <%= config[:summary] or spec.summary %>
|
+Summary: <%= config[:summary] or spec.summary %>
|
||||||
+Group: Development/Languages/Ruby
|
|
||||||
+<% unless spec.executables.empty? -%>
|
+<% unless spec.executables.empty? -%>
|
||||||
+Requires(preun): update-alternatives
|
+Requires(preun): update-alternatives
|
||||||
+Requires(post): update-alternatives
|
+Requires(post): update-alternatives
|
||||||
+<% end -%>
|
+<% end -%>
|
||||||
|
+<% if has_plugins -%>
|
||||||
|
+Conflicts: rubygem(<%= rb_pkg_abi %>)
|
||||||
|
+<% end -%>
|
||||||
|
+Enhances: <%= rb_pkgname %>
|
||||||
+
|
+
|
||||||
+%description -n <%= pkg_basename %><%= config[:version_suffix] %>
|
+%description -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||||||
+<%= config[:description] or spec.description -%>
|
+<%= config[:description] or spec.description -%>
|
||||||
+
|
+
|
||||||
+<% if spec.has_rdoc && !(config[:disable_docs]) -%>
|
+<% if spec.has_rdoc? && !(config[:disable_docs]) -%>
|
||||||
+%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
+%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||||
+Summary: RDoc documentation for <%= spec.name %>
|
+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] %>
|
+%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||||
+Documentation generated at gem installation time.
|
+Documentation generated at gem installation time.
|
||||||
@ -412,8 +467,7 @@ index 0000000..74da961
|
|||||||
+<% unless test_frameworks.empty? -%>
|
+<% unless test_frameworks.empty? -%>
|
||||||
+%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
+%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||||
+Summary: Test suite for <%= spec.name %>
|
+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] %>
|
+%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||||
+Test::Unit or RSpec files, useful for developers.
|
+Test::Unit or RSpec files, useful for developers.
|
||||||
@ -443,13 +497,13 @@ index 0000000..74da961
|
|||||||
+
|
+
|
||||||
+%files -n <%= pkg_basename %><%= config[:version_suffix] %>
|
+%files -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||||||
+%defattr(-,root,root,-)
|
+%defattr(-,root,root,-)
|
||||||
+# MANUAL
|
|
||||||
+<% if config[:main] && config[:main][:filelist] -%>
|
+<% if config[:main] && config[:main][:filelist] -%>
|
||||||
+<%= config[:main][:filelist] -%>
|
+# MANUAL
|
||||||
+<% end -%>
|
+<%= config[:main][:filelist] %>
|
||||||
+# /MANUAL
|
+# /MANUAL
|
||||||
|
+<% end -%>
|
||||||
+<% unless docdirfiles.empty? -%>
|
+<% unless docdirfiles.empty? -%>
|
||||||
+<%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %>
|
+%doc <%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %>
|
||||||
+<% end -%>
|
+<% end -%>
|
||||||
+<% spec.executables.each do |executable| -%>
|
+<% spec.executables.each do |executable| -%>
|
||||||
+<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
+<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||||||
@ -463,7 +517,9 @@ index 0000000..74da961
|
|||||||
+# cache file
|
+# cache file
|
||||||
+<%= gem_cache_dir %>/<%= mod_full_name %>.gem
|
+<%= gem_cache_dir %>/<%= mod_full_name %>.gem
|
||||||
+<%= gem_gem_dir %>
|
+<%= gem_gem_dir %>
|
||||||
|
+<% if has_plugins -%>
|
||||||
+<%= gem_plugins_dir %>
|
+<%= gem_plugins_dir %>
|
||||||
|
+<% end -%>
|
||||||
+<%= gem_build_info_dir %>
|
+<%= gem_build_info_dir %>
|
||||||
+<% unless spec.extensions.empty? or gem_extension_dir.nil? -%>
|
+<% unless spec.extensions.empty? or gem_extension_dir.nil? -%>
|
||||||
+<%= gem_extension_dir %>
|
+<%= gem_extension_dir %>
|
||||||
@ -473,7 +529,7 @@ index 0000000..74da961
|
|||||||
+<% end -%>
|
+<% end -%>
|
||||||
+<%= gem_spec_dir %>/<%= mod_full_name -%>.gemspec
|
+<%= gem_spec_dir %>/<%= mod_full_name -%>.gemspec
|
||||||
+
|
+
|
||||||
+<% if spec.has_rdoc && !(config[:disable_docs]) -%>
|
+<% if spec.has_rdoc? && !(config[:disable_docs]) -%>
|
||||||
+%files -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
+%files -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||||
+%defattr(-,root,root,-)
|
+%defattr(-,root,root,-)
|
||||||
+%doc <%= gem_doc_dir %>
|
+%doc <%= gem_doc_dir %>
|
||||||
@ -482,7 +538,7 @@ index 0000000..74da961
|
|||||||
+<% end -%>
|
+<% end -%>
|
||||||
+<% end -%>
|
+<% end -%>
|
||||||
+
|
+
|
||||||
+<% unless test_frameworks.empty? -%>
|
+<% if config[:include_testsuite] and !test_frameworks.empty? -%>
|
||||||
+%files -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
+%files -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||||
+%defattr(-,root,root,-)
|
+%defattr(-,root,root,-)
|
||||||
+<% test_frameworks.each do |framework| -%>
|
+<% test_frameworks.each do |framework| -%>
|
||||||
@ -498,9 +554,8 @@ index 0000000..74da961
|
|||||||
+<%= data[:preamble] %>
|
+<%= data[:preamble] %>
|
||||||
+<% else %>
|
+<% else %>
|
||||||
+Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
|
+Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
|
||||||
+Group: Development/Languages/Ruby
|
|
||||||
+<% end %>
|
+<% end %>
|
||||||
+Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
+Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||||||
+%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
|
+%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
|
||||||
+<% if data[:description] and data[:description] != '' -%>
|
+<% if data[:description] and data[:description] != '' -%>
|
||||||
+<%= data[:description] %>
|
+<%= data[:description] %>
|
||||||
|
Loading…
Reference in New Issue
Block a user