After upgrading ruby31 to ruby32, portupgrade gives an error

Hello.
I'm updating the system.
according to instructions

# pkg delete -f ruby portupgrade ruby31-bdb
# make -C /usr/ports/ports-mgmt/portupgrade install clean
# pkg set -o lang/ruby31:lang/ruby32
# portupgrade -x ruby-3.2.\* -fr lang/ruby32

a strange error appears.
# portupgrade -x ruby-3.2.\* -fr lang/ruby32
[Reading data from pkg(8) ... - 152 packages found - done]
---> Reinstalling 'ruby32-gems-3.4.20' (devel/ruby-gems)
---> Building '/usr/ports/devel/ruby-gems'
---> Skipping 'devel/rubygem-stringio' (rubygem-stringio-3.1.0) because a requisite package 'ruby32-gems-3.4.20' (devel/ruby-gems) failed (specify -k to force)
---> Skipping 'textproc/rubygem-psych' (rubygem-psych-5.1.2) because a requisite package 'rubygem-stringio-3.1.0' (devel/rubygem-stringio) failed (specify -k to force)
---> Skipping 'devel/rubygem-rdoc' (rubygem-rdoc-6.6.2) because a requisite package 'rubygem-psych-5.1.2' (textproc/rubygem-psych) failed (specify -k to force)
---> Reinstalling 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb)
---> Building '/usr/ports/databases/ruby-bdb'
---> Skipping 'ports-mgmt/portupgrade' (portupgrade-2.4.16_1,2) because a requisite package 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb) failed (specify -k to force)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! devel/ruby-gems (ruby32-gems-3.4.20) (undefined method `exists?' for File:Class)
* devel/rubygem-stringio (rubygem-stringio-3.1.0)
* textproc/rubygem-psych (rubygem-psych-5.1.2)
* devel/rubygem-rdoc (rubygem-rdoc-6.6.2)
! databases/ruby-bdb (ruby32-bdb-0.6.6_9) (undefined method `exists?' for File:Class)
* ports-mgmt/portupgrade (portupgrade-2.4.16_1,2)
# pkg version -v | grep 'ruby'
ruby-3.2.3,1 = up-to-date with index
ruby32-bdb-0.6.6_9 = up-to-date with index
ruby32-gems-3.4.20 = up-to-date with index
rubygem-psych-5.1.2 = up-to-date with index
rubygem-rdoc-6.6.2 = up-to-date with index
rubygem-stringio-3.1.0 = up-to-date with index
is it no longer necessary to rebuild dependencies?
# pkg set -o lang/ruby31:lang/ruby32
# portupgrade -x ruby-3.2.\* -fr lang/ruby32
 
pkg autoremove
# pkg set -o lang/ruby31:lang/ruby32
Change origin from lang/ruby31 to lang/ruby32 for all dependencies? [y/N]: y

# portupgrade -x ruby-3.2.\* -fr lang/ruby32
[Reading data from pkg(8) ... - 135 packages found - done]
---> Reinstalling 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb)
---> Building '/usr/ports/databases/ruby-bdb'
---> Skipping 'ports-mgmt/portupgrade' (portupgrade-2.4.16_1,2) because a requisite package 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb) failed (specify -k to force)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! databases/ruby-bdb (ruby32-bdb-0.6.6_9) (undefined method `exists?' for File:Class)
* ports-mgmt/portupgrade (portupgrade-2.4.16_1,2)
# pkg info -x ruby
ruby-3.2.3,1
ruby32-bdb-0.6.6_9
What am I doing wrong?
 
Probably with the installation of the new version of ruby-3.2 portupgrade broke.

# portupgrade -arR
[Reading data from pkg(8) ... - 170 packages found - done]
---> Upgrading 'git-2.43.0_1' to 'git-2.44.0' (devel/git)
---> Building '/usr/ports/devel/git'
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! devel/git (git-2.43.0_1) (undefined method `exists?' for File:Class)
# pkg version -v | egrep "ruby|portupgrade|\?"
portupgrade-2.4.16_1,2 = up-to-date with index
ruby-3.2.3,1 = up-to-date with index
ruby32-bdb-0.6.6_9 = up-to-date with index
 
remove portupgrade then run pkg autoremove and install again portupgrade.

If you want you can also switch from db5 to db18
 
is it no longer necessary to rebuild dependencies?
No, do rebuild the deps. Although, with the well-known dependency hell in the UNIX world, people just hold off upgrading, because who knows what will break when if something gets upgraded. Sometimes, people just learn to live with that, because they want to stick with UNIX. This is a reality of life in Linux world, too. End result, people stick with software that is past EOL. And no easy solution in sight, but to slog through endless error fixing and reinstalls from scratch. 😩
 
No, do rebuild the deps. Although, with the well-known dependency hell in the UNIX world, people just hold off upgrading, because who knows what will break when if something gets upgraded. Sometimes, people just learn to live with that, because they want to stick with UNIX. This is a reality of life in Linux world, too. End result, people stick with software that is past EOL. And no easy solution in sight, but to slog through endless error fixing and reinstalls from scratch. 😩
In freebsd system more or less implements dependency update solutions, so I don’t see any problems with this.
There are sometimes incomprehensible moments, but there is this forum or bug report.
 
Changing default db5 to db18 will not fix your problem. The portupgrade will work with both version. It will just stop inform you for EOL version of db5. Just uninstall portupgrade then cleanup the ruby with pkg autoremove and install again portupgrade
 
I upgrade my ports every 2 weeks and i didn't have such problems.
Well, duh, if you update that often, that is a way to keep dependency hell at bay. That works best when you don't have a truckload of different stuff installed on your system.
 
Changing default db5 to db18 will not fix your problem. The portupgrade will work with both version. It will just stop inform you for EOL version of db5. Just uninstall portupgrade then cleanup the ruby with pkg autoremove and install again portupgrade
did not help.

# pkg delete -f portupgrade
# pkg autoremove
# make -C /usr/ports/ports-mgmt/portupgrade install clean
# pkg autoremove
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 3 packages:

Installed packages to be REMOVED:
rubygem-psych: 5.1.2
rubygem-rdoc: 6.6.2
rubygem-stringio: 3.1.0

Number of packages to be removed: 3

The operation will free 2 MiB.

Proceed with deinstalling packages? [y/N]: y
[test_site] [1/3] Deinstalling rubygem-rdoc-6.6.2...
[test_site] [1/3] Deleting files for rubygem-rdoc-6.6.2: 100%
[test_site] [2/3] Deinstalling rubygem-psych-5.1.2...
[test_site] [2/3] Deleting files for rubygem-psych-5.1.2: 100%
[test_site] [3/3] Deinstalling rubygem-stringio-3.1.0...
[test_site] [3/3] Deleting files for rubygem-stringio-3.1.0: 100%

# pkg set -o lang/ruby31:lang/ruby32
Change origin from lang/ruby31 to lang/ruby32 for all dependencies? [y/N]: y
# portupgrade -x ruby-3.2.\* -fr lang/ruby32
[Reading data from pkg(8) ... - 185 packages found - done]
[Updating the portsdb <format:bdb_btree> in /usr/ports ... - 34405 port entries found .........1000.........2000.........3000.........4000.........5000.........6000.........7000.........8000.........9000.........10000.........11000.........12000.........13000.........14000.........15000.........16000.........17000.........18000.........19000.........20000.........21000.........22000.........23000.........24000.........25000.........26000.........27000.........28000.........29000.........30000.........31000.........32000.........33000.........34000.... ..... done]
---> Reinstalling 'ruby32-gems-3.4.20' (devel/ruby-gems)
---> Building '/usr/ports/devel/ruby-gems'
---> Skipping 'textproc/rubygem-asciidoctor' (rubygem-asciidoctor-2.0.20) because a requisite package 'ruby32-gems-3.4.20' (devel/ruby-gems) failed (specify -k to force)
---> Reinstalling 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb)
---> Building '/usr/ports/databases/ruby-bdb'
---> Skipping 'ports-mgmt/portupgrade' (portupgrade-2.4.16_1,2) because a requisite package 'ruby32-bdb-0.6.6_9' (databases/ruby-bdb) failed (specify -k to force)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! devel/ruby-gems (ruby32-gems-3.4.20) (undefined method `exists?' for File:Class)
* textproc/rubygem-asciidoctor (rubygem-asciidoctor-2.0.20)
! databases/ruby-bdb (ruby32-bdb-0.6.6_9) (undefined method `exists?' for File:Class)
* ports-mgmt/portupgrade (portupgrade-2.4.16_1,2)

Portupgrade is broken.
# pkg version -vl '<'
Imath-3.1.10 < needs updating (index has 3.1.11)

# portupgrade -arR
[Reading data from pkg(8) ... - 185 packages found - done]
---> Upgrading 'Imath-3.1.10' to 'Imath-3.1.11' (math/Imath)
---> Building '/usr/ports/math/Imath'
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! math/Imath (Imath-3.1.10) (undefined method `exists?' for File:Class)

# pkg version -v | egrep "ruby|portupgrade|\?"
portupgrade-2.4.16_1,2 = up-to-date with index
ruby-3.2.3,1 = up-to-date with index
ruby32-bdb-0.6.6_9 = up-to-date with index
ruby32-gems-3.4.20 = up-to-date with index
rubygem-asciidoctor-2.0.20 = up-to-date with index
 
Also reported at PR 277395, and link to patch by Tobias C. Berner is at Comment1.
Not tried myself as I'm using -devel version and need checking whether it can be applied to it, too or not, but my computer is now busy building www/chromium with poudriere.
Maybe applicable by replacing all /poudriere/ to /poudirere-devel/ hopefully, but if you already applied fix at PR 227747, you would need reverting, merging fix and reapply.
 
Also reported at PR 277395, and link to patch by Tobias C. Berner is at Comment1.
Not tried myself as I'm using -devel version and need checking whether it can be applied to it, too or not, but my computer is now busy building www/chromium with poudriere.
Maybe applicable by replacing all /poudriere/ to /poudirere-devel/ hopefully, but if you already applied fix at PR 227747, you would need reverting, merging fix and reapply.
We are waiting for these changes to be added to ports globally.
 
For some reason, the developers of port portupgrade in no hurry to make changes to make program work right, sad!
Today a new version of the program appeared (2.4.16_2.2), but there are no changes in it so that it works correctly!
Edits to the port were made to the man location, but not to the fix to method 'exists' for File:Class.
I have many servers running FreeBSD. It’s very inconvenient to patch the port every time and rebuild it before updating!
 
I have many servers running FreeBSD. It’s very inconvenient to patch the port every time and rebuild it before updating!
(Posted to PR 277395, too.)

The patch tobias C.Berner mentioned at Comment 1 of PR 277395 is for applying onto ports tree.
If you are updateing ports tree using devel/git, you can update as follows.

sh:
# cd /usr/ports && git stash && git pull --ff-only && portsdb -Uu && git stash apply

This way, git automatically revert local patches which are not committed before pulling updates from upstream and automatically re-apply the patch.

Don't forget to check whether applied patch (or possibly conflicting changes) are committed on cgit or dev-commits-ports-main ML. If any, revert the patch before updating to be safe.

To reduce risks, you would bettter updating ports tree on single computer and deploy (by clone, rsync or anything you prefer) or null-mount it from others.
 
The patch tobias C.Berner mentioned at Comment 1 of PR 277395 is for applying onto ports tree.
In fact, need to change two lines in two files, why is there so much water in the patch?

https://people.freebsd.org/~tcberne...rtupgrade-use-File.exist-instead-of-obs.patch

bin/portsclean
+- dirs.delete(d) if ! (File.exists?(d) && File.stat(d).directory?)
++ dirs.delete(d) if ! (File.exist?(d) && File.stat(d).directory?)

lib/pkgtools/pkgtools.rb
+- if File.exists?(custom_script)
++ if File.exist?(custom_script)
 
His patch creates 2 patch files under ports-mgmt/portupgrade/files/ directory under current directory.
So when you applied at /usr/ports, they would be 2 patches under /usr/ports/ports-mgmt/portupgrade/files/.
And ports framework automatically picks the patches and applies on build, as the patch filename doesn't have the prefix extra-.

Note that the patch should be applied with patch -p1.
 
For some reason, the developers of port portupgrade in no hurry to make changes to make program work right, sad!
Today a new version of the program appeared (2.4.16_2.2), but there are no changes in it so that it works correctly!
Edits to the port were made to the man location, but not to the fix to method 'exists' for File:Class.
I have many servers running FreeBSD. It’s very inconvenient to patch the port every time and rebuild it before updating!
I'd think that this is because Poudriere has higher priority (and better potential to make upgrades easier, IMHO)...
 
My workaround is to go back to ruby3.1 for now. I don't have any other ruby requirements.

pkg delete ruby
pkg delete portupgrade
add to /etc/make.conf: DEFAULT_VERSIONS+=ruby=3.1
make -C /usr/ports/ports-mgmt/portupgrade install clean
 
My workaround is to go back to ruby3.1 for now. I don't have any other ruby requirements.

pkg delete ruby
pkg delete portupgrade
add to /etc/make.conf: DEFAULT_VERSIONS+=ruby=3.1
make -C /usr/ports/ports-mgmt/portupgrade install clean
Will have to do this specify ruby=3.1 for now.
 
Back
Top