Bug 241554

Summary: lang/ruby26: Don't install bin/irb, bin/ri, bin/rdoc, irb(1) man page and ri(1) man page
Product: Ports & Packages Reporter: Yasuhiro Kimura <yasu>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: meta, rene, ruby, swills
Priority: --- Flags: bugzilla: maintainer-feedback? (ruby)
yasu: exp-run?
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 260788, 242352    
Attachments:
Description Flags
Patch file
none
Updated patch file
none
Updated patch file
none
Updated patch file none

Description Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-28 23:31:46 UTC
Created attachment 208661 [details]
Patch file

* Don't install bin/{irb,rdoc,ri}. The intention is to install these scripts from devel/rubygem-irb and devel/rubygem-rdoc.
* Install man pages for bundler and gem. It is because they aren't installed by devel/ruby-gems and sysutils/rubygem-bundler.
* Bump PORTREVISION.
Comment 1 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-28 23:48:34 UTC
My Understanding is that bin/{rdoc,ri} of lang/ruby26 don't work without devel/rubygem-rdoc. So moving them from lang/ruby26 to devel/rubygem-rdoc shouldn't affect to build of depending ports. But lang/ruby26 is current default version of Ruby. So just to make sure I would like to request exp-run with combination of bug #241556 and this bug report.
Comment 2 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-29 03:45:34 UTC
Overall, I agree with your change.

