From 9de11fe796e8caca2d87650278028eb95c1e09a0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 20 Sep 2022 12:54:08 +0900 Subject: [PATCH] Quiet if the target is already linked the same source --- ext/extmk.rb | 2 +- tool/ln_sr.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/extmk.rb b/ext/extmk.rb index 40fc10ea1c..939eb73565 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -607,7 +607,7 @@ CP_R = #{config_string('CP')} -r gemlib = $(TARGET_TOPDIR)/gems/$(gem)/lib gemlib:#{%{ $(gemlib)\n$(gemlib): $(gem_srcdir)/lib} if $nmake} - $(Q) #{@inplace ? '$(NULLCMD) ' : ''}$(RUBY) $(top_srcdir)/tool/ln_sr.rb -f -T $(gem_srcdir)/lib $(gemlib) + $(Q) #{@inplace ? '$(NULLCMD) ' : ''}$(RUBY) $(top_srcdir)/tool/ln_sr.rb -q -f -T $(gem_srcdir)/lib $(gemlib) clean-gemlib: $(Q) $(#{@inplace ? 'NULLCMD' : 'RM_RF'}) $(gemlib) diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb index 81fd803355..2aa8391e17 100755 --- a/tool/ln_sr.rb +++ b/tool/ln_sr.rb @@ -3,6 +3,7 @@ target_directory = true noop = false force = false +quiet = false until ARGV.empty? case ARGV[0] @@ -12,6 +13,8 @@ until ARGV.empty? force = true when '-T' target_directory = false + when '-q' + quiet = true else break end @@ -114,6 +117,9 @@ unless respond_to?(:ln_sr) end if File.respond_to?(:symlink) + if quiet and File.identical?(src, dest) + exit + end begin ln_sr(src, dest, verbose: true, target_directory: target_directory, force: force, noop: noop) rescue NotImplementedError, Errno::EPERM, Errno::EACCES