summaryrefslogtreecommitdiff
path: root/dev-ruby/pathutil
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-06-23 13:24:24 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-06-23 13:24:24 +0100
commitcbf055ae8f2fb67e00df9ea122e64a67f930f576 (patch)
treeed9ab83fb918b8bc4fb292f48dbce597be5d33fb /dev-ruby/pathutil
parent8702447e13af0a540c01f75bee0416677bced231 (diff)
gentoo auto-resync : 23:06:2023 - 13:24:24
Diffstat (limited to 'dev-ruby/pathutil')
-rw-r--r--dev-ruby/pathutil/Manifest4
-rw-r--r--dev-ruby/pathutil/files/pathutil-0.16.2-ruby30.patch2
-rw-r--r--dev-ruby/pathutil/files/pathutil-0.16.2-ruby31.patch247
-rw-r--r--dev-ruby/pathutil/pathutil-0.16.2-r2.ebuild35
4 files changed, 287 insertions, 1 deletions
diff --git a/dev-ruby/pathutil/Manifest b/dev-ruby/pathutil/Manifest
index 2bd35f6343ce..38d3a85b3e55 100644
--- a/dev-ruby/pathutil/Manifest
+++ b/dev-ruby/pathutil/Manifest
@@ -1,4 +1,6 @@
-AUX pathutil-0.16.2-ruby30.patch 5578 BLAKE2B eb42f2c3ec294b25d86312966c39613fbd0ca646b6eb3e933b0f849bf9f9a2dbea80b340c62d1342abbd10e2598a60d48c102e2f12e49dba24c21d7eaec72f5c SHA512 cc9f7f94b5a830c6f377e5414da317492caf6b5bd89ee8c414753c09c427b2a87852ce8767effacfd0af2ca260c8b05e322e7772b7cc786c4f4531bcf8107cc2
+AUX pathutil-0.16.2-ruby30.patch 5624 BLAKE2B 329be93957be0ad11ac971a5155c3a64b7592ce9dd068d99612d11b26ab7d572770e035f5a72638e5074e304472c6d11e18a39727215eaa47ceec0f14dd723ef SHA512 99e0428661c1d9d76f028e1a802139bcc49949aa405cbd0187827bba87885c3629ccb95f271778377dca8cf71fc9fb897066d5754e39db5334a4cf01b4e63073
+AUX pathutil-0.16.2-ruby31.patch 6916 BLAKE2B 25a13ce3e9466fc911f7c8c7080e3cfd12977475320e15c610bedf50a68b343289b0310d77ecafcaa245edb53c3dbbb79aa194db6dcff5b356215af14b700260 SHA512 976e9be734964fd5fabd1eb309ded5619408f2039796fdd29b0c9030e819d847094c99cff7233eade8689f35001438240feb5eb41901a4d528d38e32f0a20314
DIST pathutil-0.16.2.tar.gz 26079 BLAKE2B 5a9d1dac1f1171ee6bc447725c04883cb56a9071927f3e0fdbcb9754345ac77a6609533a1308a411cb22658caeb2a4bed49225923af109bca288cfb3aeb3d669 SHA512 d06daf365b94dacd33966f3928a53f0f00d2fca7b9f6348a7efd2b55ab5ba937459e5bd78fde241f30749a1ae55e4ae3ba1ed8945b5333464e7d3ce9666cd054
EBUILD pathutil-0.16.2-r1.ebuild 955 BLAKE2B 02b346d9ebc67e43fbc05e23bc16b18d9b4724a60c718e6e166ac888cb626804d72c3579214f1b5b681c1a548c4318df250f3fb0901c749c89293999d0a6a792 SHA512 e3ffca48a818a20238f37a48aea17e06cfe012318fb064cbdad0be26e95ff0e725c0a127215c1a64fa3c4d1fc8377c97aaf8b88e9cbe925025d15f6d58a032ca
+EBUILD pathutil-0.16.2-r2.ebuild 933 BLAKE2B 8703227d4963ba4eec4f525efc869f355676b1bb44cbf8cd1b2dd85482a256942be1e1ced3b072458b35c7e5695289bd6728e5b48c56b68c8d5ba7c6c764ac4f SHA512 ef0c0640021f7b98b016b06ca367562bce424df0b1c5097bce14062799bb22f7d85198e202e705fa0723fee552dede8bb06edf581fe8b2134881f11083e59175
MISC metadata.xml 397 BLAKE2B 3f14fd5aaeb2954c6d714e28bf89c6cae920c80c130de454d453a61b81598a673200ed6ce07035be2769bf5f3f36eb926540f0ff7236b5da65cd021b508f104b SHA512 58d97f4464d9603f6c3dddd30c5258cccb03a4d0784ba8f268710d977d49437a677c9b9596485656762e5e2ef4694ca2b1f4018fefb9e84066c3296d73cfb18d
diff --git a/dev-ruby/pathutil/files/pathutil-0.16.2-ruby30.patch b/dev-ruby/pathutil/files/pathutil-0.16.2-ruby30.patch
index 374cd4005930..9bb290d4bf24 100644
--- a/dev-ruby/pathutil/files/pathutil-0.16.2-ruby30.patch
+++ b/dev-ruby/pathutil/files/pathutil-0.16.2-ruby30.patch
@@ -1,3 +1,5 @@
+https://github.com/envygeeks/pathutil/pull/5
+
From 3451a10c362fc867b20c7e471a551b31c40a0246 Mon Sep 17 00:00:00 2001
From: Tom Dunlap <tom@motevets.com>
Date: Tue, 9 Jun 2020 12:59:32 -0400
diff --git a/dev-ruby/pathutil/files/pathutil-0.16.2-ruby31.patch b/dev-ruby/pathutil/files/pathutil-0.16.2-ruby31.patch
new file mode 100644
index 000000000000..0bfc4c5919b5
--- /dev/null
+++ b/dev-ruby/pathutil/files/pathutil-0.16.2-ruby31.patch
@@ -0,0 +1,247 @@
+https://github.com/envygeeks/pathutil/pull/7
+
+From c0ecc9a516ed43facfb3a80735034c892d517d1a Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sun, 3 Apr 2022 20:20:44 +0200
+Subject: [PATCH 1/2] Fix usage of YAML.safe_load for compatibility with Ruby
+ >=2.4
+
+YAML.safe_load in Ruby 3.1.1 doesn't accept deprecated positional parameters anymore:
+
+ 1) Pathutil::Helpers#load_yaml should be able to parse YAML
+ Failure/Error:
+ YAML.safe_load(
+ data,
+ whitelist_classes,
+ whitelist_symbols,
+ aliases
+ )
+
+ ArgumentError:
+ wrong number of arguments (given 4, expected 1)
+ # ./lib/pathutil/helpers.rb:44:in `load_yaml'
+ # ./spec/tests/lib/pathutil/helpers_spec.rb:25:in `block (3 levels) in <top (required)>'
+
+From 868efe4022f944cef81b05ae01e00fab2d51ee5c Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sun, 3 Apr 2022 20:35:50 +0200
+Subject: [PATCH 2/2] Remove deprecated SafeYAML support
+
+SafeYAML has been deprecated a very long time ago.
+--- a/Gemfile
++++ b/Gemfile
+@@ -7,7 +7,6 @@ gem "rake", :require => false
+ gemspec
+
+ group :test do
+- gem "safe_yaml", :require => false
+ gem "luna-rspec-formatters", :require => false
+ gem "simplecov", :require => false
+ end
+--- a/README.md
++++ b/README.md
+@@ -26,7 +26,7 @@ but only if they originate from the given root.
+ - `>=`, `>` - Check if a file is in but ahead of a path: `Pathutil.new("/tmp/hello") > "/tmp" # => true`
+ - `in_path?` - Check if a file is within a given path: `Pathutil.new("/tmp/hello").in_path?("/tmp") # => true`
+ - `<=`, `<` - Check if a file is in but below a path: `Pathutil.new("/tmp") < "/tmp/hello" # => true`
+-- `read_yaml` - a wrapper around `Yaml.safe_load` and `SafeYAML` to make reading `YAML` easy.
++- `read_yaml` - a wrapper around `Yaml.safe_load` to make reading `YAML` easy.
+ - `children` - behaves like Pathname, except it accepts a block to work on the path.
+ - `safe_copy` - Copy files, disallowing symlinks unless `in_path?`
+ - `enforce_root` - Force a root if not already in that root.
+--- a/benchmark/yaml.rb
++++ /dev/null
+@@ -1,16 +0,0 @@
+-# Frozen-string-literal: true
+-# Copyright: 2015 - 2017 Jordon Bedwell - MIT License
+-# Encoding: utf-8
+-
+-require "bundler/setup"
+-require "safe_yaml/load"
+-require "benchmark/ips"
+-require "pathutil"
+-
+-data = "hello: world\nworld: hello"
+-Benchmark.ips :quiet => true do |x|
+- x.json! "benchmark.json"
+- x.report("A:SafeYAML.load") { SafeYAML.load(data) }
+- x.report("B:Pathutil::Helpers.load_yaml") { Pathutil::Helpers.load_yaml(data) }
+- x.compare!
+-end
+--- a/lib/pathutil/helpers.rb
++++ b/lib/pathutil/helpers.rb
+@@ -20,7 +20,7 @@ class Pathutil
+ end
+
+ # --
+- # Wraps around YAML and SafeYAML to provide alternatives to Rubies.
++ # Wraps around YAMLto provide alternatives to Rubies.
+ # @note We default aliases to yes so we can detect if you explicit true.
+ # @return Hash
+ # --
+@@ -34,20 +34,12 @@ class Pathutil
+ )
+ end
+
+- if !YAML.respond_to?(:safe_load)
+- setup_safe_yaml whitelist_classes, aliases
+- SafeYAML.load(
+- data
+- )
+-
+- else
+- YAML.safe_load(
+- data,
+- whitelist_classes,
+- whitelist_symbols,
+- aliases
+- )
+- end
++ YAML.safe_load(
++ data,
++ permitted_classes: whitelist_classes,
++ permitted_symbols: whitelist_symbols,
++ aliases: aliases
++ )
+ end
+
+ # --
+@@ -109,21 +101,5 @@ class Pathutil
+ prefix, ext || ""
+ ]
+ end
+-
+- # --
+- # Wrap around, cleanup, deprecate and use SafeYAML.
+- # rubocop:enable Style/ParallelAssignment
+- # --
+- private
+- def setup_safe_yaml(whitelist_classes, aliases)
+- warn "WARN: SafeYAML does not support disabling of aliases." if aliases && aliases != :yes
+- warn "WARN: SafeYAML will be removed when Ruby 2.0 goes EOL."
+- require "safe_yaml/load"
+-
+- SafeYAML.restore_defaults!
+- whitelist_classes.map(&SafeYAML.method(
+- :whitelist_class!
+- ))
+- end
+ end
+ end
+--- a/spec/tests/lib/pathutil/helpers_spec.rb
++++ b/spec/tests/lib/pathutil/helpers_spec.rb
+@@ -26,113 +26,10 @@ describe Pathutil::Helpers do
+ "hello" => "world"
+ })
+ end
++ end
+
+ #
+
+- context "when safe" do
+- it "should reject any special classes", :disable => :oldest_ruby do
+- expect { described_class.load_yaml(":hello: :world") }.to raise_error(
+- Psych::DisallowedClass
+- )
+- end
+-
+- #
+-
+- context "when using SafeYAML" do
+- before do
+- allow(YAML).to receive(:respond_to?).with(:safe_load).and_return(false)
+- expect_any_instance_of(described_class).to receive(:warn).and_return(
+- nil
+- )
+- end
+-
+- #
+-
+- context do
+- it "should warn it's deprecated" do
+- expect(described_class).to receive(:warn).and_return(
+- nil
+- )
+- end
+-
+- #
+-
+- after do
+- described_class.load_yaml(
+- ":hello: :world"
+- )
+- end
+- end
+-
+- #
+-
+- context "when trying to disable aliases" do
+- it "should warn that you cannot disable them in SafeYAML" do
+- expect(described_class).to receive(:warn).exactly(2).times.and_return(
+- nil
+- )
+- end
+-
+- #
+-
+- after do
+- described_class.load_yaml("hello: world", aliases: true)
+- end
+- end
+-
+- #
+-
+- it "should parse with SafeYAML" do
+- expect(described_class.load_yaml(":hello: :world")).to eq({
+- ":hello" => ":world"
+- })
+- end
+- end
+- end
+-
+- #
+-
+- context "when whitelisting classes" do
+- it "should allow that class to be loaded" do
+- expect(described_class.load_yaml(":hello: :world", :whitelist_classes => [Symbol])).to eq({
+- :hello => :world
+- })
+- end
+- end
+-
+- #
+-
+- context "when diallowing aliases" do
+- it "should throw the parse" do
+- yaml = "version: &version 1\nother_version: *version"
+- expect { described_class.load_yaml(yaml, :aliases => false) }.to raise_error(
+- Psych::BadAlias
+- )
+- end
+- end
+-
+- #
+-
+- context do
+- it "should allow aliases by default" do
+- expect(described_class.load_yaml("version: &version 1\nother_version: *version")).to eq({
+- "version" => 1, "other_version" => 1
+- })
+- end
+- end
+-
+- #
+-
+- context do
+- it "should parse YAML" do
+- expect(described_class.load_yaml("hello: world\nworld: hello")).to eq({
+- "hello" => "world",
+- "world" => "hello"
+- })
+- end
+- end
+- end
+-
+ #
+
+ describe ".make_tmpname" do
diff --git a/dev-ruby/pathutil/pathutil-0.16.2-r2.ebuild b/dev-ruby/pathutil/pathutil-0.16.2-r2.ebuild
new file mode 100644
index 000000000000..296caa499f17
--- /dev/null
+++ b/dev-ruby/pathutil/pathutil-0.16.2-r2.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby30 ruby31"
+RUBY_FAKEGEM_RECIPE_TEST="rspec3"
+RUBY_FAKEGEM_GEMSPEC="Gem.gemspec"
+
+inherit ruby-fakegem
+
+DESCRIPTION="Like Pathname but a little less insane"
+HOMEPAGE="https://rubygems.org/gems/pathutil https://github.com/envygeeks/pathutil"
+SRC_URI="https://github.com/envygeeks/pathutil/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+
+ruby_add_rdepend "
+ >=dev-ruby/forwardable-extended-2.6
+ <dev-ruby/forwardable-extended-3
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-ruby30.patch"
+ "${FILESDIR}/${P}-ruby31.patch"
+)
+
+all_ruby_prepare() {
+ sed -i -e '/\(coverage\|luna\|rspec\/helpers\)/ s:^:#:' \
+ -e '1irequire "pathname"; require "tempfile"; require "tmpdir"; require "json" ; gem "psych", "~> 5.0"' \
+ spec/rspec/helper.rb || die
+ rm -f spec/support/coverage.rb || die
+}