I remember we had discussion to separate bundler from ruby port (actually I didn't join the discussion). Does this change mean the man page of bundler is installed by lang/ruby26 but bundler is installed as sysutils/rubygem-bundler. That sounds odd a little bit.
Comment 3 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-29 04:02:35 UTC
(In reply to Koichiro Iwao from comment #2)

To be honest I also would like to remove man pages for bundler, irb, ri and gemfile from lang/ruby26. But unfortunately they are not included in coressponding gems. So there is no way other than including them in lang/ruby26.
Comment 4 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-29 06:03:32 UTC
Created attachment 208672 [details]
Updated patch file

Fix trivial typo in pkg-message. So please commit attached patch instead of original one.
Comment 5 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-29 07:00:21 UTC
(In reply to Yasuhiro KIMURA from comment #3)
IMHO, if lang/ruby26 port installs man page of bundler, also bundle should be a part of lang/ruby26 port. Now Ruby 2.6 is default, separating bundler from ruby port?
Comment 6 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-29 08:44:25 UTC
(In reply to Koichiro Iwao from comment #5)

Then which you prefer?

1. Simply remove these man pages from lang/ruby26 and don't include anywhere.
2. Include these man pages to corresponding rubygem ports.
Comment 7 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-30 05:07:40 UTC
(In reply to Koichiro Iwao from comment #5)

After that I found man pages of bundler are included in the gem and sysutils/rubygem-bundler installs them outside of ${PREFIX}/man. So I would like to change plan as following.

lang/ruby26:
  Don't install man pages of bundler, irb and ri.
sysutils/rubygem-bundler:
  Create symbolic link to man pages under ${PREFIX}/man/man{1,5} if ${RUBY_VER} is 2.6 or later.
devel/rubygem-irb:
  Insall irb(1) manpage under ${PREFIX}/man/man1 if ${RUBY_VER} is 2.6 or later. (Otherwise mark this port IGNORE.)
devel/rubygem-rdoc:
  Insall ri(1) manpage under ${PREFIX}/man/man1 if ${RUBY_VER} is 2.6 or later.

What do you think about it?
Comment 8 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-30 08:19:58 UTC
(In reply to Yasuhiro KIMURA from comment #7)
Sounds better. However, now that is not the issue of each rubygem ports such as bundler, irb, ri.

As far as I understand, the real issue is man command cannot show man pages of rubygem ports such as bundler because rubygem ports installs man page under ${PREFIX}${GEMS_BASE_DIR}.

I would say that should be addressed rubygems framework (Uses/gem.mk) or man, not each rubygem ports. For example, mail/spamassassin is written in Perl and installs man pages under ${SITE_PERL} however man command can find it properly. That's because ${SITE_PERL}/man is added in manpath. What about adjusting manpath?

This is the result of manpath command for me:
% manpath
/usr/share/man:/usr/local/man:/usr/share/openssl/man:/usr/local/lib/node_modules/npm/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.30/perl/man
Comment 9 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-30 15:40:49 UTC
(In reply to Koichiro Iwao from comment #8)

I agree that your proposal is better than mine. But at the same time I have 3 concerns about it. The first is about directory where man pages are placed in each gem. I read guide documents in rubygems.org but couldn't find where man pages should placed. In bundler 2.0.2 gem man pages are placed under 'man' subdirectory. If there is rule that man pages should be places under 'man' subdirectory in gem, then we can determine where man pages are installed and therefore we can handle the issue with gem.mk. But if there isn't such rule then we can't determine it and forced to handle the issue with each rubygem port.

And even if there is rule as above, there is second concern. According to gem.mk man pages are install in following directory.

${PREFIX}/lib/ruby/gem/${RUBY_VER}/gems/${PORTNAME}-${PORTVERSION}/man

As you can see this is different from standard /somewhere/man/man[1-9] style of man pages directories. So I'm not sure if adding this directory works as is expected.

And last concern is that above directory means that different rubygem ports installs man pages in different directory. I don't know how many rubygem ports install man pages. But if you install 10 such ports then 10 directories must be added to man path. And if there limit about total length of man path, installing a lot of such rubygem ports may hits the limit.
Comment 10 Koichiro Iwao freebsd_committer freebsd_triage 2019-11-05 06:19:29 UTC
(In reply to Yasuhiro KIMURA from comment #9)
Hmm, indeed.  Anyway, I'd like to hear opinions of other Ruby folks.
Comment 11 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-11-22 03:32:42 UTC
I'd like to revise my proposal as following.

lang/ruby26:
* Don't install ${PREFIX}bin/{irb,rdoc,ri}.
* Don't install man pages of irb, rdoc and bundler.

devel/ruby-gems:
* Create ${PREFIX}/lib/ruby/gems/man/man[1-9] directories.
* Add ${PREFIX}/lib/ruby/gems/man to man path.

each rubygem ports:
* Set GEM_MANPAGE_SEC[1-9] if they install man page. The value is list of path (relative to ${PREFIX}) to each man pages.

Mk/User/gem.mk:
* If GEM_MANPAGE_SEC[1-9] is not empty, create symbolic links from ${PREFIX}/lib/ruby/gems/man/man[1-9] to each man pages at staging phase.

devel/rubygem-irb:
* Install ${PREFIX}/bin/irb.
* Install irb(1) man mage.
* Set GEM_MANPAGE_SEC1.

devel/rubygem-rdoc:
* Install ${PREFIX}/bin/{rdoc,ri}.
* Install ri(1) man page.
* Set GEM_MANPAGE_SEC1.

sysutils/rubygem-bundler:
* Install man pages.
* Set GEM_MANPAGE_SEC1 and GEM_MANPAGE_SEC5.

The background of my proposal is:

1. As is written in comment #9, adding directories where man pages of each rubygem ports are installed to man path doesn't work as is expected. So symbolic links have to be created anyway.
2. Maybe making man directories for rubygem and creating symbolic links under them is better than creating them under ${PREFIX}/man/man[1-9].
3. Only each rubygem port knows where man pages are installed. So tell it by setting GEM_MANPAGE_SEC[1-9]. And gem.mk do the task of creating symbolic links.

Any suggestions and/or comments are welcome.
Comment 12 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-12-02 07:43:13 UTC
Created attachment 209586 [details]
Updated patch file

According to revised my proposal in comment #11,

* Don't install ${PREFIX}bin/{irb,rdoc,ri}.
* Don't install man pages of irb, rdoc and bundler.

And

* Fix bug of previous patches that build of depending port fails when
  USE_RUBY_RDOC is defined.

So please commit attached patch instead of previous ones.
Comment 13 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-09 08:10:08 UTC
I believe this can be committed. exp-run and portmgr approval needed.
Comment 14 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-09 08:14:05 UTC
swills@, can you have a look at this, too?
Comment 15 Antoine Brodin freebsd_committer freebsd_triage 2019-12-09 08:15:02 UTC
(In reply to Koichiro Iwao from comment #13)
I think the patch is incomplete.  (nothing provides irb for instance)
Comment 16 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-09 08:36:09 UTC
(In reply to Antoine Brodin from comment #15)
oh, I missed you're also one of portmgr. Thanks for the feedback.
Comment 17 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-13 01:13:18 UTC
(In reply to Antoine Brodin from comment #15)
What should be done to make this exp-run ready?
Comment 18 Antoine Brodin freebsd_committer freebsd_triage 2019-12-13 06:33:55 UTC
(In reply to Koichiro Iwao from comment #17)
I see at least 2 problems: there is nothing providing ri and nothing providing irb
Comment 19 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-12-13 06:48:12 UTC
(In reply to Antoine Brodin from comment #18)

As I wrote in comment #0 they are provided by devel/rubygem-irb and devel/rubygem-rdoc. it is why this bug report depends on bug #241555 and bug #241556.
Comment 20 Antoine Brodin freebsd_committer freebsd_triage 2019-12-13 06:50:22 UTC
(In reply to Yasuhiro KIMURA from comment #19)
I think you mixed blocks / depends on.

Any way, for an exp-run,  there needs to be 1 patch,  not several.
Comment 21 commit-hook freebsd_committer freebsd_triage 2020-01-28 06:57:11 UTC
A commit references this bug:

Author: meta
Date: Tue Jan 28 06:56:47 UTC 2020
New revision: 524460
URL: https://svnweb.freebsd.org/changeset/ports/524460

Log:
  devel/rubygem-irb: Update to 1.2.1 and IGNORE RUBY_VER < 2.6

  because irb is provided as a part of Ruby in Ruby <= 2.5.

  PR:		241554
  Submitted by:	Yasuhiro KIMURA <yasu@utahime.org>
  Approved by:	meta (maintainer)

Changes:
  head/devel/rubygem-irb/Makefile
  head/devel/rubygem-irb/distinfo
Comment 22 Koichiro Iwao freebsd_committer freebsd_triage 2020-01-28 06:59:46 UTC
Partially committed a patch in bug 241555 to unwind patch dependency.
Comment 23 Yasuhiro Kimura freebsd_committer freebsd_triage 2020-02-04 17:24:04 UTC
Created attachment 211350 [details]
Updated patch file

Update patch so it includes everything necessary for exp-run. That is,

* Change both lang/ruby26 and lang/ruby27 because change to the former also affects to the later.
* Move ${PREFIX}/bin/irb and irb(1) man page to devel/rubygem-irb.
* Move ${PREFIX}/bin/rdoc, ${PREFIX}/bin/ri and ri(1) man page to devel/rubygem-rdoc.
* Move ${PREFIX}/bin/racc and ${PREFIX}/bin/racc2y to devel/rubygem-rac (lang/ruby27 only).
* Update pkg-message of lang/ruby2[67].
Comment 24 Koichiro Iwao freebsd_committer freebsd_triage 2020-02-05 00:54:37 UTC
(In reply to Yasuhiro KIMURA from comment #23)
Hi Kimura-san, 

Thanks you very much for your work. I'm thinking of working on this irb/ri/rdoc hollow wrapper issue with following procedure.

1. Complete these fixes with lang/ruby27 because it is still non-default ver of Ruby
2. Make same changes with lang/ruby26 (in one patch, required for exp-run)
3. Request exp-run
4. Commit & fix lang/ruby26
Comment 25 Koichiro Iwao freebsd_committer freebsd_triage 2020-03-12 09:24:13 UTC
(In reply to Yasuhiro KIMURA from comment #23)
Thoghts, I don't like putting man pages in files dir.
The corresponding version of irb.1 should be fetched from upstream as additional distfile.

Ex. https://github.com/ruby/irb/blob/v1.2.0/man/irb.1
Comment 26 Koichiro Iwao freebsd_committer freebsd_triage 2020-03-13 09:16:28 UTC
Regarding man page, this should be better rather than copy it in FILESDIR.

>post-install:
>        ${MKDIR} ${STAGEDIR}${PREFIX}/share/man/man1
>        ${INSTALL_DATA} ${WRKSRC}/man/irb.1
Comment 27 Rene Ladan freebsd_committer freebsd_triage 2022-03-31 20:03:26 UTC
lang/ruby26 expired today, the port is being removed from the tree.
Comment 28 Yasuhiro Kimura freebsd_committer freebsd_triage 2022-03-31 23:37:28 UTC
lang/ruby26 is removed from ports tree.