Skip to content

Commit f477471

Browse files
committed
Split UTF8-CLI patch into ruby-core and ruby/spec
For easier patching of ruby/spec.
1 parent 8db5530 commit f477471

File tree

4 files changed

+54
-51
lines changed

4 files changed

+54
-51
lines changed

mingw-w64-ruby-head/0015-Windows-Change-command-line-interface-to-UTF-8.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ index f2bf3a08e5..98f424c3d0 100644
8787
before :each do
8888
- @default = @method == :locale ? Encoding.find('locale') : Encoding::UTF_8
8989
+ @default = if @method == :locale &&
90-
+ ( platform_is_not(:windows) || ruby_version_is(""..."3.4") )
90+
+ ( platform_is_not(:windows) || ruby_version_is(""..."4.0") )
9191
+ then
9292
+ Encoding.find('locale')
9393
+ else

mingw-w64-ruby40/0015-Windows-Change-command-line-interface-to-UTF-8.patch

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -77,52 +77,3 @@ index 61de5cdcbe..e79d4b69da 100644
7777
}
7878
else {
7979
enc = rb_utf8_encoding();
80-
diff --git a/spec/ruby/language/magic_comment_spec.rb b/spec/ruby/language/magic_comment_spec.rb
81-
index f2bf3a08e5..98f424c3d0 100644
82-
--- a/spec/ruby/language/magic_comment_spec.rb
83-
+++ b/spec/ruby/language/magic_comment_spec.rb
84-
@@ -3,7 +3,13 @@
85-
# See core/kernel/eval_spec.rb for more magic comments specs for eval()
86-
describe :magic_comments, shared: true do
87-
before :each do
88-
- @default = @method == :locale ? Encoding.find('locale') : Encoding::UTF_8
89-
+ @default = if @method == :locale &&
90-
+ ( platform_is_not(:windows) || ruby_version_is(""..."3.4") )
91-
+ then
92-
+ Encoding.find('locale')
93-
+ else
94-
+ Encoding::UTF_8
95-
+ end
96-
end
97-
98-
it "are optional" do
99-
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
100-
index ac4b5870eb..fac0901fdf 100644
101-
--- a/test/ruby/test_rubyoptions.rb
102-
+++ b/test/ruby/test_rubyoptions.rb
103-
@@ -1082,19 +1082,11 @@ def test_command_line_glob_nonascii
104-
105-
def test_command_line_progname_nonascii
106-
bug10555 = '[ruby-dev:48752] [Bug #10555]'
107-
- name = expected = nil
108-
- unless (0x80..0x10000).any? {|c|
109-
- name = c.chr(Encoding::UTF_8)
110-
- expected = name.encode("locale") rescue nil
111-
- }
112-
- omit "can't make locale name"
113-
- end
114-
- name << ".rb"
115-
- expected << ".rb"
116-
+ name = "\u{20ac}.rb"
117-
with_tmpchdir do |dir|
118-
open(name, "w") {|f| f.puts "puts File.basename($0)"}
119-
- assert_in_out_err([name], "", [expected], [],
120-
- bug10555, encoding: "locale")
121-
+ assert_in_out_err([name], "", [name], [],
122-
+ bug10555, encoding: "utf-8")
123-
end
124-
end
125-
126-
--
127-
2.49.0
128-
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/spec/ruby/language/magic_comment_spec.rb b/spec/ruby/language/magic_comment_spec.rb
2+
index f2bf3a08e5..98f424c3d0 100644
3+
--- a/spec/ruby/language/magic_comment_spec.rb
4+
+++ b/spec/ruby/language/magic_comment_spec.rb
5+
@@ -3,7 +3,13 @@
6+
# See core/kernel/eval_spec.rb for more magic comments specs for eval()
7+
describe :magic_comments, shared: true do
8+
before :each do
9+
- @default = @method == :locale ? Encoding.find('locale') : Encoding::UTF_8
10+
+ @default = if @method == :locale &&
11+
+ ( platform_is_not(:windows) || ruby_version_is(""..."4.0") )
12+
+ then
13+
+ Encoding.find('locale')
14+
+ else
15+
+ Encoding::UTF_8
16+
+ end
17+
end
18+
19+
it "are optional" do
20+
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
21+
index ac4b5870eb..fac0901fdf 100644
22+
--- a/test/ruby/test_rubyoptions.rb
23+
+++ b/test/ruby/test_rubyoptions.rb
24+
@@ -1082,19 +1082,11 @@ def test_command_line_glob_nonascii
25+
26+
def test_command_line_progname_nonascii
27+
bug10555 = '[ruby-dev:48752] [Bug #10555]'
28+
- name = expected = nil
29+
- unless (0x80..0x10000).any? {|c|
30+
- name = c.chr(Encoding::UTF_8)
31+
- expected = name.encode("locale") rescue nil
32+
- }
33+
- omit "can't make locale name"
34+
- end
35+
- name << ".rb"
36+
- expected << ".rb"
37+
+ name = "\u{20ac}.rb"
38+
with_tmpchdir do |dir|
39+
open(name, "w") {|f| f.puts "puts File.basename($0)"}
40+
- assert_in_out_err([name], "", [expected], [],
41+
- bug10555, encoding: "locale")
42+
+ assert_in_out_err([name], "", [name], [],
43+
+ bug10555, encoding: "utf-8")
44+
end
45+
end
46+
47+
--
48+
2.49.0
49+

mingw-w64-ruby40/PKGBUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ source=("https://cache.ruby-lang.org/pub/ruby/${pkgver2%.*}/${_realname}-${pkgve
2525
0001-Add-C-ext-win32-dll_directory-as-an-alternative-to-f.patch
2626
0002-Use-autoconf-2.72.patch
2727
0015-Windows-Change-command-line-interface-to-UTF-8.patch
28+
0016-Windows-Change-command-line-interface-to-UTF-8-specs.patch
2829
ruby.ico
2930
rubyw.ico
3031
placeholder.manifest.xml)
@@ -34,7 +35,8 @@ source=("https://cache.ruby-lang.org/pub/ruby/${pkgver2%.*}/${_realname}-${pkgve
3435
sha256sums=('a72bacee9de07283ebc19baa4ac243b193129f21aa4e168c7186fb1fe7d07fe1'
3536
'a50c81ab8c178689485257f8eaa70bd8184b878a798780084668f838912e2832'
3637
'f26122cca5e289801c0dde1f54643a960246a69691c6c8b9bccb27e536344f69'
37-
'576c6dca87493d5543ce1da790aa50c9a4e86aca9ecdec34077e8e3d4b90648f'
38+
'ba88fdfb5e643dfc12ca18af10e8cb19cdef420b1a887cdb5b7b5635ab33d7e1'
39+
'df87d0a6711911e6bb6376046a8c724953e1cc20b9919f0ea58fdd709b016d21'
3840
'6c80ba2ca49840e387a08b7fedc6e7acd298ac2ec853155209efb2af20397b22'
3941
'c30fb04ac0e88ba634daaa811a81ea5a75027646617b895acd14df9518a4a55a'
4042
'c7a555d4826453efe7e33a2ebf78462b1fa665dffd7e4972143b48b1c9c71375')
@@ -45,6 +47,7 @@ prepare() {
4547
patch -p1 -i ${srcdir}/0001-Add-C-ext-win32-dll_directory-as-an-alternative-to-f.patch
4648
patch -p1 -i ${srcdir}/0002-Use-autoconf-2.72.patch
4749
patch -p1 -i ${srcdir}/0015-Windows-Change-command-line-interface-to-UTF-8.patch
50+
patch -p1 -i ${srcdir}/0016-Windows-Change-command-line-interface-to-UTF-8-specs.patch
4851
autoreconf -fi
4952
}
5053

0 commit comments

Comments
 (0)