#9 Add symbolic links to rdoc for the compatibility of upstream Ruby.
Closed 3 years ago by vondruch. Opened 3 years ago by jaruga.

file modified
+4
@@ -608,6 +608,8 @@

  mkdir -p %{buildroot}%{gem_dir}/gems/rdoc-%{rdoc_version}/lib

  mv %{buildroot}%{ruby_libdir}/rdoc* %{buildroot}%{gem_dir}/gems/rdoc-%{rdoc_version}/lib

  mv %{buildroot}%{gem_dir}/specifications/default/rdoc-%{rdoc_version}.gemspec %{buildroot}%{gem_dir}/specifications

+ ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc.rb %{buildroot}%{ruby_libdir}/rdoc.rb

+ ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc %{buildroot}%{ruby_libdir}/rdoc

  

  mkdir -p %{buildroot}%{gem_dir}/gems/bigdecimal-%{bigdecimal_version}/lib

  mkdir -p %{buildroot}%{_libdir}/gems/%{name}/bigdecimal-%{bigdecimal_version}
@@ -783,6 +785,7 @@

  %exclude %{ruby_libdir}/json.rb

  %exclude %{ruby_libdir}/openssl.rb

  %exclude %{ruby_libdir}/psych.rb

+ %exclude %{ruby_libdir}/rdoc.rb

  %{ruby_libdir}/cgi

  %{ruby_libdir}/digest

  %{ruby_libdir}/drb
@@ -968,6 +971,7 @@

  %{_mandir}/man1/irb.1*

  

  %files -n rubygem-rdoc

+ %{ruby_libdir}/rdoc*

  %{_bindir}/rdoc

  %{_bindir}/ri

  %{gem_dir}/gems/rdoc-%{rdoc_version}

This PR is for private-ruby-2.5 branch. But I wish finally that is merged on master branch too.

This PR is compatibility of SCL ruby.
I found a difference between Fedora Ruby and SCL ruby.
I do not know when it was included in SCL ruby.

Anyway I would send this PR.

I compared Upstream Ruby and Fedora Ruby's directory structure.

Upstream Ruby (I used 2.5.0 preview1 version): /usr/local/ruby-2.5.0.pre1/lib/ruby/2.5.0/
Fedora Ruby (I used previate-ruby-2.5 branch r61214): /usr/share/ruby

Upstream Ruby

$ cd /usr/local/ruby-2.5.0.pre1/lib/ruby/2.5.0/
$ \ls | LC_ALL=C sort > ruby_upstream_files.txt

Fedora mock environment

$ cd /usr/share/ruby
$ \ls | LC_ALL=C sort > ruby_fed_files.txt
$ diff ruby_upstream_files.txt ruby_fed_files.txt 
6d5
< bundler
21a21,22
> fiddle
> fiddle.rb
60,61d60
< rdoc
< rdoc.rb
70,71d68
< rubygems
< rubygems.rb
92a90
> vendor_ruby
96d93
< x86_64-linux

or by unified format (-u)

$ diff -u ruby_upstream_files.txt ruby_fed_files.txt 
--- ruby_upstream_files.txt 2017-12-18 20:40:35.351795204 +0100
+++ ruby_fed_files.txt  2017-12-18 20:41:11.085753122 +0100
@@ -3,7 +3,6 @@
 base64.rb
 benchmark.rb
 bigdecimal
-bundler
 bundler.rb
 cgi
 cgi.rb
@@ -19,6 +18,8 @@
 e2mmap.rb
 erb.rb
 expect.rb
+fiddle
+fiddle.rb
 fileutils.rb
 find.rb
 forwardable
@@ -57,8 +58,6 @@
 psych
 psych.rb
 racc
-rdoc
-rdoc.rb
 resolv-replace.rb
 resolv.rb
 rexml
@@ -67,8 +66,6 @@
 ripper.rb
 rss
 rss.rb
-rubygems
-rubygems.rb
 scanf.rb
 securerandom.rb
 set.rb
@@ -90,9 +87,9 @@
 unicode_normalize
 uri
 uri.rb
+vendor_ruby
 weakref.rb
 webrick
 webrick.rb
-x86_64-linux
 yaml
 yaml.rb

