summaryrefslogtreecommitdiff
path: root/dev-ruby/safe_yaml
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-01 11:14:56 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-01 11:14:56 +0100
commitc952bf4dc186a298c5ef1596e2c52642072db500 (patch)
tree0b0b9cc4cdda7b2f9d62548ba883329cf6c15274 /dev-ruby/safe_yaml
parent97c0860d9b4db72365710e1b8ed20644d6f5e926 (diff)
gentoo auto-resync : 01:04:2023 - 11:14:56
Diffstat (limited to 'dev-ruby/safe_yaml')
-rw-r--r--dev-ruby/safe_yaml/Manifest3
-rw-r--r--dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch23
-rw-r--r--dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch69
-rw-r--r--dev-ruby/safe_yaml/safe_yaml-1.0.5-r2.ebuild40
4 files changed, 135 insertions, 0 deletions
diff --git a/dev-ruby/safe_yaml/Manifest b/dev-ruby/safe_yaml/Manifest
index 9d4ef12ced57..707e079d385d 100644
--- a/dev-ruby/safe_yaml/Manifest
+++ b/dev-ruby/safe_yaml/Manifest
@@ -1,3 +1,6 @@
+AUX safe_yaml-1.0.5-ruby30-arity.patch 873 BLAKE2B ba39bbdd19dc47c8936d80930724f87b0480e51e35eb979f3800c755d1448691ae10c4738d5b51eca305fe409b5c89c8a1f418af59fbb6b3a060f5ad67cc66d5 SHA512 b4131a892508f98b185ce0bd032830433044c5a4b4270aac53b1cdf7db7df539aae7c6af67640ee53da20f5f7b1b21fadfd65e6891b579f7d984723c631d067c
+AUX safe_yaml-1.0.5-ruby30-openstruct-tests.patch 2915 BLAKE2B fa64c240c02bada3facc94db4b82ea93e2ff87fe2994a0f7eeb076d85386bfc76ea4fea1542abf222b7a79781a12b8557a6f5581784a1b4cf118a7d737bc8300 SHA512 82a51627768d91e17647378fb1a878fcd38557fae040a9b0feadf566c49ebfd74eed3d075b06e7e1d0d401a9f1e5bd067f98f8d8da12cc5a919af1718fa417c9
DIST safe_yaml-1.0.5.gem 30720 BLAKE2B affbf5331cf290c3e7932f53da9b0f488730ae9138f0b28eb1e8e0323c7056635ed73bcadebd52f725895030a153dab13e243d997e84004f5bfac82e82dcebe2 SHA512 d9c8d9c28c3c8708f97cb0545f58152af81056f5e79147424dd7bf625f8e533440d1ed41d6abe2faf84578754823a1215ba28772c2e8593bfcfc397d647187b9
EBUILD safe_yaml-1.0.5-r1.ebuild 1061 BLAKE2B 87fcb218ece611646bf8683469b95e188d067c6eadb93bbaa128e140d4577b27940271f5485a2f120fdafe0b530b46893e32a6a344e236552ea61b9765306bdf SHA512 cd0219f884c96adf463bddf9b0c5157bc67b38edfb29ed79c4d5b701d136c63381a28b6d042ca6eccab18012ead7bfb4ee08c888053a49f37dbbc4b1b7dd0411
+EBUILD safe_yaml-1.0.5-r2.ebuild 1154 BLAKE2B c65138dfe499d68622f9deb8aa0abe01cfbc1cc962a5fc5d2f8057979e33b6370872ac30538d5640de1491188a26ce28ecf00e8f81ca08a3e8b8667a1a255f4c SHA512 dc73405df53fecbee5aff57cdfe506fac27d66fdff01c32cb730d21c86b9e36cef0326b5c0311475904c10b4ec68196ffa36afe87d04c2d918d03e63443b2478
MISC metadata.xml 324 BLAKE2B 5e90b1b8d5ec24d38e29867e2d7287199fda0fe43a065d425a14933ea4319c2fc14768554c5167d1b5104b038b5e82ff634461ae4dd492c3448e360c0653f232 SHA512 916b61fd181e6b32d83467ba0dc619dce6d09ac8a232b02246f3042c169856faf806b58a6c466005411105113ebad617cc0b27dd22f4401e33b89f7b27c2bb13
diff --git a/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch
new file mode 100644
index 000000000000..e994a48bbecb
--- /dev/null
+++ b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-arity.patch
@@ -0,0 +1,23 @@
+From: Daniel Leidert <dleidert@debian.org>
+Date: Wed, 1 Dec 2021 18:51:51 +0100
+Subject: Fix Rubx 3 compatibility
+
+Origin: https://github.com/dtao/safe_yaml/compare/master...paolobrasolin:development
+Bug: https://github.com/dtao/safe_yaml/issues/100
+---
+ lib/safe_yaml/safe_to_ruby_visitor.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/safe_yaml/safe_to_ruby_visitor.rb b/lib/safe_yaml/safe_to_ruby_visitor.rb
+index b980445..5fd71f0 100644
+--- a/lib/safe_yaml/safe_to_ruby_visitor.rb
++++ b/lib/safe_yaml/safe_to_ruby_visitor.rb
+@@ -4,7 +4,7 @@ module SafeYAML
+
+ def initialize(resolver)
+ case INITIALIZE_ARITY
+- when 2
++ when 2, -3
+ # https://github.com/tenderlove/psych/blob/v2.0.0/lib/psych/visitors/to_ruby.rb#L14-L28
+ loader = Psych::ClassLoader.new
+ scanner = Psych::ScalarScanner.new(loader)
diff --git a/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch
new file mode 100644
index 000000000000..9b597276617b
--- /dev/null
+++ b/dev-ruby/safe_yaml/files/safe_yaml-1.0.5-ruby30-openstruct-tests.patch
@@ -0,0 +1,69 @@
+From: Sergio Durigan Junior <sergiodj@debian.org>
+Date: Fri, 28 Jan 2022 16:35:01 -0500
+Subject: Adjust tests to reflect OpenStruct changes on Ruby3.0
+
+Ref.: https://github.com/ruby/psych/issues/540
+
+OpenStruct on Ruby3.0 changed its marshalling/unmarshalling code,
+which is now impacting safe_yaml's testcase. The two adjustments that
+needed to be made are:
+
+- OpenStruct's instance_variable_get will now symbolize its hash keys,
+ instead of using strings.
+
+- OpenStruct's to_yaml method will not output the 'table' entity
+ anymore.
+
+Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
+
+Forwarded: yes, https://github.com/dtao/safe_yaml/pull/102
+---
+ spec/safe_yaml_spec.rb | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/spec/safe_yaml_spec.rb b/spec/safe_yaml_spec.rb
+index aa701a4..1081173 100644
+--- a/spec/safe_yaml_spec.rb
++++ b/spec/safe_yaml_spec.rb
+@@ -318,7 +318,13 @@ describe YAML do
+ it "will allow objects to be deserialized for whitelisted tags" do
+ result = YAML.safe_load("--- !ruby/object:OpenStruct\ntable:\n foo: bar\n")
+ expect(result).to be_a(OpenStruct)
+- expect(result.instance_variable_get(:@table)).to eq({ "foo" => "bar" })
++ if RUBY_VERSION < '3.0'
++ expect(result.instance_variable_get(:@table)).to eq({ "foo" => "bar" })
++ else
++ # Ruby3.0's OpenStruct will now symbolize the hash key.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result.instance_variable_get(:@table)).to eq({ :foo => "bar" })
++ end
+ end
+
+ it "will not deserialize objects without whitelisted tags" do
+@@ -463,10 +469,24 @@ describe YAML do
+
+ it "allows the default option to be overridden on a per-call basis" do
+ result = safe_load_round_trip(OpenStruct.new(:foo => "bar"), :whitelisted_tags => [])
+- expect(result).to eq({ "table" => { :foo => "bar" } })
++ if RUBY_VERSION < '3.0'
++ expect(result).to eq({ "table" => { :foo => "bar" } })
++ else
++ # Ruby3.0's OpenStruct's to_yaml method doesn't output the
++ # 'table' entity anymore.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result).to eq({ "foo" => "bar" })
++ end
+
+ result = safe_load_round_trip(OpenStruct.new(:foo => "bar"), :deserialize_symbols => false, :whitelisted_tags => [])
+- expect(result).to eq({ "table" => { ":foo" => "bar" } })
++ if RUBY_VERSION < '3.0'
++ expect(result).to eq({ "table" => { ":foo" => "bar" } })
++ else
++ # Ruby3.0's OpenStruct's to_yaml method doesn't output the
++ # 'table' entity anymore.
++ # Ref.: https://github.com/ruby/psych/issues/540
++ expect(result).to eq({ "foo" => "bar" })
++ end
+ end
+ end
+ end
diff --git a/dev-ruby/safe_yaml/safe_yaml-1.0.5-r2.ebuild b/dev-ruby/safe_yaml/safe_yaml-1.0.5-r2.ebuild
new file mode 100644
index 000000000000..5d6063220f78
--- /dev/null
+++ b/dev-ruby/safe_yaml/safe_yaml-1.0.5-r2.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Broken with newer psych: https://github.com/dtao/safe_yaml/pull/101
+USE_RUBY="ruby27 ruby30"
+
+RUBY_FAKEGEM_EXTRADOC="README.md"
+RUBY_FAKEGEM_RECIPE_TEST="none"
+
+inherit ruby-fakegem
+
+DESCRIPTION="Parse YAML safely, alternative implementation of YAML.load"
+HOMEPAGE="https://github.com/dtao/safe_yaml"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="test"
+
+PATCHES=( "${FILESDIR}/${P}-ruby30-arity.patch" "${FILESDIR}/${P}-ruby30-openstruct-tests.patch" )
+
+ruby_add_bdepend "test? ( dev-ruby/hashie
+ dev-ruby/heredoc_unindent
+ dev-ruby/rspec:3 )"
+
+all_ruby_prepare() {
+ sed -i -e '/local timezone/askip "timezone"' spec/transform/to_date_spec.rb || die
+
+ sed -i -e '1igem "psych", "~> 3.0"' spec/spec_helper.rb || die
+}
+
+each_ruby_test() {
+ # Run specs with monkeypatch
+ ${RUBY} -S rspec-3 spec --tag ~libraries || die
+
+ # Running specs without monkeypatch
+ ${RUBY} -S rspec-3 spec --tag libraries || die
+}