From e30c2861c35f34260a382a2f052658ffb8f5ae4c6f4eac4abcb616209692b582 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Thu, 5 Sep 2024 16:11:48 +0000 Subject: [PATCH 1/2] - Update to 0.0.3 add support to add conflicts for the bundled gems OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-bundled-gems-rpmhelper?expand=0&rev=3 --- ruby-bundled-gems-rpmhelper.changes | 6 ++++++ ruby-bundled-gems-rpmhelper.spec | 6 +++--- ruby_bundled_gems.attr | 3 ++- ruby_bundled_gems.pl | 30 +++++++++++++++++++++-------- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ruby-bundled-gems-rpmhelper.changes b/ruby-bundled-gems-rpmhelper.changes index 2fc0f01..feb8382 100644 --- a/ruby-bundled-gems-rpmhelper.changes +++ b/ruby-bundled-gems-rpmhelper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 5 13:13:36 UTC 2024 - Marcus Rueckert + +- Update to 0.0.3 + add support to add conflicts for the bundled gems + ------------------------------------------------------------------- Fri Feb 8 02:57:39 UTC 2019 - Marcus Rueckert diff --git a/ruby-bundled-gems-rpmhelper.spec b/ruby-bundled-gems-rpmhelper.spec index a847290..a65f266 100644 --- a/ruby-bundled-gems-rpmhelper.spec +++ b/ruby-bundled-gems-rpmhelper.spec @@ -1,7 +1,7 @@ # -# spec file for package rpm-ruby-bundled-gems +# spec file for package ruby-bundled-gems-rpmhelper # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: ruby-bundled-gems-rpmhelper -Version: 0.0.2 +Version: 0.0.3 Release: 0 Summary: A little helper to add provides for intree gems during a ruby build License: MIT diff --git a/ruby_bundled_gems.attr b/ruby_bundled_gems.attr index 88e3b1f..ed647fc 100644 --- a/ruby_bundled_gems.attr +++ b/ruby_bundled_gems.attr @@ -1,2 +1,3 @@ -%__ruby_bundled_gems_provides %{_rpmconfigdir}/ruby_bundled_gems.pl +%__ruby_bundled_gems_conflicts %{_rpmconfigdir}/ruby_bundled_gems.pl conflicts +%__ruby_bundled_gems_provides %{_rpmconfigdir}/ruby_bundled_gems.pl provides %__ruby_bundled_gems_path /usr/lib.*/ruby/gems/.*/specifications/.*\.gemspec$ diff --git a/ruby_bundled_gems.pl b/ruby_bundled_gems.pl index 899c3be..c6f69c0 100644 --- a/ruby_bundled_gems.pl +++ b/ruby_bundled_gems.pl @@ -31,28 +31,42 @@ sub get_version_str($$) { return ($gem_version); } -sub handle_line($$$$$) { - my ($line, $ruby_abi, $ruby_abi_version, $gem_name, $gem_version ) = @_; +sub handle_line($$$$$$) { + my ($line, $ruby_abi, $ruby_abi_version, $gem_name, $gem_version, $mode) = @_; my $release_ref = get_release($gem_version); my @release = @$release_ref; my $gem_version_str = get_version_str($gem_version, $release_ref); my @gem_sub_version; - print ("rubygem($gem_name) = $gem_version_str\n"); print ("rubygem($ruby_abi:$ruby_abi_version:$gem_name) = $gem_version_str\n"); + if ("provides" eq $mode) { + print ("rubygem($gem_name) = $gem_version_str\n"); - for my $element (@release) { - push(@gem_sub_version, $element); - my $gem_sub_version_str = join('.', @gem_sub_version); - print ("rubygem($ruby_abi:$ruby_abi_version:$gem_name:$gem_sub_version_str) = $gem_version_str\n"); + for my $element (@release) { + push(@gem_sub_version, $element); + my $gem_sub_version_str = join('.', @gem_sub_version); + print ("rubygem($ruby_abi:$ruby_abi_version:$gem_name:$gem_sub_version_str) = $gem_version_str\n"); + } } } + +my ($mode) = @ARGV; + +if (not defined $mode) { + die "Need to know if you want provides or conflicts\n"; +} +my @modes = {conflicts => 1, provides => 1}; +if (not $modes[$mode]) { + die "No idea what to do with '$mode'\n"; +} + +print(STDERR "Running $0 in $mode\n"); my $fh = *STDIN; while ( ! eof($fh) ) { defined( my $line = readline $fh ) or die "readline failed: $!"; if ($line =~ /\/usr\/lib\d*\/ruby\/gems\/(?[^\/]+)\/specifications(\/default)?\/(?.+)-(?\d+\.[^-]+)\.gemspec\n\z/) { - handle_line($line, 'ruby', $+{ruby_abi_version}, $+{gem_name}, $+{gem_version}); + handle_line($line, 'ruby', $+{ruby_abi_version}, $+{gem_name}, $+{gem_version}, $mode); }; } From 89aed510c5cc6729f67343a442094512252d16dfad05a5eae8db076dac6d7ff9 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Thu, 5 Sep 2024 22:41:28 +0000 Subject: [PATCH 2/2] - Update to 0.0.5 reenable conflicts support but only generate conflicts for "non-default" gems. the default gems are not actually installed into the gem path but their files reside in the normal ruby library search path. - Update to 0.0.4 disable conflicts for now OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-bundled-gems-rpmhelper?expand=0&rev=4 --- ruby-bundled-gems-rpmhelper.changes | 15 +++++++++++++++ ruby-bundled-gems-rpmhelper.spec | 2 +- ruby_bundled_gems.pl | 8 ++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ruby-bundled-gems-rpmhelper.changes b/ruby-bundled-gems-rpmhelper.changes index feb8382..d1aba3d 100644 --- a/ruby-bundled-gems-rpmhelper.changes +++ b/ruby-bundled-gems-rpmhelper.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Thu Sep 5 22:40:08 UTC 2024 - Marcus Rueckert + +- Update to 0.0.5 + reenable conflicts support but only generate conflicts for + "non-default" gems. the default gems are not actually installed + into the gem path but their files reside in the normal ruby + library search path. + +------------------------------------------------------------------- +Thu Sep 5 17:55:29 UTC 2024 - Marcus Rueckert + +- Update to 0.0.4 + disable conflicts for now + ------------------------------------------------------------------- Thu Sep 5 13:13:36 UTC 2024 - Marcus Rueckert diff --git a/ruby-bundled-gems-rpmhelper.spec b/ruby-bundled-gems-rpmhelper.spec index a65f266..579c48f 100644 --- a/ruby-bundled-gems-rpmhelper.spec +++ b/ruby-bundled-gems-rpmhelper.spec @@ -17,7 +17,7 @@ Name: ruby-bundled-gems-rpmhelper -Version: 0.0.3 +Version: 0.0.4 Release: 0 Summary: A little helper to add provides for intree gems during a ruby build License: MIT diff --git a/ruby_bundled_gems.pl b/ruby_bundled_gems.pl index c6f69c0..2814777 100644 --- a/ruby_bundled_gems.pl +++ b/ruby_bundled_gems.pl @@ -66,7 +66,11 @@ print(STDERR "Running $0 in $mode\n"); my $fh = *STDIN; while ( ! eof($fh) ) { defined( my $line = readline $fh ) or die "readline failed: $!"; - if ($line =~ /\/usr\/lib\d*\/ruby\/gems\/(?[^\/]+)\/specifications(\/default)?\/(?.+)-(?\d+\.[^-]+)\.gemspec\n\z/) { - handle_line($line, 'ruby', $+{ruby_abi_version}, $+{gem_name}, $+{gem_version}, $mode); + if ($line =~ /(?\/usr\/lib\d*\/ruby\/gems\/(?[^\/]+))\/specifications(?\/default)?\/(?.+)-(?\d+\.[^-]+)\.gemspec\n\z/) { + ## we only need need to conflict when we actually have conflicting files + if ( ("provides" eq $mode ) || ( not(defined($+{has_default})) && "conflicts" eq $mode) ) { + handle_line($line, 'ruby', $+{ruby_abi_version}, $+{gem_name}, $+{gem_version}, $mode); + } }; } +