public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rubygem-mail] epel10: Fix Ruby 3.1 compatibility.
Date: Fri, 20 Nov 2026 23:23:16 GMT	[thread overview]
Message-ID: <179521699600.1.14628443315914974708.rpms-rubygem-mail-42b5a8b3d5dd@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rubygem-mail
            Branch : epel10
            Commit : 42b5a8b3d5ddd2b7c14b0e21370903478e2acc06
            Author : Vít Ondruch <vondruch@redhat.com>
            Date   : 2022-03-24T10:32:38+01:00
            Stats  : +150/-99 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/rubygem-mail/c/42b5a8b3d5ddd2b7c14b0e21370903478e2acc06?branch=epel10

            Log:
            Fix Ruby 3.1 compatibility.

Add `rubygem(net-snmp)` dependency and fix Psych 4.0+ compatibility.

---
diff --git a/mail-2.6.4-Fix-deprecated-warnings-in-Ruby-2.4.0.patch b/mail-2.6.4-Fix-deprecated-warnings-in-Ruby-2.4.0.patch
deleted file mode 100644
index 01d3556..0000000
--- a/mail-2.6.4-Fix-deprecated-warnings-in-Ruby-2.4.0.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From e8fde9cf1d77ee7e465c12e809501df8d27e8451 Mon Sep 17 00:00:00 2001
-From: Koichi ITO <koic.ito@gmail.com>
-Date: Sun, 4 Dec 2016 12:33:06 +0800
-Subject: [PATCH] Fix deprecated warnings in Ruby 2.4.0+
-
----
- lib/mail/attachments_list.rb                         | 2 +-
- lib/mail/multibyte/chars.rb                          | 4 ++--
- lib/mail/network/retriever_methods/test_retriever.rb | 2 +-
- 3 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/lib/mail/attachments_list.rb b/lib/mail/attachments_list.rb
-index bb34a85..14fe31c 100644
---- a/lib/mail/attachments_list.rb
-+++ b/lib/mail/attachments_list.rb
-@@ -30,7 +30,7 @@ module Mail
-     # mail.attachments['test.png'].filename #=> 'test.png'
-     # mail.attachments[1].filename          #=> 'test.jpg'
-     def [](index_value)
--      if index_value.is_a?(Fixnum)
-+      if index_value.is_a?(Integer)
-         self.fetch(index_value)
-       else
-         self.select { |a| a.filename == index_value }.first
-diff --git a/lib/mail/multibyte/chars.rb b/lib/mail/multibyte/chars.rb
-index bb39897..2e431ca 100644
---- a/lib/mail/multibyte/chars.rb
-+++ b/lib/mail/multibyte/chars.rb
-@@ -269,12 +269,12 @@ module Mail #:nodoc:
-           @wrapped_string[*args] = replace_by
-         else
-           result = Unicode.u_unpack(@wrapped_string)
--          if args[0].is_a?(Fixnum)
-+          if args[0].is_a?(Integer)
-             raise IndexError, "index #{args[0]} out of string" if args[0] >= result.length
-             min = args[0]
-             max = args[1].nil? ? min : (min + args[1] - 1)
-             range = Range.new(min, max)
--            replace_by = [replace_by].pack('U') if replace_by.is_a?(Fixnum)
-+            replace_by = [replace_by].pack('U') if replace_by.is_a?(Integer)
-           elsif args.first.is_a?(Range)
-             raise RangeError, "#{args[0]} out of range" if args[0].min >= result.length
-             range = args[0]
-diff --git a/lib/mail/network/retriever_methods/test_retriever.rb b/lib/mail/network/retriever_methods/test_retriever.rb
-index 9bb3e1a..dfbc909 100644
---- a/lib/mail/network/retriever_methods/test_retriever.rb
-+++ b/lib/mail/network/retriever_methods/test_retriever.rb
-@@ -25,7 +25,7 @@ module Mail
-       emails_index.reverse! if options[:what] == :last
-       emails_index = case count = options[:count]
-         when :all then emails_index
--        when Fixnum then emails_index[0, count]
-+        when Integer then emails_index[0, count]
-         else
-           raise 'Invalid count option value: ' + count.inspect
-       end
--- 
-2.11.0
-

