Hello everyone,

while trying to package the ruby framework rails [0] I stumbled over the fact that ruby itself is shipping an assortment of "default gems" which they call "Standard Library" [1] [2]
and something called "Bundled Gems" [3], which is another set of "default gems".
The problem I see in these gems is that they are pulled into the ruby source repo [4] from their dedicated original sources before a ruby release and then get used in the release.
Furthermore ruby itself does not release a new version of itself whenever a gem of this standard library updates, which means that over time sooner or later most of these gems in the bundle
will be out-of-date.
Now apparently ruby has a general solution for that. You can have multiple versions of one gem installed, the "default" versions do show up with a default prefix in the `gem list` output.

So much for the actual ruby state. Now I would like to highlight some points I found out about how Arch Linux is packaging ruby and the issues I see with it.

Our ruby package [5] is currently removing a total of nine pre-shipped gems from the main ruby release with the comment that they are shipped in seperate packages [6].
I recently checked and found out that three of these removed gems are not provided as packages (anymore?). Namely rbs, typerof and erb.
Furthermore the PKGBUILD has code in there which states that it removes *all* bundled gems to avoid conflicts [7], but when I run a `gem list | grep 'default'` I still see the default gems.
After some research I found out the reason is because the path in which the default gems are located are not the path that we are removing with these three lines of code.
It could be that the location of these default gems changed in some version and was never updated.

The problem I see in the current situation is that we have most of the default gems still installed and then some of them get upgraded (sometimes even to a higher major version) by dedicated packages.
This can potentially break dependency changes if one of the not upgraded default gems is requiring the gem that was upgraded to a new major version.

From my point of view the only real fix for this is to make sure that we again remove all the default gems so that they can be packaged seperatly. Whether or not we want to provide all gems from the
"standard library" and "bundled gems" is then a different question and would in the end require more ruby packages.
Also I would recomment to add a comment to the PKGBUILD file of these gems stating that they are part of the "standard library" / "bundled gems" and such shouldn't be dropped from the repos in the future.

We also could think about putting all the "standard library" gems (and maybe even the "bundled gems") in a package group called "ruby-stdlib" or a meta-package (which I think is better).
That way users could easily install all of them with one command and we also know which packages belong to the "ruby standard library".

One side effect I see with this approach is that we currently have "hidden dependencies" on some of the standard library gems like in case of ruby-nokogiri [8], which is depending on ruby-racc which is not listed in the PKGBUILD file.
Currently this package only works because racc is one of the gems in the standard library [9] and such pre-installed. If we now cleanup the ruby package we need to fix such issues.


Best regards
Segaja


[0] https://rubyonrails.org/
[1] https://rubyreferences.github.io/rubyref/stdlib.html
[2] https://ruby-doc.org/stdlib-3.1.2/
[3] https://rubyreferences.github.io/rubyref/stdlib/bundled.html
[4] https://github.com/ruby/ruby/tree/master/lib
[5] https://archlinux.org/packages/extra/x86_64/ruby/
[6] https://github.com/archlinux/svntogit-packages/blob/packages/ruby/trunk/PKGBUILD#L56-L79=
[7] https://github.com/archlinux/svntogit-packages/blob/packages/ruby/trunk/PKGBUILD#L81-L84=
[8] https://bugs.archlinux.org/task/71500
[9] https://rubyreferences.github.io/rubyref/stdlib/string-utilities/racc.html