- update suse.patch:

handle ERB.new for older ruby versions

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/rubygem-gem2rpm?expand=0&rev=62
This commit is contained in:
Marcus Rückert 2024-10-08 10:59:46 +00:00 committed by Git OBS Bridge
parent 025213f027
commit 495937ecd6
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 8 10:52:39 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
- update suse.patch:
handle ERB.new for older ruby versions
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 8 00:26:29 UTC 2024 - Marcus Rueckert <mrueckert@suse.de> Tue Oct 8 00:26:29 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>

View File

@ -184,7 +184,7 @@ index 0000000..2d4adf0
+# /bin/echo foo +# /bin/echo foo
+# +#
diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb diff --git a/lib/gem2rpm.rb b/lib/gem2rpm.rb
index 017ecd1..349c897 100644 index 017ecd1..3db6853 100644
--- a/lib/gem2rpm.rb --- a/lib/gem2rpm.rb
+++ b/lib/gem2rpm.rb +++ b/lib/gem2rpm.rb
@@ -31,12 +31,15 @@ module Gem2Rpm @@ -31,12 +31,15 @@ module Gem2Rpm
@ -205,15 +205,21 @@ index 017ecd1..349c897 100644
download_path = "" download_path = ""
unless local unless local
begin begin
@@ -46,7 +49,7 @@ module Gem2Rpm @@ -46,8 +49,12 @@ module Gem2Rpm
$stderr.puts e.inspect $stderr.puts e.inspect
end end
end end
- template = ERB.new(template, 0, '-') - template = ERB.new(template, 0, '-')
+ template = ERB.new(template, trim_mode: '-') - out.puts template.result(binding)
out.puts template.result(binding) + erb_instance = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6')
+ ERB.new(str=template, trim_mode: '-')
+ else
+ ERB.new(str=template, safe_mode=0, trim_mode='-')
+ end
+ out.puts erb_instance.result(binding)
rescue Gem::Exception => e rescue Gem::Exception => e
puts e puts e
end
diff --git a/lib/gem2rpm/specification.rb b/lib/gem2rpm/specification.rb diff --git a/lib/gem2rpm/specification.rb b/lib/gem2rpm/specification.rb
index 9a8d5a1..2e4f7b2 100644 index 9a8d5a1..2e4f7b2 100644
--- a/lib/gem2rpm/specification.rb --- a/lib/gem2rpm/specification.rb