Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ruby-common for openSUSE:Factory 
checked in at 2026-06-13 18:45:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ruby-common (Old)
 and      /work/SRC/openSUSE:Factory/.ruby-common.new.1981 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ruby-common"

Sat Jun 13 18:45:36 2026 rev:35 rq:1358938 version:4.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ruby-common/ruby-common.changes  2026-05-20 
15:24:19.157639995 +0200
+++ /work/SRC/openSUSE:Factory/.ruby-common.new.1981/ruby-common.changes        
2026-06-13 18:46:19.342899821 +0200
@@ -1,0 +2,6 @@
+Fri Jun 12 09:22:31 UTC 2026 - Marcus Rueckert <[email protected]>
+
+- Fix gem_packages template for the alts case. We were always using
+  spec.name when it should have been the loop variable executable.
+
+-------------------------------------------------------------------
@@ -5,0 +12,12 @@
+
+-------------------------------------------------------------------
+Tue May 12 13:01:01 UTC 2026 - Marcus Rueckert <[email protected]>
+
+- Fix alts support for multiple ruby versions by making the config
+  files non overlapping
+
+-------------------------------------------------------------------
+Mon May 11 22:05:57 UTC 2026 - Marcus Rueckert <[email protected]>
+
+- replace update-alternatives with alts
+  (ref: 
https://en.opensuse.org/openSUSE:Migrating_to_libalternatives_with_alts) 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ruby-common.spec ++++++
--- /var/tmp/diff_new_pack.nfwsq2/_old  2026-06-13 18:46:20.346941481 +0200
+++ /var/tmp/diff_new_pack.nfwsq2/_new  2026-06-13 18:46:20.350941647 +0200
@@ -21,6 +21,12 @@
 %define _rpmmacrodir /etc/rpm
 %endif
 
+%if 0%{suse_version} >= 1600
+%bcond_without alts
+%else
+%bcond_with alts
+%endif
+
 Name:           ruby-common
 Version:        4.0.0
 Release:        0
@@ -112,6 +118,12 @@
 %prep
 
 %build
+%if %{with alts}
+perl -p -i.back -e 's|use_alts=false|use_alts=true|g' %{SOURCE6} %{SOURCE11}
+diff -urN %{SOURCE11}{.back,} ||:
+diff -urN %{SOURCE6}{.back,}  ||:
+%endif
+
 ruby_real_path="/usr/bin/ruby.%{rb_default_ruby_suffix}"
 for f in $(grep -r -l '^#./usr/bin/ruby' ${RPM_SOURCE_DIR}) ; do
   perl -p -i.back -e 
"s|^#\\!.*ruby(?<suffix>\S+)?(?<optional_args>\s+\S+.*)?|#\\!${ruby_real_path}$+{optional_args}\n|g"
 $f

++++++ gem_install.sh ++++++
--- /var/tmp/diff_new_pack.nfwsq2/_old  2026-06-13 18:46:20.430944966 +0200
+++ /var/tmp/diff_new_pack.nfwsq2/_new  2026-06-13 18:46:20.434945132 +0200
@@ -38,7 +38,6 @@
 options.defaultgem=nil
 options.gemfile=nil
 options.otheropts=nil
-options.buildroot=nil
 options.docfiles=[]
 options.gemname=nil
 options.gemversion=nil
@@ -51,8 +50,10 @@
 options.symlinkbinaries=false
 options.verbose = false
 options.rpmsourcedir = ENV['RPM_SOURCE_DIR'] || '/home/abuild/rpmbuild/SOURCES'
-options.rpmbuildroot = ENV['RPM_BUILD_ROOT'] || 
'/home/abuild/rpmbuild/BUILDROOT/just-testing'
+options.buildroot=options.rpmbuildroot = ENV['RPM_BUILD_ROOT'] || 
'/home/abuild/rpmbuild/BUILDROOT/just-testing'
 options.parsed_config = nil
+options.use_alts=false
+options.libalternative_basedir="/usr/share/libalternatives/"
 
 GILogger = Logger.new(STDERR)
 GILogger.level=Logger::DEBUG
@@ -127,6 +128,7 @@
   end
   opts.on('--build-root [BUILDROOT]', 'Path to rpm buildroot') do |buildroot|
     options.buildroot = buildroot
+    options.rpmbuildroot = buildroot
   end
   # Boolean switches
   opts.on('--[no-]symlink-binaries', 'Create all the version symlinks for the 
binaries') do |v|
@@ -231,12 +233,60 @@
 rpmname="#{options.rubyprefix}-rubygem-#{options.gemname}#{options.gemsuffix}"
 GILogger.info "RPM name: #{rpmname}"
 pwd = Dir.pwd
-bindir = File.join(options.rpmbuildroot, Gem.bindir)
+bindir = File.join(options.buildroot, Gem.bindir)
 GILogger.info "bindir: #{bindir}"
+
+def segment_to_int(version_segments, index, default)
+  begin v=Integer(version_segments[index]) rescue v=default end
+  return v
+end
+
+def compute_segments(v1,v2,v3)
+  return v1*10000+v2*100+v3
+end
+
+spec_version_segments=spec.version.segments
+version_weight=compute_segments(
+  segment_to_int(spec_version_segments, 0, 1),
+  segment_to_int(spec_version_segments, 1, 0),
+  segment_to_int(spec_version_segments, 2, 0)
+)
+
+ruby_version_segments=Gem::Version.new(RUBY_VERSION).segments
+ruby_weight=compute_segments(
+  segment_to_int(ruby_version_segments, 0, 1),
+  segment_to_int(ruby_version_segments, 1, 0),
+  segment_to_int(ruby_version_segments, 2, 0)
+)
+
+weight=version_weight+ruby_weight
+
+def write_alts_file(alts_dir, full_versioned, target_subdir, weight)
+  config_dir=File.join(alts_dir, target_subdir)
+  config_filename=File.join(config_dir, "#{weight}.conf")
+  config_content= <<EOF
+binary=#{Gem.bindir}/#{full_versioned}
+group=#{target_subdir}
+EOF
+  if FileUtils.mkdir_p(config_dir)
+    unless File.write(config_filename, config_content)
+      GILogger.error "Creating #{config_file} failed"
+    end
+  else
+    GILogger.error "Creating #{config_dir} failed"
+  end
+end
+
 if options.symlinkbinaries && File.exist?(bindir)
-  br_ua_dir = File.join(options.rpmbuildroot, options.ua_dir)
-  GILogger.info "Creating upate-alternatives dir: #{br_ua_dir}"
-  FileUtils.mkdir_p(br_ua_dir)
+  if options.use_alts
+    br_alts_dir=File.join(options.buildroot, options.libalternative_basedir)
+    GILogger.info "Creating libalternatives dir: #{br_alts_dir}"
+    FileUtils.mkdir_p(br_alts_dir)
+  else
+    br_ua_dir = File.join(options.buildroot, options.ua_dir)
+    GILogger.info "Creating upate-alternatives dir: #{br_ua_dir}"
+    FileUtils.mkdir_p(br_ua_dir)
+  end
   begin
     Dir.chdir(bindir)
     GILogger.info "executables: #{spec.executables.inspect}"
@@ -250,14 +300,23 @@
       patchfile(full_versioned,  />= 0(\.a)?/, "= #{options.gemversion}")
       # unversioned
       [unversioned, ruby_versioned, gem_versioned].each do |linkname|
-        ua_path   = File.join(options.ua_dir, linkname)
-        GILogger.info "Symlinking '#{linkname}' -> '#{ua_path}'"
-        File.symlink(ua_path, linkname) unless File.symlink? linkname
+        if options.use_alts
+          link_path = File.join(options.buildroot, Gem.bindir, linkname)
+          write_alts_file(br_alts_dir, full_versioned, linkname, weight)
+          GILogger.info "Symlinking 'alts' -> '#{link_path}'"
+          File.symlink('/usr/bin/alts', link_path) unless File.symlink? 
link_path
+        else
+          ua_path   = File.join(options.ua_dir, linkname)
+          GILogger.info "Symlinking '#{linkname}' -> '#{ua_path}'"
+          File.symlink(ua_path, linkname) unless File.symlink? linkname
+        end
       end
     end
   ensure
     Dir.chdir(pwd)
   end
+else
+  GILogger.error "Skipping symlinking binaries #{options.symlinkbinaries} 
#{File.exist?(bindir)} #{bindir}"
 end
 
 # shebang line fix
@@ -273,7 +332,7 @@
 
 unless options.docfiles.empty?
   GILogger.info "Linking documentation"
-  docdir = File.join(options.rpmbuildroot, options.docdir, rpmname)
+  docdir = File.join(options.buildroot, options.docdir, rpmname)
   FileUtils.mkdir_p(docdir)
 
   options.docfiles.each do |fname|
@@ -283,6 +342,6 @@
   end
 end
 
-system("chmod -R u+w,go+rX,go-w #{options.rpmbuildroot}")
-#system("find #{options.rpmbuildroot} -ls")
+system("chmod -R u+w,go+rX,go-w #{options.buildroot}")
+#system("find #{options.buildroot} -ls")
 

++++++ gem_packages.spec.erb ++++++
--- /var/tmp/diff_new_pack.nfwsq2/_old  2026-06-13 18:46:20.482947124 +0200
+++ /var/tmp/diff_new_pack.nfwsq2/_new  2026-06-13 18:46:20.486947290 +0200
@@ -1,5 +1,7 @@
 <%
 
+  use_alts=false
+
   begin
     require 'rbconfigpackagingsupport'
   rescue LoadError => ex
@@ -50,12 +52,31 @@
     return nil
   end
 
+  def self.segment_to_int(version_segments, index, default)
+    begin v=Integer(version_segments[index]) rescue v=default end
+    return v
+  end
+
+  def self.compute_segments(v1,v2,v3)
+    return v1*10000+v2*100+v3
+  end
+
   def self.get_mod_weight(spec)
-    versions=spec.version.to_s.split('.')
-    begin v1=Integer(versions[0]) rescue v1=1 end
-    begin v2=Integer(versions[1]) rescue v2=0 end
-    begin v3=Integer(versions[2]) rescue v3=0 end
-    weight=v1*10000+v2*100+v3
+    spec_version_segments=spec.version.segments
+    version_weight=self.compute_segments(
+      self.segment_to_int(spec_version_segments, 0, 1),
+      self.segment_to_int(spec_version_segments, 1, 0),
+      self.segment_to_int(spec_version_segments, 2, 0)
+    )
+
+    ruby_version_segments=Gem::Version.new(RUBY_VERSION).segments
+    ruby_weight=self.compute_segments(
+      self.segment_to_int(ruby_version_segments, 0, 1),
+      self.segment_to_int(ruby_version_segments, 1, 0),
+      self.segment_to_int(ruby_version_segments, 2, 0)
+    )
+
+    weight=version_weight+ruby_weight
   end
 
   def self.map_executable(config, executable)
@@ -114,6 +135,7 @@
 
   mod_full_name      = "#{spec.name}-#{spec.version}"
   mod_weight         = get_mod_weight(spec)
+  alts_config_filename = "#{mod_weight}.conf"
 
   gem_platform       = Gem::Platform.new(RbConfig::CONFIG["arch"]).to_s
   rb_bindir          = RbConfig::CONFIG['bindir']
@@ -152,8 +174,15 @@
 <% end -%>
 Summary:        <%= config[:summary] or spec.summary %>
 <% unless spec.executables.empty? -%>
+<% if use_alts -%>
+Requires(post):  alts
+Requires(preun): alts
+Requires:        alts
+<% else -%>
 Requires(preun): update-alternatives
-Requires(post): update-alternatives
+Requires(post):  update-alternatives
+Requires:        update-alternatives
+<% end -%>
 <% end -%>
 <% if has_plugins -%>
 Conflicts:      rubygem(<%= rb_pkg_abi %>) = %{version}
@@ -209,6 +238,7 @@
 <% end -%>
 
 <% unless spec.executables.empty? -%>
+<% unless use_alts -%>
 %post -n <%= pkg_basename %><%= config[:version_suffix] %>
 <% spec.executables.each do |executable| -%>
 /usr/sbin/update-alternatives --install \
@@ -228,6 +258,7 @@
 <% end -%>
 fi
 <% end -%>
+<% end -%>
 
 %files -n <%= pkg_basename %><%= config[:version_suffix] %>
 %defattr(-,root,root,-)
@@ -244,10 +275,19 @@
 <%= rb_bindir %>/<%= "#{executable}#{rb_suffix}" %>
 <%= rb_bindir %>/<%= "#{executable}-#{spec.version}" %>
 <%= rb_bindir %>/<%= map_executable(config, executable) %>
+<% if use_alts -%>
+%dir %{_datadir}/libalternatives/<%= executable %>-<%= spec.version -%>/
+%dir %{_datadir}/libalternatives/<%= executable %><%= rb_suffix -%>/
+%dir %{_datadir}/libalternatives/<%= executable %>/
+%{_datadir}/libalternatives/<%= executable %>-<%= spec.version -%>/<%= 
alts_config_filename %>
+%{_datadir}/libalternatives/<%= executable %><%= rb_suffix -%>/<%= 
alts_config_filename %>
+%{_datadir}/libalternatives/<%= executable %>/<%= alts_config_filename %>
+<% else -%>
 %ghost <%= rb_sysconfdir %>/alternatives/<%= map_executable(config, 
executable) %>
 %ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}#{rb_suffix}" %>
 %ghost <%= rb_sysconfdir %>/alternatives/<%= "#{executable}-#{spec.version}" %>
 <% end -%>
+<% end -%>
 # cache file
 <%= gem_cache_dir %>/<%= mod_full_name %>.gem
 <%= gem_gem_dir %>

Reply via email to