diff --git a/mail-2.6.4-fix-new-warning-in-ruby-2.4.patch b/mail-2.6.4-fix-new-warning-in-ruby-2.4.patch
deleted file mode 100644
index af45560..0000000
--- a/mail-2.6.4-fix-new-warning-in-ruby-2.4.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 48cb6db25b31eebe7bdd330d812c52d3c93aa328 Mon Sep 17 00:00:00 2001
-From: "yuuji.yaginuma" <yuuji.yaginuma@gmail.com>
-Date: Tue, 13 Dec 2016 07:50:42 +0900
-Subject: [PATCH] fix new warning in ruby 2.4
-
-This fixes the following warning.
-
-```
-/home/travis/build/mikel/mail/lib/mail/fields/common/address_container.rb:11: warning: parentheses after method name is interpreted as
-/home/travis/build/mikel/mail/lib/mail/fields/common/address_container.rb:11: warning: an argument list, not a decomposed argument
-```
-
-Ref: https://github.com/ruby/ruby/commit/65e27c8b138d6959608658ffce2fa761842b8d24
----
- lib/mail/fields/common/address_container.rb | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/mail/fields/common/address_container.rb b/lib/mail/fields/common/address_container.rb
-index f4a5aec..48c1286 100644
---- a/lib/mail/fields/common/address_container.rb
-+++ b/lib/mail/fields/common/address_container.rb
-@@ -8,10 +8,10 @@ module Mail
-       super(list)
-     end
- 
--    def << (address)
-+    def <<(address)
-       @field << address
-     end
- 
-   end
-   
--end
-\ No newline at end of file
-+end
--- 
-2.11.0
-

diff --git a/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x-test.patch b/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x-test.patch
new file mode 100644
index 0000000..ff2c72e
--- /dev/null
+++ b/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x-test.patch
@@ -0,0 +1,74 @@
+From 641771dec33eb23c30c259ebbb98260e1dd80236 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= <josef.simanek@gmail.com>
+Date: Wed, 23 Mar 2022 19:23:08 +0100
+Subject: [PATCH] Add Mail::YAML#load compatible with Psych 3.x and Psych 4.x.
+
+---
+ spec/mail/message_spec.rb    |  6 ++++----
+ spec/mail/parts_list_spec.rb |  2 +-
+ spec/mail/yaml_spec.rb       | 13 +++++++++++++
+ 3 files changed, 17 insertions(+), 4 deletions(-)
+ create mode 100644 spec/mail/yaml_spec.rb
+
+diff --git a/spec/mail/message_spec.rb b/spec/mail/message_spec.rb
+index 033edf2bb..eb3831703 100644
+--- a/spec/mail/message_spec.rb
++++ b/spec/mail/message_spec.rb
+@@ -198,7 +198,7 @@ def create_mail_with_splat_args
+ 
+       it "should serialize the basic information to YAML" do
+         yaml = @yaml_mail.to_yaml
+-        yaml_output = YAML.load(yaml)
++        yaml_output = Mail::YAML.load(yaml)
+         expect(yaml_output['headers']['To']).to       eq "someone@somewhere.com"
+         expect(yaml_output['headers']['Cc']).to       eq "someoneelse@somewhere.com"
+         expect(yaml_output['headers']['Subject']).to  eq "subject"
+@@ -216,7 +216,7 @@ def create_mail_with_splat_args
+       it "should serialize a Message with a custom delivery_handler" do
+         @yaml_mail.delivery_handler = DeliveryAgent
+         yaml = @yaml_mail.to_yaml
+-        yaml_output = YAML.load(yaml)
++        yaml_output = Mail::YAML.load(yaml)
+         expect(yaml_output['delivery_handler']).to eq "DeliveryAgent"
+       end
+ 
+@@ -228,7 +228,7 @@ def create_mail_with_splat_args
+ 
+       it "should not deserialize a delivery_handler that does not exist" do
+         yaml = @yaml_mail.to_yaml
+-        yaml_hash = YAML.load(yaml)
++        yaml_hash = Mail::YAML.load(yaml)
+         yaml_hash['delivery_handler'] = "NotARealClass"
+         deserialized = Mail::Message.from_yaml(yaml_hash.to_yaml)
+         expect(deserialized.delivery_handler).to be_nil
+diff --git a/spec/mail/parts_list_spec.rb b/spec/mail/parts_list_spec.rb
+index 30dc7d7c8..d22846043 100644
+--- a/spec/mail/parts_list_spec.rb
++++ b/spec/mail/parts_list_spec.rb
+@@ -89,6 +89,6 @@
+ 
+   it "should have a round-tripping YAML serialization" do
+     p = Mail::PartsList.new([1, 2])
+-    expect(YAML.load(YAML.dump(p))).to eq(p)
++    expect(Mail::YAML.load(YAML.dump(p))).to eq(p)
+   end
+ end
+diff --git a/spec/mail/yaml_spec.rb b/spec/mail/yaml_spec.rb
+new file mode 100644
+index 000000000..7c72fe1ab
+--- /dev/null
++++ b/spec/mail/yaml_spec.rb
+@@ -0,0 +1,13 @@
++# encoding: utf-8
++# frozen_string_literal: true
++require 'spec_helper'
++
++describe Mail::YAML do
++
++  describe "#load" do
++
++    it 'loads YAML' do
++      expect(Mail::YAML.load('{}')).to eq({})
++    end
++  end
++end