This PR is to create rdoc.rb and rdoc directory's symbolic links at /usr/share/ruby for the compatibility of Upstream Ruby.
If this PR is merged, it is better when merging Fedora Ruby to SCL Ruby.

After this modification, I tested below things.

Installed all the RPMs for ruby.spec at first. Then

<mock-chroot> sh-4.4# pwd
/usr/share/ruby

<mock-chroot> sh-4.4# ls -l rdoc*
lrwxrwxrwx 1 root root 40 Dec 19 12:05 rdoc -> /usr/share/gems/gems/rdoc-6.0.0/lib/rdoc
lrwxrwxrwx 1 root root 43 Dec 19 12:05 rdoc.rb -> /usr/share/gems/gems/rdoc-6.0.0/lib/rdoc.rb

<mock-chroot> sh-4.4# rpm -qf rdoc
rubygem-rdoc-6.0.0-0.1.r61214.fc28.noarch

<mock-chroot> sh-4.4# rpm -qf rdoc.rb-
rubygem-rdoc-6.0.0-0.1.r61214.fc28.noarch

Removed rubygem-rdoc and the dependency packages.

<mock-chroot> sh-4.4# rpm -e rubygem-rdoc rubygems-devel ruby-doc

<mock-chroot> sh-4.4# ls rdoc*
ls: cannot access 'rdoc*': No such file or directory

Could you please elaborate what real world scenario this PR fixes?

Right now I do not know how the modification fixes the real world scenario.
I have to check it.

Below is after this PR's modificaiton.
You can see that bigdecimal, io, json, openssl, and psych has symbolic links as well.

<mock-chroot> sh-4.4# cd /usr/share/ruby

