From 37a8a2a26e607908207ca2854b82b5ff7db91d68 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 15 Jan 2017 00:45:10 +0000 Subject: [PATCH] rbinstall.rb: do nothing if bin script is same * tool/rbinstall.rb (check_executable_overwrite): do nothing if the existing file equals to the wrapper script to be generated. * tool/rbinstall.rb (generate_bin_script): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/rbinstall.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 12e8463abc..490f5f3281 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -695,6 +695,25 @@ module RbInstall first_line = File.open(path, "rb") {|file| file.gets} $script_installer.prolog(first_line) end + + def check_executable_overwrite(filename) + return if @wrappers and same_bin_script?(filename, @bin_dir) + super + end + + def generate_bin_script(filename, bindir) + return if same_bin_script?(filename, bindir) + super + end + + def same_bin_script?(filename, bindir) + path = File.join(bindir, formatted_program_filename(filename)) + begin + return true if File.binread(path) == app_script_text(filename) + rescue + end + false + end end end