diff --git a/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x.patch b/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x.patch
new file mode 100644
index 0000000..ec66510
--- /dev/null
+++ b/rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x.patch
@@ -0,0 +1,54 @@
+From 641771dec33eb23c30c259ebbb98260e1dd80236 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= <josef.simanek@gmail.com>
+Date: Wed, 23 Mar 2022 19:23:08 +0100
+Subject: [PATCH] Add Mail::YAML#load compatible with Psych 3.x and Psych 4.x.
+
+---
+ lib/mail/message.rb          |  4 ++--
+ lib/mail/yaml.rb             | 16 ++++++++++++++++
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+ create mode 100644 lib/mail/yaml.rb
+
+diff --git a/lib/mail/message.rb b/lib/mail/message.rb
+index f5176ac85..f3762f26f 100644
+--- a/lib/mail/message.rb
++++ b/lib/mail/message.rb
+@@ -1,6 +1,6 @@
+ # encoding: utf-8
+ # frozen_string_literal: true
+-require "yaml"
++require 'mail/yaml'
+ 
+ module Mail
+   # The Message class provides a single point of access to all things to do with an
+@@ -1867,7 +1867,7 @@ def to_yaml(opts = {})
+     end
+ 
+     def self.from_yaml(str)
+-      hash = YAML.load(str)
++      hash = Mail::YAML.load(str)
+       m = self.new(:headers => hash['headers'])
+       hash.delete('headers')
+       hash.each do |k,v|
+diff --git a/lib/mail/yaml.rb b/lib/mail/yaml.rb
+new file mode 100644
+index 000000000..c09108558
+--- /dev/null
++++ b/lib/mail/yaml.rb
+@@ -0,0 +1,16 @@
++require 'yaml'
++
++module Mail
++  module YAML
++    # unsafe loading compatible with Psych 3.x and Psych 4.x
++    if ::YAML.respond_to?(:unsafe_load)
++      def self.load(yaml)
++        ::YAML.unsafe_load(yaml)
++      end
++    else
++      def self.load(yaml)
++        ::YAML.load(yaml)
++      end
++    end
++  end
++end

diff --git a/rubygem-mail.spec b/rubygem-mail.spec
index 21ad942..180ed59 100644
--- a/rubygem-mail.spec
+++ b/rubygem-mail.spec
@@ -3,7 +3,7 @@
 
 Name: rubygem-%{gem_name}
 Version: 2.7.1
-Release: 5%{?dist}
+Release: 6%{?dist}
 Summary: Mail provides a nice Ruby DSL for making, sending and reading emails
 License: MIT
 URL: https://github.com/mikel/mail
@@ -12,7 +12,15 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
 # git clone https://github.com/mikel/mail.git --no-checkout
 # cd mail && git archive -v -o mail-2.7.1-specs.txz 2.7.1 spec/
 Source1: %{gem_name}-%{version}-specs.txz
-
+# Fix compatibility with Psych 4.0+.
+# https://github.com/mikel/mail/pull/1476
+Patch0: rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x.patch
+Patch1: rubygem-mail-2.7.1-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psych-4.x-test.patch
+# net-smtp is bundled gem, shipped in ruby-default-gems since Ruby 3.1.
+# There might be explicit dependencies introduced later:
+# https://github.com/mikel/mail/pull/1439
+Requires: rubygem(net-smtp)
+BuildRequires: rubygem(net-smtp)
 BuildRequires: ruby(release)
 BuildRequires: rubygems-devel
 BuildRequires: ruby
@@ -34,6 +42,14 @@ Documentation for %{name}.
 %prep
 %setup -q -n %{gem_name}-%{version} -b1
 
+%patch0 -p1
+
+pushd %{_builddir}
+%patch1 -p1
+popd
+
+%gemspec_add_file 'lib/mail/yaml.rb'
+
 %build
 gem build ../%{gem_name}-%{version}.gemspec
 %gem_install
@@ -61,6 +77,10 @@ popd
 %doc %{gem_instdir}/README.md
 
 %changelog
+* Wed Mar 23 2022 Vít Ondruch <vondruch@redhat.com> - 2.7.1-6
+- Add `rubygem(net-snmp)` dependency for Ruby 3.1 compatibility.
+- Fix Psych 4.0+ compatibility.
+
 * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.1-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
 

                 reply	other threads:[~2026-11-20 23:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179521699600.1.14628443315914974708.rpms-rubygem-mail-42b5a8b3d5dd@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox