diff options
Diffstat (limited to 'dev-ruby/mail')
-rw-r--r-- | dev-ruby/mail/files/mail-2.7.1-psych-4.patch | 122 | ||||
-rw-r--r-- | dev-ruby/mail/mail-2.7.1-r1.ebuild | 4 | ||||
-rw-r--r-- | dev-ruby/mail/mail-2.7.1-r2.ebuild | 37 |
3 files changed, 161 insertions, 2 deletions
diff --git a/dev-ruby/mail/files/mail-2.7.1-psych-4.patch b/dev-ruby/mail/files/mail-2.7.1-psych-4.patch new file mode 100644 index 000000000000..ea3dff47910e --- /dev/null +++ b/dev-ruby/mail/files/mail-2.7.1-psych-4.patch @@ -0,0 +1,122 @@ +https://bugs.gentoo.org/835322 + +https://github.com/mikel/mail/commit/a20fdd591bd5b1596983f5e1ee6ffed4e0b1f5f9 +https://sources.debian.org/patches/ruby-mail/2.7.1%2Bdfsg1-2/0001-Add-Mail-YAML-load-compatible-with-Psych-3.x-and-Psy.patch/ + +From: =?utf-8?b?Sm9zZWYgxaBpbcOhbmVr?= <josef.simanek@gmail.com> +Date: Sun, 4 Dec 2022 15:18:33 -0300 +Subject: Add Mail::YAML#load compatible with Psych 3.x and Psych 4.x. +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Co-authored-by: Vít Ondruch <vondruch@redhat.com> +Backported-by: Antonio Terceiro <terceiro@debian.org> +Origin: https://github.com/mikel/mail/commit/a20fdd591bd5b1596983f5e1ee6ffed4e0b1f5f9 +--- 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 @@ module Mail + 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| +--- /dev/null ++++ b/lib/mail/yaml.rb +@@ -0,0 +1,30 @@ ++require 'yaml' ++ ++module Mail ++ module YAML ++ def self.load(yaml) ++ permitted_classes = [ ++ Symbol, ++ ++ Mail::Body, ++ ++ # Delivery methods as listed in mail/configuration.rb ++ Mail::SMTP, ++ Mail::Sendmail, ++ Mail::Exim, ++ Mail::FileDelivery, ++ Mail::SMTPConnection, ++ Mail::TestMailer, ++ Mail::LoggerDelivery, ++ ++ Mail.delivery_method.class, ++ ] ++ ++ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') ++ ::YAML.safe_load(yaml, :permitted_classes => permitted_classes) ++ else ++ ::YAML.safe_load(yaml, permitted_classes) ++ end ++ end ++ end ++end +--- a/spec/mail/message_spec.rb ++++ b/spec/mail/message_spec.rb +@@ -198,7 +198,7 @@ describe Mail::Message do + + 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 @@ describe Mail::Message do + 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 @@ describe Mail::Message do + + 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 +--- a/spec/mail/parts_list_spec.rb ++++ b/spec/mail/parts_list_spec.rb +@@ -89,6 +89,6 @@ describe "PartsList" do + + 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 +--- /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/dev-ruby/mail/mail-2.7.1-r1.ebuild b/dev-ruby/mail/mail-2.7.1-r1.ebuild index 9646b2657694..e137da202092 100644 --- a/dev-ruby/mail/mail-2.7.1-r1.ebuild +++ b/dev-ruby/mail/mail-2.7.1-r1.ebuild @@ -1,8 +1,8 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -USE_RUBY="ruby26 ruby27 ruby30" +USE_RUBY="ruby26 ruby27 ruby30 ruby31" RUBY_FAKEGEM_RECIPE_TEST="rspec3" diff --git a/dev-ruby/mail/mail-2.7.1-r2.ebuild b/dev-ruby/mail/mail-2.7.1-r2.ebuild new file mode 100644 index 000000000000..aa87cad31b49 --- /dev/null +++ b/dev-ruby/mail/mail-2.7.1-r2.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +USE_RUBY="ruby27 ruby30 ruby31 ruby32" + +RUBY_FAKEGEM_RECIPE_TEST="rspec3" + +RUBY_FAKEGEM_TASK_DOC="" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.rdoc README.md" + +RUBY_FAKEGEM_GEMSPEC="mail.gemspec" + +inherit ruby-fakegem + +GITHUB_USER="mikel" + +DESCRIPTION="An email handling library" +HOMEPAGE="https://github.com/mikel/mail" +SRC_URI="https://github.com/${GITHUB_USER}/mail/archive/${PV}.tar.gz -> ${P}-git.tar.gz" + +LICENSE="MIT" +SLOT="$(ver_cut 1-2)" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +ruby_add_rdepend ">=dev-ruby/mini_mime-0.1.1" + +PATCHES=( + "${FILESDIR}"/${P}-psych-4.patch +) + +all_ruby_prepare() { + rm Gemfile || die + sed -i -e '/[Bb]undle/d' -e '6d' Rakefile || die "Unable to remove Bundler code." +} |