summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-05-09 01:22:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-05-09 01:22:16 +0900
commit3333d0235723c8c201ad67ed20c6af22d7923765 (patch)
tree3d354be4a357b329de9d8f642cba8c429ad3ccf6
parentcc3352cc4148df1f83fc0ea3fd8780920420bb3a (diff)
rbinstall.rb: get rid of installing duplicate files
Should not overwrite ext/rubyvm/lib/forwardable/impl.rb by lib/forwardable/impl.rb.
-rwxr-xr-xtool/rbinstall.rb6
1 files changed, 5 insertions, 1 deletions
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)