Bug 1953150 - gem2rpm is not ruby 3.0 compatible
Summary: gem2rpm is not ruby 3.0 compatible
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rubygem-gem2rpm
Version: 34
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Vít Ondruch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-24 06:32 UTC by Kjell Irgens
Modified: 2021-06-17 01:10 UTC (History)
5 users (show)

Fixed In Version: rubygem-gem2rpm-1.0.2-1.fc35 rubygem-gem2rpm-1.0.2-1.fc34 rubygem-gem2rpm-1.0.2-1.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-08 10:56:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kjell Irgens 2021-04-24 06:32:48 UTC
Description of problem:

gem2rpm uses a previously deprecated uri-open api that has been removed from Ruby 3.0.

Version-Release number of selected component (if applicable):

rubygem-gem2rpm-1.0.1-7.fc34.noarch

How reproducible:

Always

Steps to Reproduce:
1. 

Run:

gem2rpm  --fetch something

"something" is non-existing gem, but it always fails when using --fetch

Actual results:

/usr/share/gems/gems/gem2rpm-1.0.1/bin/gem2rpm:55:in `initialize': No such file or directory @ rb_sysopen - https://rubygems.org/api/v1/gems/something.json (Errno::ENOENT)
	from /usr/share/gems/gems/gem2rpm-1.0.1/bin/gem2rpm:55:in `open'
	from /usr/share/gems/gems/gem2rpm-1.0.1/bin/gem2rpm:55:in `<top (required)>'
	from /usr/bin/gem2rpm:23:in `load'
	from /usr/bin/gem2rpm:23:in `<main>'

Expected results:

Gem fetch failed with error: 404 Not Found

Additional info:

The following change fixes the problem:

--- /usr/share/gems/gems/gem2rpm-1.0.1/bin/gem2rpm.orig	2021-04-24 08:29:46.075929560 +0200
+++ /usr/share/gems/gems/gem2rpm-1.0.1/bin/gem2rpm	2021-04-24 08:31:50.231335838 +0200
@@ -52,12 +52,12 @@
 if options[:fetch]
   gem_uri = ''
   begin
-    open("https://rubygems.org/api/v1/gems/#{gemfile}.json") do |f|
+    URI.open("https://rubygems.org/api/v1/gems/#{gemfile}.json") do |f|
       gem_uri = f.read.match(/"gem_uri":\s*"(.*?)",/m)[1]
       gemfile = URI.parse(gem_uri).path.split('/').last
       gemfile = File.join(out_dir, gemfile)
-      open(gemfile, 'w') do |gf|
-        gf.write(open(gem_uri).read)
+      URI.open(gemfile, 'w') do |gf|
+        gf.write(URI.open(gem_uri).read)
       end
     end
   rescue OpenURI::HTTPError => e

Comment 1 Vít Ondruch 2021-04-26 08:09:14 UTC
This is fixed upstream:

https://bugzilla.redhat.com/show_bug.cgi?id=1953150

I just did not find the cycles to cut the new release :/ Sorry.

Comment 3 Fedora Update System 2021-06-08 10:55:53 UTC
FEDORA-2021-f699f56eef has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-f699f56eef

Comment 4 Fedora Update System 2021-06-08 10:56:22 UTC
FEDORA-2021-f699f56eef has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2021-06-08 11:00:34 UTC
FEDORA-2021-c3ad43f275 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-c3ad43f275

Comment 6 Fedora Update System 2021-06-08 11:01:09 UTC
FEDORA-2021-b3f5710609 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-b3f5710609

Comment 7 Fedora Update System 2021-06-09 03:09:42 UTC
FEDORA-2021-c3ad43f275 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-c3ad43f275`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-c3ad43f275

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2021-06-09 03:28:54 UTC
FEDORA-2021-b3f5710609 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-b3f5710609`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-b3f5710609

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2021-06-16 20:50:17 UTC
FEDORA-2021-b3f5710609 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2021-06-17 01:10:42 UTC
FEDORA-2021-c3ad43f275 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.