diff options
Diffstat (limited to 'dev-ruby/rack')
-rw-r--r-- | dev-ruby/rack/Manifest | 3 | ||||
-rw-r--r-- | dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch | 210 | ||||
-rw-r--r-- | dev-ruby/rack/rack-2.2.3.1.ebuild | 56 |
3 files changed, 269 insertions, 0 deletions
diff --git a/dev-ruby/rack/Manifest b/dev-ruby/rack/Manifest index 73558c894131..cb431c14a1d3 100644 --- a/dev-ruby/rack/Manifest +++ b/dev-ruby/rack/Manifest @@ -1,3 +1,6 @@ +AUX rack-2.2.3.1-ruby30.patch 7607 BLAKE2B c9f39f901fbc809093cfb4702fed3495dc1091ef0241f0df20fef4659f667e65ab93d96a9128a6b2c47e809cfb4a63b8834c46898edbb59dfd0d824066802e0b SHA512 13b7a938d9af575362d39b06bb3a50ce1fb7afe632c02a5c3cd46670518752d4dccee56da055c6d67da503df971ecce0ae744e2d2e6cca513483561f695e081e +DIST rack-2.2.3.1.tar.gz 278178 BLAKE2B 30fb0da5c2a7d380e4a2ee8bede908a0c1f0c3c0953c5cfcfe1d92a993a5258e1137be796c699dc41470167a36ca6b00e86037a16f3eafbb886c40b6addcce96 SHA512 fea8d0a15b5e04b53e147c3675ca491952c5a16aa2107bc66452b0248fb3a0d07ac9574b77addce7150f69beefb029587f6d141abf644c335cfe2095b022dd1f DIST rack-2.2.3.tar.gz 278045 BLAKE2B 2182ab6ee2ca0e40bd131dc96cf15d7e1015570a0702c2419e50da9eae6afedc0f1543a2fdc1fb32022a65788ab486b7add688c8bf201ad46a3d101b6e625a8b SHA512 0daefd1fd7d1c83a5aaf0e8a3c0d734f805f6718c3f2d20673e78242f10fa99c24f8e8d480cb7f0ee299d96a4b691e4a19c967785de946dc863e9b78e0c3ac53 +EBUILD rack-2.2.3.1.ebuild 1760 BLAKE2B 5ab2808c1cbebec4b443115088a01f8ca1000378e78e407ba80ff4e2bda2b85f07a67a9af9d9a80af3057c0b26b4e03dc389b4a40f1cefb1bc02cb407a21ae2a SHA512 e266a59b0e68de15bbfd5adffea0f68a16246d4afad93cfbab3c9b85f4bd031fe1b2c54ced9ec39a3ac6c23c2bf1b43a95cb66e3b6bcf72a694b9c0ec063c6c3 EBUILD rack-2.2.3.ebuild 1521 BLAKE2B bbff1fee416b6d648f878d549c1694dedaea3686c6063b05c28bf8804dfcfb74b7084365eda9cfbc736fdcf8f679ce72641faba6a2f8ded63187f5d80cbed6f3 SHA512 211137142efc02826a6e74f9fcbbe033646f7597e7496119657415ada6decd5b872f93be1af70b1b79eb7780bb6807b09f63f20b4fc57ac66c670fee7dc53a08 MISC metadata.xml 392 BLAKE2B 625ee54c32c0350c08e68ec422fd024c364bf2dc26b5402363db0909d5720fea9a8741cf7ef8bcdcec21bcf3ee4efb6ccc514231d12ceb87b927035ee5a1d408 SHA512 96436f55bc9e3d93373e6e3c4858048aef3811654f8d5f11aa9b37b89b012e0d1770c1617764b4ef72d5e4656b0113a1bf15f9398c9bc23f55de774591020afc diff --git a/dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch b/dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch new file mode 100644 index 000000000000..467fb3487d67 --- /dev/null +++ b/dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch @@ -0,0 +1,210 @@ +From 43b5565a73817d66b6d96de2e28d525a2a56f852 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= <josef.simanek@gmail.com> +Date: Mon, 4 Apr 2022 23:17:19 +0200 +Subject: [PATCH] Newer rubies spec compatibility. + +--- + Gemfile | 5 +++++ + lib/rack/utils.rb | 7 +++++-- + test/spec_mock.rb | 34 +++++++++++++++++----------------- + test/testrequest.rb | 4 ++-- + 4 files changed, 29 insertions(+), 21 deletions(-) + +diff --git a/Gemfile b/Gemfile +index dc075a4ca..5768eedf7 100644 +--- a/Gemfile ++++ b/Gemfile +@@ -14,6 +14,11 @@ end + + gem "rubocop", require: false + ++group :test do ++ gem "webrick" # gemified in Ruby 3.1+ ++ gem "psych", "~> 4.0" # using YAML#unsafe_load in tests which is 4.0+ only ++end ++ + # Alternative solution that might work, but it has bad interactions with + # Gemfile.lock if that gets committed/reused: + # c_platforms = [:mri] if Gem.platforms.last.os == "java" +diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb +index d3b3b1d42..34849ded1 100644 +--- a/lib/rack/utils.rb ++++ b/lib/rack/utils.rb +@@ -22,6 +22,9 @@ module Utils + COMMON_SEP = QueryParser::COMMON_SEP + KeySpaceConstrainedParams = QueryParser::Params + ++ RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ] ++ RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] ++ + class << self + attr_accessor :default_query_parser + end +@@ -327,8 +330,8 @@ def rfc2822(time) + # weekday and month. + # + def rfc2109(time) +- wday = Time::RFC2822_DAY_NAME[time.wday] +- mon = Time::RFC2822_MONTH_NAME[time.mon - 1] ++ wday = RFC2822_DAY_NAME[time.wday] ++ mon = RFC2822_MONTH_NAME[time.mon - 1] + time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT") + end + +diff --git a/test/spec_mock.rb b/test/spec_mock.rb +index d2311f5a2..73fb7b235 100644 +--- a/test/spec_mock.rb ++++ b/test/spec_mock.rb +@@ -47,7 +47,7 @@ + it "provide sensible defaults" do + res = Rack::MockRequest.new(app).request + +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["SERVER_NAME"].must_equal "example.org" + env["SERVER_PORT"].must_equal "80" +@@ -60,23 +60,23 @@ + + it "allow GET/POST/PUT/DELETE/HEAD" do + res = Rack::MockRequest.new(app).get("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + + res = Rack::MockRequest.new(app).post("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "POST" + + res = Rack::MockRequest.new(app).put("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "PUT" + + res = Rack::MockRequest.new(app).patch("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "PATCH" + + res = Rack::MockRequest.new(app).delete("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "DELETE" + + Rack::MockRequest.env_for("/", method: "HEAD")["REQUEST_METHOD"] +@@ -102,11 +102,11 @@ + + it "allow posting" do + res = Rack::MockRequest.new(app).get("", input: "foo") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["mock.postdata"].must_equal "foo" + + res = Rack::MockRequest.new(app).post("", input: StringIO.new("foo")) +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["mock.postdata"].must_equal "foo" + end + +@@ -115,7 +115,7 @@ + get("https://bla.example.org:9292/meh/foo?bar") + res.must_be_kind_of Rack::MockResponse + +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["SERVER_NAME"].must_equal "bla.example.org" + env["SERVER_PORT"].must_equal "9292" +@@ -129,7 +129,7 @@ + get("https://example.org/foo") + res.must_be_kind_of Rack::MockResponse + +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["SERVER_NAME"].must_equal "example.org" + env["SERVER_PORT"].must_equal "443" +@@ -144,7 +144,7 @@ + get("foo") + res.must_be_kind_of Rack::MockResponse + +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["SERVER_NAME"].must_equal "example.org" + env["SERVER_PORT"].must_equal "80" +@@ -155,13 +155,13 @@ + + it "properly convert method name to an uppercase string" do + res = Rack::MockRequest.new(app).request(:get) +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + end + + it "accept params and build query string for GET requests" do + res = Rack::MockRequest.new(app).get("/foo?baz=2", params: { foo: { bar: "1" } }) +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["QUERY_STRING"].must_include "baz=2" + env["QUERY_STRING"].must_include "foo[bar]=1" +@@ -171,7 +171,7 @@ + + it "accept raw input in params for GET requests" do + res = Rack::MockRequest.new(app).get("/foo?baz=2", params: "foo[bar]=1") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "GET" + env["QUERY_STRING"].must_include "baz=2" + env["QUERY_STRING"].must_include "foo[bar]=1" +@@ -181,7 +181,7 @@ + + it "accept params and build url encoded params for POST requests" do + res = Rack::MockRequest.new(app).post("/foo", params: { foo: { bar: "1" } }) +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "POST" + env["QUERY_STRING"].must_equal "" + env["PATH_INFO"].must_equal "/foo" +@@ -191,7 +191,7 @@ + + it "accept raw input in params for POST requests" do + res = Rack::MockRequest.new(app).post("/foo", params: "foo[bar]=1") +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "POST" + env["QUERY_STRING"].must_equal "" + env["PATH_INFO"].must_equal "/foo" +@@ -202,7 +202,7 @@ + it "accept params and build multipart encoded params for POST requests" do + files = Rack::Multipart::UploadedFile.new(File.join(File.dirname(__FILE__), "multipart", "file1.txt")) + res = Rack::MockRequest.new(app).post("/foo", params: { "submit-name" => "Larry", "files" => files }) +- env = YAML.load(res.body) ++ env = YAML.unsafe_load(res.body) + env["REQUEST_METHOD"].must_equal "POST" + env["QUERY_STRING"].must_equal "" + env["PATH_INFO"].must_equal "/foo" +diff --git a/test/testrequest.rb b/test/testrequest.rb +index aabe7fa6b..481a4e54d 100644 +--- a/test/testrequest.rb ++++ b/test/testrequest.rb +@@ -42,7 +42,7 @@ def GET(path, header = {}) + http.request(get) { |response| + @status = response.code.to_i + begin +- @response = YAML.load(response.body) ++ @response = YAML.unsafe_load(response.body) + rescue TypeError, ArgumentError + @response = nil + end +@@ -60,7 +60,7 @@ def POST(path, formdata = {}, header = {}) + post.basic_auth user, passwd if user && passwd + http.request(post) { |response| + @status = response.code.to_i +- @response = YAML.load(response.body) ++ @response = YAML.unsafe_load(response.body) + } + } + end diff --git a/dev-ruby/rack/rack-2.2.3.1.ebuild b/dev-ruby/rack/rack-2.2.3.1.ebuild new file mode 100644 index 000000000000..be24b996282c --- /dev/null +++ b/dev-ruby/rack/rack-2.2.3.1.ebuild @@ -0,0 +1,56 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby26 ruby27 ruby30 ruby31" + +RUBY_FAKEGEM_DOCDIR="doc" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.rdoc SPEC.rdoc" + +RUBY_FAKEGEM_GEMSPEC="rack.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="A modular Ruby webserver interface" +HOMEPAGE="https://github.com/rack/rack" +SRC_URI="https://github.com/rack/rack/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="$(ver_cut 1-2)" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="" + +ruby_add_rdepend "virtual/ruby-ssl" + +ruby_add_bdepend "test? ( + dev-ruby/minitest:5 + dev-ruby/minitest-global_expectations + dev-ruby/concurrent-ruby + =dev-ruby/psych-4* + dev-ruby/webrick +)" + +# The gem has automagic dependencies over mongrel, ruby-openid, +# memcache-client, thin, mongrel and camping; not sure if we should +# make them dependencies at all. + +# Block against versions in older slots that also try to install a binary. +RDEPEND="${RDEPEND} !!<dev-ruby/rack-2.0.8-r1:2.0 !!<dev-ruby/rack-2.1.1-r1:2.1" + +PATCHES=( "${FILESDIR}/${P}-ruby30.patch" ) + +all_ruby_prepare() { + # The build system tries to generate the ChangeLog from git. Create + # an empty file to avoid a needless dependency on git. + touch ChangeLog || die + + # Avoid development dependency + sed -i -e '/minitest-sprint/ s:^:#:' -e "s:require_relative ':require './:" rack.gemspec || die + + # Avoid test failing due to security version number usage + sed -i -e '/support -v option to get version/askip "broken with security version number"' test/spec_server.rb || die +} + +each_ruby_test() { + ${RUBY} -Ilib:test:. -e "require 'test/gemloader.rb'; Dir['test/spec_*.rb'].each{|f| require f}" || die +} |