- Support runtime dependencies for the generated subpackages:

syntax:
  Requires: rubygem(gemname)
  Recommends: rubygem(gemname:x) >= x.y
  This will be transformed into
  Requires: rubygem(ruby:<rubyabi>:gemname)
  Recommends: rubygem(ruby:<rubyabi>:gemname:x) >= x.y
  That way we ensure that every package only requires rubygems for
  the current ruby version.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-common?expand=0&rev=125
This commit is contained in:
Marcus Rückert 2023-05-12 21:25:06 +00:00 committed by Git OBS Bridge
parent 8c2870d272
commit 99701f00fd
2 changed files with 33 additions and 2 deletions

View File

@ -61,7 +61,21 @@
custom_pkgs
end
rb_pkg_abi = "#{RUBY_ENGINE}:#{RUBY_ENGINE_VERSION}:#{spec.name}"
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_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
@ -104,7 +118,7 @@
%package -n <%= pkg_basename %><%= config[:version_suffix] %>
# MANUAL
<% if config[:main] && config[:main][:preamble] -%>
<%= config[:main][:preamble] %>
<%= fix_up_rubygem_requires_with_rb_api(rb_api, config[:main][:preamble]) %>
<% end -%>
# /MANUAL
Summary: <%= config[:summary] or spec.summary %>

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Fri May 12 14:21:14 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- Support runtime dependencies for the generated subpackages:
syntax:
Requires: rubygem(gemname)
Recommends: rubygem(gemname:x) >= x.y
This will be transformed into
Requires: rubygem(ruby:<rubyabi>:gemname)
Recommends: rubygem(ruby:<rubyabi>:gemname:x) >= x.y
That way we ensure that every package only requires rubygems for
the current ruby version.
-------------------------------------------------------------------
Sun May 7 00:35:06 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>