<mock-chroot> sh-4.4# ls -l
total 1228
-rw-r--r-- 1 root root  3573 Feb  9  2017 abbrev.rb
-rw-r--r-- 1 root root  3375 Feb 10  2017 base64.rb
-rw-r--r-- 1 root root 18322 Jan  3  2017 benchmark.rb
lrwxrwxrwx 1 root root    52 Dec 19 12:05 bigdecimal -> /usr/share/gems/gems/bigdecimal-1.3.3/lib/bigdecimal
-rw-r--r-- 1 root root 16924 Nov  2 00:29 bundler.rb
drwxr-xr-x 3 root root  4096 Dec 19 12:18 cgi
-rw-r--r-- 1 root root 10038 Feb 18  2017 cgi.rb
-rw-r--r-- 1 root root  9716 Dec 12 12:56 cmath.rb
-rw-r--r-- 1 root root 84867 Sep 12 10:38 csv.rb
-rw-r--r-- 1 root root  1003 Dec 19 12:05 date.rb
-rw-r--r-- 1 root root 30694 Jan  5  2017 debug.rb
-rw-r--r-- 1 root root 10695 Dec 12 12:56 delegate.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 digest
-rw-r--r-- 1 root root  2894 Dec 19 12:05 digest.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 drb
-rw-r--r-- 1 root root    50 Dec 16  2015 drb.rb
-rw-r--r-- 1 root root  4038 Mar  1  2017 e2mmap.rb
-rw-r--r-- 1 root root  6460 Aug 25 17:47 English.rb
-rw-r--r-- 1 root root 28026 Oct 21 17:02 erb.rb
-rw-r--r-- 1 root root  2217 Dec 19 12:05 expect.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 fiddle
-rw-r--r-- 1 root root  1722 Dec 19 12:05 fiddle.rb
-rw-r--r-- 1 root root 45189 Oct 20 09:03 fileutils.rb
-rw-r--r-- 1 root root  2532 Sep 15 19:00 find.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 forwardable
-rw-r--r-- 1 root root  8690 Dec 12 12:56 forwardable.rb
-rw-r--r-- 1 root root 15787 Sep  2 04:05 getoptlong.rb
lrwxrwxrwx 1 root root    44 Dec 19 12:05 io -> /usr/share/gems/gems/io-console-0.4.6/lib/io
-rw-r--r-- 1 root root 19982 Dec 12 12:56 ipaddr.rb
drwxr-xr-x 5 root root  4096 Dec 19 12:18 irb
-rw-r--r-- 1 root root 20626 Dec 12 12:25 irb.rb
lrwxrwxrwx 1 root root    40 Dec 19 12:05 json -> /usr/share/gems/gems/json-2.1.0/lib/json
lrwxrwxrwx 1 root root    43 Dec 19 12:05 json.rb -> /usr/share/gems/gems/json-2.1.0/lib/json.rb
-rw-r--r-- 1 root root  5906 Dec 19 12:05 kconv.rb
-rw-r--r-- 1 root root 24090 Jul 20 18:47 logger.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 matrix
-rw-r--r-- 1 root root 54472 Dec 12 12:56 matrix.rb
-rw-r--r-- 1 root root 86397 Dec 19 12:02 mkmf.rb
-rw-r--r-- 1 root root  7432 Oct  8 09:00 monitor.rb
-rw-r--r-- 1 root root  2070 Oct  8 09:00 mutex_m.rb
drwxr-xr-x 3 root root  4096 Dec 19 12:18 net
-rw-r--r-- 1 root root  5971 Jan 13  2017 observer.rb
-rw-r--r-- 1 root root 21447 Oct 21 09:00 open3.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 openssl
lrwxrwxrwx 1 root root    55 Dec 19 12:05 openssl.rb -> /usr/share/gems/gems/openssl-2.1.0.beta2/lib/openssl.rb
-rw-r--r-- 1 root root 25563 Oct 21 08:22 open-uri.rb
-rw-r--r-- 1 root root    59 Dec 16  2015 optionparser.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 optparse
-rw-r--r-- 1 root root 58627 Jul 24 03:56 optparse.rb
-rw-r--r-- 1 root root 10401 Dec 12 12:56 ostruct.rb
-rw-r--r-- 1 root root 16479 Dec 19 12:05 pathname.rb
-rw-r--r-- 1 root root 14778 Dec 11 05:46 pp.rb
-rw-r--r-- 1 root root 16276 Nov 10  2015 prettyprint.rb
-rw-r--r-- 1 root root 12776 May 20  2017 prime.rb
-rw-r--r-- 1 root root   235 Jan 15  2017 profile.rb
-rw-r--r-- 1 root root  4647 Jan 18  2017 profiler.rb
-rw-r--r-- 1 root root 15057 Jan 17  2017 pstore.rb
lrwxrwxrwx 1 root root    42 Dec 19 12:05 psych -> /usr/share/gems/gems/psych-3.0.0/lib/psych
lrwxrwxrwx 1 root root    45 Dec 19 12:05 psych.rb -> /usr/share/gems/gems/psych-3.0.0/lib/psych.rb
drwxr-xr-x 3 root root  4096 Dec 19 12:18 racc
-rw-r--r-- 1 root root 74465 Oct 21 15:58 resolv.rb
-rw-r--r-- 1 root root  1805 Nov 14  2015 resolv-replace.rb
drwxr-xr-x 7 root root  4096 Dec 19 12:18 rexml
drwxr-xr-x 2 root root  4096 Dec 19 12:18 rinda
drwxr-xr-x 2 root root  4096 Dec 19 12:18 ripper
-rw-r--r-- 1 root root  2494 Dec 19 12:05 ripper.rb
drwxr-xr-x 5 root root  4096 Dec 19 12:18 rss
-rw-r--r-- 1 root root  2940 Dec 16  2015 rss.rb
-rw-r--r-- 1 root root 24122 Oct 21 14:34 scanf.rb
-rw-r--r-- 1 root root  8815 Oct 25 09:28 securerandom.rb
-rw-r--r-- 1 root root 24590 Nov 22 22:13 set.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 shell
-rw-r--r-- 1 root root 11644 Nov  6  2016 shell.rb
-rw-r--r-- 1 root root  6817 Nov  5  2016 shellwords.rb
-rw-r--r-- 1 root root  4136 Oct  8 09:00 singleton.rb
-rw-r--r-- 1 root root 44559 Dec 19 12:05 socket.rb
-rw-r--r-- 1 root root  7470 Sep 18  2016 sync.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 syslog
-rw-r--r-- 1 root root 11408 Dec 12 12:56 tempfile.rb
-rw-r--r-- 1 root root  3411 Oct  8 09:00 thwait.rb
-rw-r--r-- 1 root root  3899 Dec 12 12:56 timeout.rb
-rw-r--r-- 1 root root 22913 Oct 20 03:03 time.rb
-rw-r--r-- 1 root root  4066 Nov 15 09:02 tmpdir.rb
-rw-r--r-- 1 root root  6578 Oct  8 09:00 tracer.rb
-rw-r--r-- 1 root root 14642 Nov 14  2015 tsort.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 unicode_normalize
-rw-r--r-- 1 root root 10011 Jul  5 11:05 un.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 uri
-rw-r--r-- 1 root root  3174 Dec 16  2015 uri.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:05 vendor_ruby
-rw-r--r-- 1 root root  1473 Oct 24 20:08 weakref.rb
drwxr-xr-x 4 root root  4096 Dec 19 12:18 webrick
-rw-r--r-- 1 root root  6881 Dec 23  2015 webrick.rb
drwxr-xr-x 2 root root  4096 Dec 19 12:18 yaml
-rw-r--r-- 1 root root  1768 Dec 12 12:56 yaml.rb

