- 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
This commit is contained in:
Marcus Rückert 2024-09-05 16:11:48 +00:00 committed by Git OBS Bridge
parent 12e6060d3b
commit e30c2861c3
4 changed files with 33 additions and 12 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 5 13:13:36 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
- Update to 0.0.3
add support to add conflicts for the bundled gems
-------------------------------------------------------------------
Fri Feb 8 02:57:39 UTC 2019 - Marcus Rueckert <mrueckert@suse.de>

View File

@ -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

View File

@ -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$

View File

@ -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\/(?<ruby_abi_version>[^\/]+)\/specifications(\/default)?\/(?<gem_name>.+)-(?<gem_version>\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);
};
}