Avoid diffutils 3.8 bug#61193 [ci skip]
This commit is contained in:
parent
3733ee835b
commit
eab1f1ef18
@ -10,9 +10,22 @@
|
|||||||
# ruby1.9 tool/enc-unicode.rb data_dir > enc/unicode/name2ctype.kwd
|
# ruby1.9 tool/enc-unicode.rb data_dir > enc/unicode/name2ctype.kwd
|
||||||
# You can get source file for gperf. After this, simply make ruby.
|
# You can get source file for gperf. After this, simply make ruby.
|
||||||
|
|
||||||
if ARGV[0] == "--header"
|
while arg = ARGV.shift
|
||||||
|
case arg
|
||||||
|
when "--"
|
||||||
|
break
|
||||||
|
when "--header"
|
||||||
header = true
|
header = true
|
||||||
ARGV.shift
|
when "--diff"
|
||||||
|
diff = ARGV.shift or abort "#{$0}: --diff=DIFF-COMMAND"
|
||||||
|
when /\A--diff=(.+)/m
|
||||||
|
diff = $1
|
||||||
|
when /\A-/
|
||||||
|
abort "#{$0}: unknown option #{arg}"
|
||||||
|
else
|
||||||
|
ARGV.unshift(arg)
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
unless ARGV.size == 2
|
unless ARGV.size == 2
|
||||||
abort "Usage: #{$0} data_directory emoji_data_directory"
|
abort "Usage: #{$0} data_directory emoji_data_directory"
|
||||||
@ -544,6 +557,47 @@ output.restore
|
|||||||
if header
|
if header
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
|
def diff_args(diff)
|
||||||
|
ok = IO.popen([diff, "-DDIFF_TEST", IO::NULL, "-"], "r+") do |f|
|
||||||
|
f.puts "Test for diffutils 3.8"
|
||||||
|
f.close_write
|
||||||
|
/^#if/ =~ f.read
|
||||||
|
end
|
||||||
|
if ok
|
||||||
|
proc {|macro, *inputs|
|
||||||
|
[diff, "-D#{macro}", *inputs]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
IO.popen([diff, "--old-group-format=%<", "--new-group-format=%>", IO::NULL, IO::NULL], err: %i[child out], &:read)
|
||||||
|
unless $?.success?
|
||||||
|
abort "#{$0}: #{diff} -D does not work"
|
||||||
|
end
|
||||||
|
warn "Avoiding diffutils 3.8 bug#61193"
|
||||||
|
proc {|macro, *inputs|
|
||||||
|
[diff] + [
|
||||||
|
"--old-group-format=" \
|
||||||
|
"#ifndef @\n" \
|
||||||
|
"%<" \
|
||||||
|
"#endif /* ! @ */\n",
|
||||||
|
|
||||||
|
"--new-group-format=" \
|
||||||
|
"#ifdef @\n" \
|
||||||
|
"%>" \
|
||||||
|
"#endif /* @ */\n",
|
||||||
|
|
||||||
|
"--changed-group-format=" \
|
||||||
|
"#ifndef @\n" \
|
||||||
|
"%<" \
|
||||||
|
"#else /* @ */\n" \
|
||||||
|
"%>" \
|
||||||
|
"#endif /* @ */\n"
|
||||||
|
].map {|opt| opt.gsub(/@/) {macro}} + inputs
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ifdef = diff_args(diff || "diff")
|
||||||
|
|
||||||
NAME2CTYPE = %w[gperf -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p]
|
NAME2CTYPE = %w[gperf -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p]
|
||||||
|
|
||||||
fds = []
|
fds = []
|
||||||
@ -554,8 +608,8 @@ if header
|
|||||||
end while syms.pop
|
end while syms.pop
|
||||||
fds.each(&:close)
|
fds.each(&:close)
|
||||||
ff = nil
|
ff = nil
|
||||||
IO.popen(%W[diff -DUSE_UNICODE_AGE_PROPERTIES #{fds[1].path} #{fds[0].path}], "r") {|age|
|
IO.popen(ifdef["USE_UNICODE_AGE_PROPERTIES", fds[1].path, fds[0].path], "r") {|age|
|
||||||
IO.popen(%W[diff -DUSE_UNICODE_PROPERTIES #{fds[2].path} -], "r", in: age) {|f|
|
IO.popen(ifdef["USE_UNICODE_PROPERTIES", fds[2].path, "-"], "r", in: age) {|f|
|
||||||
ansi = false
|
ansi = false
|
||||||
f.each {|line|
|
f.each {|line|
|
||||||
if /ANSI-C code produced by gperf/ =~ line
|
if /ANSI-C code produced by gperf/ =~ line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user