Sync from SUSE:SLFO:Main ruby-common revision d9b5ddae3935ff23fbc4a5edae921fdf
This commit is contained in:
@@ -7,6 +7,7 @@ export LC_ALL="en_US.UTF-8"
|
||||
export LANG="en_US.UTF-8"
|
||||
shopt -s nullglob
|
||||
for ruby in $(/usr/bin/ruby-find-versioned) ; do
|
||||
export GEM_HOME="$(${ruby} -r rubygems -e 'puts Gem.default_dir')"
|
||||
$ruby -x $0 "$@"
|
||||
done
|
||||
exit $?
|
||||
|
@@ -57,5 +57,7 @@ export LC_ALL="en_US.UTF-8"
|
||||
export LANG="en_US.UTF-8"
|
||||
set -x
|
||||
for gr in $(/usr/bin/ruby-find-versioned gem2rpm) ; do
|
||||
ruby_suffix=${gr##/usr/bin/gem2rpm}
|
||||
export GEM_HOME="$(/usr/bin/ruby${ruby_suffix} -r rubygems -e 'puts Gem.default_dir')"
|
||||
$gr $otheropts
|
||||
done
|
||||
|
@@ -13,6 +13,34 @@
|
||||
path
|
||||
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)
|
||||
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)
|
||||
@@ -61,7 +89,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,16 +146,20 @@
|
||||
%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
|
||||
<% unless spec.extensions.empty? -%>
|
||||
<%= requires_for_feature('jemalloc') %>
|
||||
<%= requires_for_feature('yjit') %>
|
||||
<% end -%>
|
||||
Summary: <%= config[:summary] or spec.summary %>
|
||||
Group: Development/Languages/Ruby
|
||||
<% unless spec.executables.empty? -%>
|
||||
PreReq: update-alternatives
|
||||
Requires(preun): update-alternatives
|
||||
Requires(post): update-alternatives
|
||||
<% end -%>
|
||||
<% if has_plugins -%>
|
||||
Conflicts: rubygem(<%= rb_pkg_abi %>)
|
||||
Conflicts: rubygem(<%= rb_pkg_abi %>) = %{version}
|
||||
<% end -%>
|
||||
Enhances: <%= rb_pkgname %>
|
||||
|
||||
@@ -123,7 +169,6 @@ Enhances: <%= rb_pkgname %>
|
||||
<% if spec.has_rdoc? && !(config[:disable_docs]) -%>
|
||||
%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 %>
|
||||
|
||||
%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||
@@ -168,7 +213,6 @@ Usually in RDoc and RI formats.
|
||||
<% unless test_frameworks.empty? -%>
|
||||
%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 %>
|
||||
|
||||
%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||
@@ -199,13 +243,13 @@ fi
|
||||
|
||||
%files -n <%= pkg_basename %><%= config[:version_suffix] %>
|
||||
%defattr(-,root,root,-)
|
||||
# MANUAL
|
||||
<% if config[:main] && config[:main][:filelist] -%>
|
||||
<%= config[:main][:filelist] -%>
|
||||
<% end -%>
|
||||
# MANUAL
|
||||
<%= config[:main][:filelist] %>
|
||||
# /MANUAL
|
||||
<% end -%>
|
||||
<% unless docdirfiles.empty? -%>
|
||||
<%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %>
|
||||
%doc <%= docdir %>/<%= pkg_basename %><%= config[:version_suffix] %>
|
||||
<% end -%>
|
||||
<% spec.executables.each do |executable| -%>
|
||||
<%= rb_bindir %>/<%= "#{executable}#{rb_suffix}-#{spec.version}" %>
|
||||
@@ -256,7 +300,6 @@ fi
|
||||
<%= data[:preamble] %>
|
||||
<% else %>
|
||||
Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
|
||||
Group: Development/Languages/Ruby
|
||||
<% end %>
|
||||
Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||||
%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
|
||||
|
@@ -1,3 +1,84 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 22 10:27:14 UTC 2025 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- do not generate unversioned conflicts
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 8 00:27:46 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Sep 28 00:00:32 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- update gem_packages.spec.erb:
|
||||
dont strip the newline at the end of main:filelist output
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 7 13:52:41 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- refactor the jemalloc requires code so that it can accomodate
|
||||
more feature flags
|
||||
- add requires for yjit enabled ruby
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 16 14:20:31 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- gem_cleanup macro: yet another place which got hit by ruby 3.3
|
||||
replace `gem env gemdir` with
|
||||
`ruby -r rubygems -e 'puts Gem.default_dir'`
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 14 10:29:27 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- Fix for the previous change. we need to set the GEM_HOME before
|
||||
even wrapping into the re-exec with ruby.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 13 20:51:12 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- add workaround for https://github.com/rubygems/rubygems/commit/64273fd7e3
|
||||
for now we will always set GEM_HOME to ensure that this new logic
|
||||
does not break our paths
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Nov 4 00:41:49 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- ensure that gems built against an jemalloc enabled ruby
|
||||
also pulls a ruby version that is built with jemalloc
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri May 12 21:28:54 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
- bump the version so we can require the new version to make it
|
||||
easier to depend on the new functionality
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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 10:28:13 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Remove old specfile constructs
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun May 7 00:35:06 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ruby-common
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -22,7 +22,7 @@
|
||||
%endif
|
||||
|
||||
Name: ruby-common
|
||||
Version: 3.2
|
||||
Version: 3.2.1
|
||||
Release: 0
|
||||
# ruby-macros and ruby-common version
|
||||
%define rpm_macros_version 5
|
||||
@@ -124,7 +124,6 @@ install -D -m 0755 %{S:19} %{buildroot}%{_bindir}/bundler-dumpdeps
|
||||
install -D -m 0644 %{S:17} %{buildroot}/usr/lib/rpm/fileattrs/rubygems_bundled.attr
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%if %{with ship_gemrc}
|
||||
%config /etc/gemrc
|
||||
%endif
|
||||
@@ -141,12 +140,10 @@ install -D -m 0644 %{S:17} %{buildroot}/usr/lib/rpm/fileattrs/rubygems_bundled.a
|
||||
%{_bindir}/g2r
|
||||
|
||||
%files -n ruby-packaging-helpers
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/irp
|
||||
%{_bindir}/bundler-dumpdeps
|
||||
|
||||
%files rails
|
||||
%defattr(-,root,root)
|
||||
%{_rpmmacrodir}/macros.rails
|
||||
/usr/lib/rpm/fileattrs/gemfile.attr
|
||||
/usr/lib/rpm/gemfile.rb
|
||||
|
@@ -78,8 +78,8 @@ cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose %{mod_name}-%{version}.g
|
||||
|
||||
# we need to copy parts of the %fdupes macro as rpm can't expand parameters in macro "calls" ;(
|
||||
%gem_cleanup() \
|
||||
for gem in $(/usr/bin/ruby-find-versioned gem) ; do \
|
||||
gem_base="$($gem env gemdir)" \
|
||||
for ruby in $(/usr/bin/ruby-find-versioned ruby) ; do \
|
||||
gem_base="$(${ruby} -r rubygems -e 'puts Gem.default_dir')" \
|
||||
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}${gem_base} \
|
||||
fdupes -q -p -n -r -o name %{buildroot}${gem_base} | \
|
||||
while read _file; do \
|
||||
|
Reference in New Issue
Block a user