1 |
commit: 2962b2a65d469473dbcba9afffaab21c5bcb29bb |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 4 05:45:08 2022 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 4 05:47:29 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2962b2a6 |
7 |
|
8 |
dev-ruby/rack: add missing patch |
9 |
|
10 |
Closes: https://bugs.gentoo.org/849473 |
11 |
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org> |
12 |
|
13 |
dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch | 210 ++++++++++++++++++++++++++ |
14 |
1 file changed, 210 insertions(+) |
15 |
|
16 |
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 |
17 |
new file mode 100644 |
18 |
index 000000000000..467fb3487d67 |
19 |
--- /dev/null |
20 |
+++ b/dev-ruby/rack/files/rack-2.2.3.1-ruby30.patch |
21 |
@@ -0,0 +1,210 @@ |
22 |
+From 43b5565a73817d66b6d96de2e28d525a2a56f852 Mon Sep 17 00:00:00 2001 |
23 |
+From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= <josef.simanek@×××××.com> |
24 |
+Date: Mon, 4 Apr 2022 23:17:19 +0200 |
25 |
+Subject: [PATCH] Newer rubies spec compatibility. |
26 |
+ |
27 |
+--- |
28 |
+ Gemfile | 5 +++++ |
29 |
+ lib/rack/utils.rb | 7 +++++-- |
30 |
+ test/spec_mock.rb | 34 +++++++++++++++++----------------- |
31 |
+ test/testrequest.rb | 4 ++-- |
32 |
+ 4 files changed, 29 insertions(+), 21 deletions(-) |
33 |
+ |
34 |
+diff --git a/Gemfile b/Gemfile |
35 |
+index dc075a4ca..5768eedf7 100644 |
36 |
+--- a/Gemfile |
37 |
++++ b/Gemfile |
38 |
+@@ -14,6 +14,11 @@ end |
39 |
+ |
40 |
+ gem "rubocop", require: false |
41 |
+ |
42 |
++group :test do |
43 |
++ gem "webrick" # gemified in Ruby 3.1+ |
44 |
++ gem "psych", "~> 4.0" # using YAML#unsafe_load in tests which is 4.0+ only |
45 |
++end |
46 |
++ |
47 |
+ # Alternative solution that might work, but it has bad interactions with |
48 |
+ # Gemfile.lock if that gets committed/reused: |
49 |
+ # c_platforms = [:mri] if Gem.platforms.last.os == "java" |
50 |
+diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb |
51 |
+index d3b3b1d42..34849ded1 100644 |
52 |
+--- a/lib/rack/utils.rb |
53 |
++++ b/lib/rack/utils.rb |
54 |
+@@ -22,6 +22,9 @@ module Utils |
55 |
+ COMMON_SEP = QueryParser::COMMON_SEP |
56 |
+ KeySpaceConstrainedParams = QueryParser::Params |
57 |
+ |
58 |
++ RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ] |
59 |
++ RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] |
60 |
++ |
61 |
+ class << self |
62 |
+ attr_accessor :default_query_parser |
63 |
+ end |
64 |
+@@ -327,8 +330,8 @@ def rfc2822(time) |
65 |
+ # weekday and month. |
66 |
+ # |
67 |
+ def rfc2109(time) |
68 |
+- wday = Time::RFC2822_DAY_NAME[time.wday] |
69 |
+- mon = Time::RFC2822_MONTH_NAME[time.mon - 1] |
70 |
++ wday = RFC2822_DAY_NAME[time.wday] |
71 |
++ mon = RFC2822_MONTH_NAME[time.mon - 1] |
72 |
+ time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT") |
73 |
+ end |
74 |
+ |
75 |
+diff --git a/test/spec_mock.rb b/test/spec_mock.rb |
76 |
+index d2311f5a2..73fb7b235 100644 |
77 |
+--- a/test/spec_mock.rb |
78 |
++++ b/test/spec_mock.rb |
79 |
+@@ -47,7 +47,7 @@ |
80 |
+ it "provide sensible defaults" do |
81 |
+ res = Rack::MockRequest.new(app).request |
82 |
+ |
83 |
+- env = YAML.load(res.body) |
84 |
++ env = YAML.unsafe_load(res.body) |
85 |
+ env["REQUEST_METHOD"].must_equal "GET" |
86 |
+ env["SERVER_NAME"].must_equal "example.org" |
87 |
+ env["SERVER_PORT"].must_equal "80" |
88 |
+@@ -60,23 +60,23 @@ |
89 |
+ |
90 |
+ it "allow GET/POST/PUT/DELETE/HEAD" do |
91 |
+ res = Rack::MockRequest.new(app).get("", input: "foo") |
92 |
+- env = YAML.load(res.body) |
93 |
++ env = YAML.unsafe_load(res.body) |
94 |
+ env["REQUEST_METHOD"].must_equal "GET" |
95 |
+ |
96 |
+ res = Rack::MockRequest.new(app).post("", input: "foo") |
97 |
+- env = YAML.load(res.body) |
98 |
++ env = YAML.unsafe_load(res.body) |
99 |
+ env["REQUEST_METHOD"].must_equal "POST" |
100 |
+ |
101 |
+ res = Rack::MockRequest.new(app).put("", input: "foo") |
102 |
+- env = YAML.load(res.body) |
103 |
++ env = YAML.unsafe_load(res.body) |
104 |
+ env["REQUEST_METHOD"].must_equal "PUT" |
105 |
+ |
106 |
+ res = Rack::MockRequest.new(app).patch("", input: "foo") |
107 |
+- env = YAML.load(res.body) |
108 |
++ env = YAML.unsafe_load(res.body) |
109 |
+ env["REQUEST_METHOD"].must_equal "PATCH" |
110 |
+ |
111 |
+ res = Rack::MockRequest.new(app).delete("", input: "foo") |
112 |
+- env = YAML.load(res.body) |
113 |
++ env = YAML.unsafe_load(res.body) |
114 |
+ env["REQUEST_METHOD"].must_equal "DELETE" |
115 |
+ |
116 |
+ Rack::MockRequest.env_for("/", method: "HEAD")["REQUEST_METHOD"] |
117 |
+@@ -102,11 +102,11 @@ |
118 |
+ |
119 |
+ it "allow posting" do |
120 |
+ res = Rack::MockRequest.new(app).get("", input: "foo") |
121 |
+- env = YAML.load(res.body) |
122 |
++ env = YAML.unsafe_load(res.body) |
123 |
+ env["mock.postdata"].must_equal "foo" |
124 |
+ |
125 |
+ res = Rack::MockRequest.new(app).post("", input: StringIO.new("foo")) |
126 |
+- env = YAML.load(res.body) |
127 |
++ env = YAML.unsafe_load(res.body) |
128 |
+ env["mock.postdata"].must_equal "foo" |
129 |
+ end |
130 |
+ |
131 |
+@@ -115,7 +115,7 @@ |
132 |
+ get("https://bla.example.org:9292/meh/foo?bar") |
133 |
+ res.must_be_kind_of Rack::MockResponse |
134 |
+ |
135 |
+- env = YAML.load(res.body) |
136 |
++ env = YAML.unsafe_load(res.body) |
137 |
+ env["REQUEST_METHOD"].must_equal "GET" |
138 |
+ env["SERVER_NAME"].must_equal "bla.example.org" |
139 |
+ env["SERVER_PORT"].must_equal "9292" |
140 |
+@@ -129,7 +129,7 @@ |
141 |
+ get("https://example.org/foo") |
142 |
+ res.must_be_kind_of Rack::MockResponse |
143 |
+ |
144 |
+- env = YAML.load(res.body) |
145 |
++ env = YAML.unsafe_load(res.body) |
146 |
+ env["REQUEST_METHOD"].must_equal "GET" |
147 |
+ env["SERVER_NAME"].must_equal "example.org" |
148 |
+ env["SERVER_PORT"].must_equal "443" |
149 |
+@@ -144,7 +144,7 @@ |
150 |
+ get("foo") |
151 |
+ res.must_be_kind_of Rack::MockResponse |
152 |
+ |
153 |
+- env = YAML.load(res.body) |
154 |
++ env = YAML.unsafe_load(res.body) |
155 |
+ env["REQUEST_METHOD"].must_equal "GET" |
156 |
+ env["SERVER_NAME"].must_equal "example.org" |
157 |
+ env["SERVER_PORT"].must_equal "80" |
158 |
+@@ -155,13 +155,13 @@ |
159 |
+ |
160 |
+ it "properly convert method name to an uppercase string" do |
161 |
+ res = Rack::MockRequest.new(app).request(:get) |
162 |
+- env = YAML.load(res.body) |
163 |
++ env = YAML.unsafe_load(res.body) |
164 |
+ env["REQUEST_METHOD"].must_equal "GET" |
165 |
+ end |
166 |
+ |
167 |
+ it "accept params and build query string for GET requests" do |
168 |
+ res = Rack::MockRequest.new(app).get("/foo?baz=2", params: { foo: { bar: "1" } }) |
169 |
+- env = YAML.load(res.body) |
170 |
++ env = YAML.unsafe_load(res.body) |
171 |
+ env["REQUEST_METHOD"].must_equal "GET" |
172 |
+ env["QUERY_STRING"].must_include "baz=2" |
173 |
+ env["QUERY_STRING"].must_include "foo[bar]=1" |
174 |
+@@ -171,7 +171,7 @@ |
175 |
+ |
176 |
+ it "accept raw input in params for GET requests" do |
177 |
+ res = Rack::MockRequest.new(app).get("/foo?baz=2", params: "foo[bar]=1") |
178 |
+- env = YAML.load(res.body) |
179 |
++ env = YAML.unsafe_load(res.body) |
180 |
+ env["REQUEST_METHOD"].must_equal "GET" |
181 |
+ env["QUERY_STRING"].must_include "baz=2" |
182 |
+ env["QUERY_STRING"].must_include "foo[bar]=1" |
183 |
+@@ -181,7 +181,7 @@ |
184 |
+ |
185 |
+ it "accept params and build url encoded params for POST requests" do |
186 |
+ res = Rack::MockRequest.new(app).post("/foo", params: { foo: { bar: "1" } }) |
187 |
+- env = YAML.load(res.body) |
188 |
++ env = YAML.unsafe_load(res.body) |
189 |
+ env["REQUEST_METHOD"].must_equal "POST" |
190 |
+ env["QUERY_STRING"].must_equal "" |
191 |
+ env["PATH_INFO"].must_equal "/foo" |
192 |
+@@ -191,7 +191,7 @@ |
193 |
+ |
194 |
+ it "accept raw input in params for POST requests" do |
195 |
+ res = Rack::MockRequest.new(app).post("/foo", params: "foo[bar]=1") |
196 |
+- env = YAML.load(res.body) |
197 |
++ env = YAML.unsafe_load(res.body) |
198 |
+ env["REQUEST_METHOD"].must_equal "POST" |
199 |
+ env["QUERY_STRING"].must_equal "" |
200 |
+ env["PATH_INFO"].must_equal "/foo" |
201 |
+@@ -202,7 +202,7 @@ |
202 |
+ it "accept params and build multipart encoded params for POST requests" do |
203 |
+ files = Rack::Multipart::UploadedFile.new(File.join(File.dirname(__FILE__), "multipart", "file1.txt")) |
204 |
+ res = Rack::MockRequest.new(app).post("/foo", params: { "submit-name" => "Larry", "files" => files }) |
205 |
+- env = YAML.load(res.body) |
206 |
++ env = YAML.unsafe_load(res.body) |
207 |
+ env["REQUEST_METHOD"].must_equal "POST" |
208 |
+ env["QUERY_STRING"].must_equal "" |
209 |
+ env["PATH_INFO"].must_equal "/foo" |
210 |
+diff --git a/test/testrequest.rb b/test/testrequest.rb |
211 |
+index aabe7fa6b..481a4e54d 100644 |
212 |
+--- a/test/testrequest.rb |
213 |
++++ b/test/testrequest.rb |
214 |
+@@ -42,7 +42,7 @@ def GET(path, header = {}) |
215 |
+ http.request(get) { |response| |
216 |
+ @status = response.code.to_i |
217 |
+ begin |
218 |
+- @response = YAML.load(response.body) |
219 |
++ @response = YAML.unsafe_load(response.body) |
220 |
+ rescue TypeError, ArgumentError |
221 |
+ @response = nil |
222 |
+ end |
223 |
+@@ -60,7 +60,7 @@ def POST(path, formdata = {}, header = {}) |
224 |
+ post.basic_auth user, passwd if user && passwd |
225 |
+ http.request(post) { |response| |
226 |
+ @status = response.code.to_i |
227 |
+- @response = YAML.load(response.body) |
228 |
++ @response = YAML.unsafe_load(response.body) |
229 |
+ } |
230 |
+ } |
231 |
+ end |