From 7490abe4066b965d222764acf0ae164788cf1721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 9 Aug 2022 11:47:38 +0200 Subject: [PATCH] Update to Rack 2.2.3 Please note that `memcache-client` is not required since 2.1.0: https://github.com/rack/rack/pull/1421 And concurrent-ruby since 2.0.4: https://github.com/rack/rack/commit/261825768e3e769959f3eb30ec9f24a707a9b2ac Resolves: rhbz#2091121 Resolves: rhbz#2113698 --- ...ck-2.2.3-Handle-changes-to-YAML-test.patch | 192 ------------------ ...em-rack-2.2.3-Handle-changes-to-YAML.patch | 35 ---- rubygem-rack.spec | 56 ++--- sources | 4 +- 4 files changed, 15 insertions(+), 272 deletions(-) delete mode 100644 rubygem-rack-2.2.3-Handle-changes-to-YAML-test.patch delete mode 100644 rubygem-rack-2.2.3-Handle-changes-to-YAML.patch diff --git a/rubygem-rack-2.2.3-Handle-changes-to-YAML-test.patch b/rubygem-rack-2.2.3-Handle-changes-to-YAML-test.patch deleted file mode 100644 index 8c424a1..0000000 --- a/rubygem-rack-2.2.3-Handle-changes-to-YAML-test.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 4aed1c0f68057a554b27e8451243579b5e79771b Mon Sep 17 00:00:00 2001 -From: Samuel Williams -Date: Sat, 15 Jan 2022 16:09:32 +1300 -Subject: [PATCH 1/2] Test with latest version of psych. - ---- - test/spec_mock.rb | 34 +++++++++++++++---------------- - test/testrequest.rb | 4 ++-- - 2 files changed, 19 insertions(+), 19 deletions(-) - -diff --git a/test/spec_mock.rb b/test/spec_mock.rb -index 24fefe2e4..71001d176 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 - -From 62504264cd305533373afe53cc18c6ce098217b8 Mon Sep 17 00:00:00 2001 -From: Samuel Williams -Date: Sat, 15 Jan 2022 16:09:51 +1300 -Subject: [PATCH 2/2] Remove obsolete support for RFC2109 date/time formatting. - ---- - test/spec_utils.rb | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/test/spec_utils.rb b/test/spec_utils.rb -index 428abbfd7..6aa0c17e4 100644 ---- a/test/spec_utils.rb -+++ b/test/spec_utils.rb -@@ -481,10 +481,6 @@ def initialize(*) - Rack::Utils.rfc2822(Time.at(0).gmtime).must_equal "Thu, 01 Jan 1970 00:00:00 -0000" - end - -- it "return rfc2109 format from rfc2109 helper" do -- Rack::Utils.rfc2109(Time.at(0).gmtime).must_equal "Thu, 01-Jan-1970 00:00:00 GMT" -- end -- - it "clean directory traversal" do - Rack::Utils.clean_path_info("/cgi/../cgi/test").must_equal "/cgi/test" - Rack::Utils.clean_path_info(".").must_be_empty diff --git a/rubygem-rack-2.2.3-Handle-changes-to-YAML.patch b/rubygem-rack-2.2.3-Handle-changes-to-YAML.patch deleted file mode 100644 index 8a268ed..0000000 --- a/rubygem-rack-2.2.3-Handle-changes-to-YAML.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 62504264cd305533373afe53cc18c6ce098217b8 Mon Sep 17 00:00:00 2001 -From: Samuel Williams -Date: Sat, 15 Jan 2022 16:09:51 +1300 -Subject: [PATCH 2/2] Remove obsolete support for RFC2109 date/time formatting. - ---- - lib/rack/utils.rb | 15 --------------- - 1 file changed, 15 deletions(-) - -diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb -index 2b61298ee..d28a8127a 100644 ---- a/lib/rack/utils.rb -+++ b/lib/rack/utils.rb -@@ -317,21 +317,6 @@ def rfc2822(time) - time.rfc2822 - end - -- # Modified version of stdlib time.rb Time#rfc2822 to use '%d-%b-%Y' instead -- # of '% %b %Y'. -- # It assumes that the time is in GMT to comply to the RFC 2109. -- # -- # NOTE: I'm not sure the RFC says it requires GMT, but is ambiguous enough -- # that I'm certain someone implemented only that option. -- # Do not use %a and %b from Time.strptime, it would use localized names for -- # weekday and month. -- # -- def rfc2109(time) -- wday = Time::RFC2822_DAY_NAME[time.wday] -- mon = Time::RFC2822_MONTH_NAME[time.mon - 1] -- time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT") -- end -- - # Parses the "Range:" header, if present, into an array of Range objects. - # Returns nil if the header is missing or syntactically invalid. - # Returns an empty array if none of the ranges are satisfiable. diff --git a/rubygem-rack.spec b/rubygem-rack.spec index 1cc6e05..1a47ff3 100644 --- a/rubygem-rack.spec +++ b/rubygem-rack.spec @@ -1,28 +1,21 @@ %global gem_name rack Name: rubygem-%{gem_name} -Version: 2.2.3 +Version: 2.2.4 # Introduce Epoch (related to bug 552972) Epoch: 1 -Release: 9%{?dist} +Release: 1%{?dist} Summary: A modular Ruby webserver interface # lib/rack/show_{status,exceptions}.rb contains snippets from Django under BSD license. License: MIT and BSD URL: https://rack.github.io/ Source0: https://rubygems.org/downloads/%{gem_name}-%{version}.gem # git clone https://github.com/rack/rack.git && cd rack/ -# git archive -v -o rack-2.2.3-tests.tar.gz 2.2.3 test/ +# git archive -v -o rack-2.2.4-tests.tar.gz 2.2.4 test/ Source1: rack-%{version}-tests.tar.gz -# Fix compatibilty with Ruby 3.1 / Psych 4.0+. -# https://github.com/rack/rack/pull/1786 -Patch0: rubygem-rack-2.2.3-Handle-changes-to-YAML.patch -Patch1: rubygem-rack-2.2.3-Handle-changes-to-YAML-test.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel BuildRequires: ruby >= 2.2.2 -BuildRequires: rubygem(concurrent-ruby) -BuildRequires: memcached -BuildRequires: rubygem(memcache-client) BuildRequires: rubygem(minitest) BuildRequires: rubygem(webrick) BuildArch: noarch @@ -31,7 +24,7 @@ BuildArch: noarch %description Rack provides a minimal, modular and adaptable interface for developing -web applications in Ruby. By wrapping HTTP requests and responses in +web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call. @@ -48,12 +41,6 @@ Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} -b 1 -%patch0 -p1 - -pushd %{_builddir} -%patch1 -p1 -popd - %build # Create the gem as gem install only works on a gem file gem build ../%{gem_name}-%{version}.gemspec @@ -72,49 +59,27 @@ cp -a .%{_bindir}/* \ %{buildroot}%{_bindir}/ find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x -find %{buildroot}%{gem_instdir}/{bin,test/cgi} -type f | \ +find %{buildroot}%{gem_instdir}/bin -type f | \ xargs sed -i 's|^#!/usr/bin/env ruby$|#!/usr/bin/ruby|' -# Fix anything executable that does not have a shebang -for file in `find %{buildroot}/%{gem_instdir} -type f -perm /a+x`; do - [ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file -done - -# Find files with a shebang that do not have executable permissions -for file in `find %{buildroot}%{gem_instdir} -type f`; do - [ ! -z "`head -n 1 $file | grep \"^#!\"`" ] && chmod -v 755 $file -done - %check pushd .%{gem_instdir} cp -a %{_builddir}/test . -# Get temporary PID file name and start memcached daemon. -PID=%(mktemp) -memcached -d -P "$PID" - # Avoid minitest-global_expectations in exchange of lot of deprecation warnings. # https://github.com/rack/rack/pull/1394 mkdir -p test/minitest/global_expectations echo 'require "minitest/autorun"' > test/minitest/global_expectations/autorun.rb -# Rack::Session::Memcache#test_0009_maintains freshness -# requires encoding set to UTF-8: -# https://github.com/rack/rack/issues/1305 -LC_ALL=C.UTF-8 \ -ruby -rminitest/autorun -Ilib:test -e 'Dir.glob "./test/spec_*.rb", &method(:require)' - -# Kill memcached daemon. -kill -TERM $(< "$PID") - +ruby -Itest -e 'Dir.glob "./test/spec_*.rb", &method(:require)' popd %files %dir %{gem_instdir} %{_bindir}/rackup %license %{gem_instdir}/MIT-LICENSE -%{gem_libdir} %{gem_instdir}/bin +%{gem_libdir} %exclude %{gem_cache} %{gem_spec} @@ -126,10 +91,15 @@ popd %doc %{gem_instdir}/SPEC.rdoc %{gem_instdir}/Rakefile %{gem_instdir}/%{gem_name}.gemspec -%doc %{gem_instdir}/example %doc %{gem_instdir}/contrib +%doc %{gem_instdir}/example %changelog +* Tue Aug 09 2022 Vít Ondruch - 2.2.4-1 +- Update to Rack 2.2.3 + Resolves: rhbz#2091121 + Resolves: rhbz#2113698 + * Sat Jul 23 2022 Fedora Release Engineering - 1:2.2.3-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 83d64a4..15c4bea 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rack-2.2.3-tests.tar.gz) = 875f32722df4fd2908310c1c72d476929c738ae539903d2a0b28eb851ba6805dfcc1ed58f3eeca977cdf797464959994fa84b3747cac17739497b832897429bf -SHA512 (rack-2.2.3.gem) = aabda2ac4aeea6b119c5d570a6c36b5c114f879cc73678a6f385b71f2191501a86adc3bed6f0e0bacfc1e4c48c2374714588669ede898053dc7719899bf71635 +SHA512 (rack-2.2.4-tests.tar.gz) = fc45c7f089a353dbbcdec3371bf8620d53a3f9053da5d477444299567da4665e33d3e0f4ea0da6f390815b1959540bef6cb4965705b697271ee5ded0d21a067a +SHA512 (rack-2.2.4.gem) = 7e7cd4f0e44e0cd7d26f35ca946a2b6fcee8ad73425583694a7ea9662816b39681325879ad84a2c0d31dbcc2ded1165b0a37d9278bf3d0b0f2bc4615b66b1ca2