portupgrade: ruby-gems fails to install in a jail with a linked port system.

Hello,
I have the same problem, like its described in two Bugs: "Bug 249083" "Bug 251667".
Description: In my jail I want to install ports-mgmt/portupgrade. This port need the port devel/ruby-gems. devel/ruby-gems could be build without any error, but the install fails:
Code:
===>  Installing for ruby30-gems-3.3.23
===>  Checking if ruby30-gems is already installed
===>   Registering installation for ruby30-gems-3.3.23 as automatic
pkg-static: Unable to access file /tmp/usr/ports/devel/ruby-gems/work/stage/usr/local/bin/gem:No such file or directory
*** Error code 1

Stop.
make[6]: stopped in /usr/ports/devel/ruby-gems
*** Error code 1
And in fact there are no files behind ../local/... such as ../local/bin/gem
The ports are nullfs ro mounted. So to build ports in make.conf is set: WRKDIRPREFIX=/tmp.
This works, but with devel/ruby-gems the installation fails. To people has written 2020 the Bugs entries, but nothing happens since this.

What can I do now to install ports-mgmt/portupgrade this way?
 
do you have /usr/local as a symlink ?
its a problem with ruby-gems setup.rb
which is used in make stage
a crap solution is to make stage
copy missing files and make install
you will have

/tmp/usr/ports/devel/ruby-gems/work/stage/usr/local
/tmp/usr/ports/devel/ruby-gems/work/stage/usr/XXXX
where XXXX is from where your /usr/local is linked
copy files from XXXX in local and make install
 
here is a not very tested patch
Code:
--- /tmp/Makefile    2022-12-09 12:01:45.050912000 +0200
+++ Makefile    2022-12-09 12:24:40.557735000 +0200
@@ -6,6 +6,8 @@
 DISTNAME=    rubygems-${PORTVERSION}
 DIST_SUBDIR=    ruby
 
+
+
 MAINTAINER=    ruby@FreeBSD.org
 COMMENT=    Package management framework for the Ruby language
 WWW=        https://rubygems.org/
@@ -72,3 +74,7 @@
     cd ${STAGEDIR}${PREFIX}/ && ${FIND} -ds ${DOC_DIR}/ ! -type d >> ${TMPPLIST}
 
 .include <bsd.port.mk>
+REAL_PREFIX!=   realpath ${PREFIX}
+.if ${REAL_PREFIX} != ${PREFIX}
+   GEMS_ENV+= GEM_XXX_BIN=${PREFIX}/bin
+.endif
and add this diff file in files/patch-fix-linked-local
Code:
--- lib/rubygems/commands/setup_command.rb.orig    2022-12-09 12:22:16.123948000 +0200
+++ lib/rubygems/commands/setup_command.rb    2022-12-09 12:22:34.331107000 +0200
@@ -448,10 +448,14 @@
   def generate_default_dirs
     prefix = options[:prefix]
     site_or_vendor = options[:site_or_vendor]
+    xxx_bin = ENV["GEM_XXX_BIN"]
 
     if prefix.empty?
       lib_dir = RbConfig::CONFIG[site_or_vendor]
       bin_dir = RbConfig::CONFIG["bindir"]
+      if xxx_bin && !xxx_bin.empty?
+      bin_dir = xxx_bin
+      end
     else
       lib_dir = File.join prefix, "lib"
       bin_dir = File.join prefix, "bin"
 
do you have /usr/local as a symlink ?
its a problem with ruby-gems setup.rb
which is used in make stage
yes, local -> ../skel/usr/local
I understand in setup.rb is a problem. I do not understand "make stage". Is there a port named "stage"?

For your solution I will need some time to understand that, but first thanks for your patch file. ? I will try it.
 
make stage is a target like make build patch etc
it installs in the staging area from which the make install takes the files
 
Back
Top