diff --git a/ruby-bundled-gems-rpmhelper.changes b/ruby-bundled-gems-rpmhelper.changes index 2fc0f01..d1aba3d 100644 --- a/ruby-bundled-gems-rpmhelper.changes +++ b/ruby-bundled-gems-rpmhelper.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +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 + +- 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..579c48f 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.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.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..2814777 100644 --- a/ruby_bundled_gems.pl +++ b/ruby_bundled_gems.pl @@ -31,28 +31,46 @@ 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}); + 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); + } }; } +