Bug 277410 - After upgrading ruby31 to ruby32, portupgrade broke.
Summary: After upgrading ruby31 to ruby32, portupgrade broke.
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-01 06:04 UTC by bagas
Modified: 2024-03-07 18:40 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bagas 2024-03-01 06:04:37 UTC
Hello.
After upgrading ruby31 to rubu32, portupgrade broke.

# pkg delete -f ruby portupgrade ruby31-bdb
# 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)


# 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

# 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)

I tried uninstalling portupgrade and installing portupgrade, it didn't help.
How to fix the error?
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2024-03-01 07:25:48 UTC
I do not see how Imath would be a cause of this. Upgrading Imath with other means just works. I know nothing about Ruby other than that it exists, and cannot help with portupgrade.  So I have unsubscribed from this bug report.
Comment 2 bagas 2024-03-01 07:31:11 UTC
portupgrade broke.
portupgrade does not update installed software.
Comment 3 Stanislav Sedov freebsd_committer freebsd_triage 2024-03-01 07:45:18 UTC
It looks like File::exists? method got deprecated.

Wonder if you can try the following patch to see if that works for you?


You can patch the installed files in /usr/local/bin/portsclean and /usr/local/lib/ruby/site_ruby/3.2/pkgtools/pkgtools.rb if that's easier.

---------------------------------------------------------------------------

diff --git a/bin/portsclean b/bin/portsclean
index 322fdb9..dbf2c11 100755
--- a/bin/portsclean
+++ b/bin/portsclean
@@ -282,7 +282,7 @@ def ldconfig_m(*dirs)
   msg = " --> Running ldconfig -m"
 
   dirs.each do |d|
-    dirs.delete(d) if ! (File.exists?(d) && File.stat(d).directory?)
+    dirs.delete(d) if ! (File.exist?(d) && File.stat(d).directory?)
   end
 
   case dirs.size
diff --git a/lib/pkgtools/pkgtools.rb b/lib/pkgtools/pkgtools.rb
index 97e156b..8300e6a 100644
--- a/lib/pkgtools/pkgtools.rb
+++ b/lib/pkgtools/pkgtools.rb
@@ -524,7 +524,7 @@ def script_path
   # If a fixed/custom script(1) is installed by the port, use that version.
   # See #8
   custom_script = "#{PREFIX}/libexec/pkgtools/script"
-  if File.exists?(custom_script)
+  if File.exist?(custom_script)
     $script_path = custom_script
   else
     $script_path = '/usr/bin/script'
Comment 4 bagas 2024-03-01 07:48:06 UTC
# ls /usr/local/bin/portsclean
ls: /usr/local/bin/portsclean: No such file or directory
Comment 5 Stanislav Sedov freebsd_committer freebsd_triage 2024-03-01 07:52:58 UTC
Sorry, sbin/portsclean
Comment 6 bagas 2024-03-01 08:02:09 UTC
It seems to be working and updating.
In /usr/local/lib/ruby/site_ruby/3.2/pkgtools/pkgtools.rb

  # See #8
  custom_script = "#{PREFIX}/libexec/pkgtools/script"
#  if File.exists?(custom_script)
   if File.exist?(custom_script)
    $script_path = custom_script
  else
    $script_path = '/usr/bin/script'
  end
  $script_path
end

root@test_site:/ # 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'
===>  Cleaning for Imath-3.1.11
===>  License BSD3CLAUSE accepted by the user
===>   Imath-3.1.11 depends on file: /usr/local/sbin/pkg - found
=> AcademySoftwareFoundation-Imath-v3.1.11_GH0.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
...
...
...
Comment 7 bagas 2024-03-01 08:06:01 UTC
it works fine, you can make changes globally.