From 3333d0235723c8c201ad67ed20c6af22d7923765 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 9 May 2020 01:22:16 +0900 Subject: [PATCH] rbinstall.rb: get rid of installing duplicate files Should not overwrite ext/rubyvm/lib/forwardable/impl.rb by lib/forwardable/impl.rb. --- tool/rbinstall.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 94718866e2..c91d4fff86 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -39,6 +39,7 @@ def parse_args(argv = ARGV) $make = 'make' $mflags = [] $install = [] + $installed = {} $installed_list = nil $exclude = [] $dryrun = false @@ -170,9 +171,12 @@ def install(src, dest, options = {}) options = options.clone strip = options.delete(:strip) options[:preserve] = true + srcs = Array(src).select {|s| !$installed[$made_dirs[dest] ? File.join(dest, s) : dest]} + return if srcs.empty? + src = srcs if Array === src d = with_destdir(dest) super(src, d, **options) - srcs = Array(src) + srcs.each {|s| $installed[$made_dirs[dest] ? File.join(dest, s) : dest] = true} if strip d = srcs.map {|s| File.join(d, File.basename(s))} if $made_dirs[dest] strip_file(d)