[前][次][番号順一覧][スレッド一覧]

ruby-changes:27287

From: nobu <ko1@a...>
Date: Wed, 20 Feb 2013 21:49:52 +0900 (JST)
Subject: [ruby-changes:27287] nobu:r39339 (trunk): common.mk: uninstall

nobu	2013-02-20 21:49:43 +0900 (Wed, 20 Feb 2013)

  New Revision: 39339

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39339

  Log:
    common.mk: uninstall
    
    * common.mk (uninstall): uninstall installed file listed in
      $(INSTALLED_LIST) file.
    
    * tool/rbuninstall.rb: simple uninstallation tool.

  Added files:
    trunk/tool/rbuninstall.rb
  Modified files:
    trunk/common.mk

Index: common.mk
===================================================================
--- common.mk	(revision 39338)
+++ common.mk	(revision 39339)
@@ -323,6 +323,9 @@ dont-install-all: $(PROGRAM) https://github.com/ruby/ruby/blob/trunk/common.mk#L323
 post-no-install-all:: post-no-install-local post-no-install-ext post-no-install-doc
 	@$(NULLCMD)
 
+uninstall: $(INSTALLED_LIST)
+	$(Q)$(SUDO) $(MINIRUBY) $(srcdir)/tool/rbuninstall.rb --destdir=$(DESTDIR) $(INSTALLED_LIST)
+
 what-where-nodoc: no-install-nodoc
 no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
 pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
Index: tool/rbuninstall.rb
===================================================================
--- tool/rbuninstall.rb	(revision 0)
+++ tool/rbuninstall.rb	(revision 39339)
@@ -0,0 +1,51 @@ https://github.com/ruby/ruby/blob/trunk/tool/rbuninstall.rb#L1
+#! /usr/bin/ruby -nl
+BEGIN {
+  $dryrun = false
+  until ARGV.empty?
+    case ARGV[0]
+    when /\A--destdir=(.*)/
+      $destdir = $1
+    when /\A-n\z/
+      $dryrun = true
+    else
+      break
+    end
+    ARGV.shift
+  end
+  $dirs = []
+  $files = []
+}
+list = (/\/\z/ =~ $_ ? $dirs : $files)
+$_ = File.join($destdir, $_) if $destdir
+list << $_
+END {
+  status = true
+  if $dryrun
+    $files.each do |file|
+      puts "rm #{file}"
+    end
+    $dirs.reverse_each do |dir|
+      puts "rmdir #{dir}"
+    end
+  else
+    $files.each do |file|
+      begin
+        File.unlink(file)
+      rescue Errno::ENOENT
+      rescue
+        status = false
+        puts $!
+      end
+    end
+    $dirs.reverse_each do |dir|
+      begin
+        Dir.rmdir(dir)
+      rescue Errno::ENOENT, Errno::ENOTEMPTY
+      rescue
+        status = false
+        puts $!
+      end
+    end
+  end
+  exit(status)
+}

Property changes on: tool/rbuninstall.rb
___________________________________________________________________
Added: svn:eol-style
   + LF
Added: svn:executable
   + *


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]