@vondruch you are adapting same kind of way for json in past time.
Do you remember why you did commit this?

Make symlinks for json gem.
https://src.fedoraproject.org/rpms/ruby/c/b1466a4c8f2cd28556efcd93c5dc539bff041be9?branch=master

@vondruch you are adapting same kind of way for json in past time.
Do you remember why you did commit this?
Make symlinks for json gem.
https://src.fedoraproject.org/rpms/ruby/c/b1466a4c8f2cd28556efcd93c5dc539bff041be9?branch=master

Probably due to this issue:

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

RDoc is not needed by anything, except RubyGems, where the dependency is optional. RDoc was historically independent gem and everybody was used to specify it explicitly.

I would very much appreciate if the RDoc was included in Ruby as "bundled" gem, i.e. extracted from stdlib and shipped the same way rake, minitest or test-unit are.

@jaruga, you would also need to change

Recommends: rubygem(rdoc) >= %{rdoc_version}

to

Requires: rubygem(rdoc) >= %{rdoc_version}

to ensure it's always installed, correct?
That is IMHO unnecessary dependency user might not always want.

@pvalena

to ensure it's always installed, correct?

No, I do not think so.
When user installs ruby RPM but does not install rubygem-rdoc, it is same with current private-ruby-2.5 branch's situation.

When searching ruby installed directory by "rdoc", only below file ruby-irb need rdoc.
But that is beyond this PR. That is not about this PR.

[mockbuild@255bad5b2c7f497caf038ede64b34977 ruby]$ pwd
/usr/share/ruby

[mockbuild@255bad5b2c7f497caf038ede64b34977 ruby]$ grep -r rdoc * | grep require
irb/cmd/help.rb:require 'rdoc/ri/driver'

[mockbuild@255bad5b2c7f497caf038ede64b34977 ruby]$ rpm -qf irb/cmd/help.rb
ruby-irb-2.5.0-0.1.r61214.fc28.noarch

That is IMHO unnecessary dependency user might not always want.

I think that ruby binary RPM package does not have to depend on rubygem-rdoc.
You are misunderstanding the situation maybe.

When searching ruby installed directory by "rdoc", only below file ruby-irb need rdoc.
But that is beyond this PR. That is not about this PR.

By the way, below is an actual error for above situation. This should be fixed.

<mock-chroot> sh-4.4# rpm -e rubygem-rdoc rubygems-devel ruby-doc
<mock-chroot> sh-4.4# irb
irb(main):001:0> help
LoadError: cannot load such file -- rdoc/ri/driver
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
    from (irb):1
    from /usr/bin/irb:11:in `<main>'

I would very much appreciate if the RDoc was included in Ruby as "bundled" gem

@vondruch OK I wish you will act for upstream Ruby, when you have a time.
Feel free to close this PR.

The rdoc modification of SCL Ruby might come from customer request.
But you have a idea for both upstream Ruby and Fedora Ruby.
That's fine for me.

Pull-Request has been closed by vondruch

3 years ago
Metadata