Rubygems -- Can't search for reverse dependencies for a non-current version of a gem

448 views
Skip to first unread message

Tom Hundt

unread,
May 29, 2020, 12:18:22 AM5/29/20
to rubygems.org
Hi, I was just troubleshooting a dependencies problem and someone mentioned your site had a way to look up reverse dependencies.  

I used gem dependency <gem-name> --reverse-dependencies and actually figured out the problem, but apparently this requires the gem(s) in question be already installed in order to work.  So, I thought I'd see explore how the "other way" worked.

Turns out that your site will only look up reverse dependencies for the latest version of a gem.

For example, in my case it was mysql2, version 0.3 was fighting with version 0.5.3.  

I can look up reverse dependencies for 0.5.3 by going to https://rubygems.org and searching for "mysql2" and clicking through to its details
I can then look for reverse dependencies by clicking "Reverse dependencies" on the right side, under "Links".
This shows me the dependencies for 0.5.3.  (So far, so good.)

The URL for the that search was https://rubygems.org/gems/mysql2/reverse_dependencies (no version is specified).

If I wanted to look using mysql2 version 0.3.13, I could have clicked on that version -- putting me on detail page https://rubygems.org/gems/mysql2/versions/0.3.13 -- and then clicked "Reverse dependencies" on the right... but this still gives me the search https://rubygems.org/gems/mysql2/reverse_dependencies which displays the dependencies for 0.5.3 -- not what was wanted.

It looks to me that not passing the version in the search is a missing part of the feature.  

Kind regards,

-Tom Hundt



Aditya Prakash

unread,
May 29, 2020, 12:22:48 PM5/29/20
to rubyge...@googlegroups.com
Hi Tom,


> putting me on detail page https://rubygems.org/gems/mysql2/versions/0.3.13 -- and then clicked "Reverse dependencies" on the right... but this still gives me the search https://rubygems.org/gems/mysql2/reverse_dependencies which displays the dependencies for 0.5.3

Your expectation of seeing 0.3.13 reserved dependencies when you click the link of 0.3.13 version page is very reasonable. How we can go about meeting this expectation is a bit complicated.
MySQL 0.3.13 would be be considered a reserve dependency of a gem version for any of these requirements in the gem version spec: ">= 0.0.1", "~> 0.3", ">= 0.2.1". We would have to duplicate what `gem dependency <gem-name> --reverse-dependencies is doing for all records which refer MySQL gem as a dependency on each request. I hope this gives you some idea of why it is a bit difficult/expensive to find out the reserve dependency of a particular version. There could most certainly be better ways of doing this like precomputing or caching reservse dependencies, please feel to recommend an optimized solution I haven't thought of yet.
The header of the reverse dependency page shows which version we are showing the reserve dependencies for.

Aditya Prakash

unread,
May 29, 2020, 2:11:49 PM5/29/20
to rubyge...@googlegroups.com
>  The header of the reverse dependency page shows which version we are showing the reserve dependencies for.

I validated this part. This isn't true for the exact reason I explained above. We don't check for requirements constrains when showing reserve dependency. ie the page doesn't show reserve dependencies for MySQL 0.5.3 but just MySQL. I will get 0.5.3 part removed.
Reply all
Reply to author
Forward
0 new messages