This uses Gem.disable_system_update_message to disable the nag
message.  One advantage of this new approach is that attempting
to do gem update --system fails with the error message.

I plan to commit this in a couple days unless I hear objections.

Thanks,
Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ruby/3.2/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile    8 Jan 2023 02:44:58 -0000       1.2
+++ Makefile    7 Feb 2023 20:42:57 -0000
@@ -3,7 +3,7 @@ DISTNAME =              ruby-${VERSION}
 SHARED_LIBS =          ruby32  0.0
 NEXTVER =              3.3
 PKGSPEC-main ?=         ruby->=3.2.0,<${NEXTVER}
-REVISION-main =                0
+REVISION-main =                1
 
 PSEUDO_FLAVORS=                no_ri_docs bootstrap
 # Do not build the RI docs on slow arches
Index: patches/patch-lib_rubygems_rb
===================================================================
RCS file: patches/patch-lib_rubygems_rb
diff -N patches/patch-lib_rubygems_rb
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_rubygems_rb       7 Feb 2023 20:42:31 -0000
@@ -0,0 +1,21 @@
+Disable the use of `gem update --system`, which is not supported when using
+OpenBSD packages.  Also avoids printing the nagging update message:
+
+  A new release of RubyGems is available: 3.4.1 - 3.4.2!
+  Run `gem update --system 3.4.2` to update your installation.
+
+Index: lib/rubygems.rb
+--- lib/rubygems.rb.orig
++++ lib/rubygems.rb
+@@ -1169,6 +1169,11 @@ An Array (#{env.inspect}) was passed in from #{caller[
+     # end-users on gem update --system instead of actual update.
+     attr_accessor :disable_system_update_message
+ 
++    Gem.disable_system_update_message = <<EOF
++Ruby was installed using an OpenBSD package, and using `gem update --system`
++is not supported.
++EOF
++
+     ##
+     # Hash of loaded Gem::Specification keyed by name
+ 
Index: patches/patch-lib_rubygems_update_suggestion_rb
===================================================================
RCS file: patches/patch-lib_rubygems_update_suggestion_rb
diff -N patches/patch-lib_rubygems_update_suggestion_rb
--- patches/patch-lib_rubygems_update_suggestion_rb     8 Jan 2023 02:44:58 
-0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-Avoid printing of nagging update message:
-
-  A new release of RubyGems is available: 3.4.1 - 3.4.2!
-  Run `gem update --system 3.4.2` to update your installation.
-
-When using the OpenBSD port, important updates to rubygems will
-be distributed via normal updates to the related ruby ports.
-
-return false while true is used instead of plain return false to
-avoid the statement not reached verbose mode warning.
-
-Index: lib/rubygems/update_suggestion.rb
---- lib/rubygems/update_suggestion.rb.orig
-+++ lib/rubygems/update_suggestion.rb
-@@ -31,6 +31,7 @@ Run `gem update --system #{Gem.latest_rubygems_version
-   # Determines if current environment is eglible for update suggestion.
- 
-   def eglible_for_update?
-+    return false while true
-     # explicit opt-out
-     return false if Gem.configuration[:prevent_update_suggestion]
-     return false if ENV["RUBYGEMS_PREVENT_UPDATE_SUGGESTION"]

Reply via email to