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

ruby-changes:57751

From: Nobuyoshi <ko1@a...>
Date: Sun, 15 Sep 2019 02:15:29 +0900 (JST)
Subject: [ruby-changes:57751] 1ad4be13cb (master): make-snapshot: deprecated -exported option [Bug #16167]

https://git.ruby-lang.org/ruby.git/commit/?id=1ad4be13cb

From 1ad4be13cb75c5f039f5732d2149f0b84bcf5f8e Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 15 Sep 2019 02:07:00 +0900
Subject: make-snapshot: deprecated -exported option [Bug #16167]


diff --git a/tool/make-snapshot b/tool/make-snapshot
index 869efbd..cdda44c 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -12,7 +12,6 @@ require File.expand_path("../lib/colorize", __FILE__) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L12
 STDOUT.sync = true
 
 $srcdir ||= nil
-$exported = nil if ($exported ||= nil) == ""
 $archname = nil if ($archname ||= nil) == ""
 $keep_temp ||= nil
 $patch_file ||= nil
@@ -28,7 +27,6 @@ def usage https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L27
 usage: #{File.basename $0} [option...] new-directory-to-save [version ...]
 options:
   -srcdir=PATH          source directory path
-  -exported=PATH        make snapshot from already exported working directory
   -archname=NAME        make the basename of snapshots NAME
   -keep_temp            keep temporary working directory
   -patch_file=PATCH     apply PATCH file after export
@@ -143,17 +141,20 @@ unless destdir = ARGV.shift https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L141
   abort usage
 end
 revisions = ARGV.empty? ? [nil] : ARGV
-unless tmp = $exported
-  FileUtils.mkpath(destdir)
-  destdir = File.expand_path(destdir)
-  tmp = Dir.mktmpdir("ruby-snapshot")
-  FileUtils.mkpath(tmp)
-  at_exit {
-    Dir.chdir "/"
-    FileUtils.rm_rf(tmp)
-  } unless $keep_temp
+
+if $exported
+  abort "#{File.basename $0}: -exported option is deprecated; use -srcdir instead"
 end
 
+FileUtils.mkpath(destdir)
+destdir = File.expand_path(destdir)
+tmp = Dir.mktmpdir("ruby-snapshot")
+FileUtils.mkpath(tmp)
+at_exit {
+  Dir.chdir "/"
+  FileUtils.rm_rf(tmp)
+} unless $keep_temp
+
 def tar_create(tarball, dir)
   require 'rubygems'
   require 'rubygems/package'
@@ -273,34 +274,28 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L274
     end
     revision = vcs.get_revisions(url)[1]
   end
-  v = nil
-  if $exported
-    if String === $exported
-      v = $exported
-    end
-  else
-    v = "ruby"
-    puts "Exporting #{rev}@#{revision}"
-    exported = tmp ? File.join(tmp, v) : v
-    unless vcs = vcs.export(revision, url, exported, true) {|line| print line}
-      warn("Export failed")
-      return
-    end
-    if $srcdir
-      Dir.glob($srcdir + "/{tool/config.{guess,sub},gems/*.gem,.downloaded-cache/*,enc/unicode/data/**/*.txt}") do |file|
-        puts "copying #{file}"
-        dest = exported + file[$srcdir.size..-1]
-        FileUtils.mkpath(File.dirname(dest))
-        begin
-          FileUtils.ln(file, dest, force: true)
-          next unless File.symlink?(dest)
-          File.unlink(dest)
-        rescue SystemCallError
-        end
-        begin
-          FileUtils.cp_r(file, dest)
-        rescue SystemCallError
-        end
+
+  v = "ruby"
+  puts "Exporting #{rev}@#{revision}"
+  exported = tmp ? File.join(tmp, v) : v
+  unless vcs = vcs.export(revision, url, exported, true) {|line| print line}
+    warn("Export failed")
+    return
+  end
+  if $srcdir
+    Dir.glob($srcdir + "/{tool/config.{guess,sub},gems/*.gem,.downloaded-cache/*,enc/unicode/data/**/*.txt}") do |file|
+      puts "copying #{file}"
+      dest = exported + file[$srcdir.size..-1]
+      FileUtils.mkpath(File.dirname(dest))
+      begin
+        FileUtils.ln(file, dest, force: true)
+        next unless File.symlink?(dest)
+        File.unlink(dest)
+      rescue SystemCallError
+      end
+      begin
+        FileUtils.cp_r(file, dest)
+      rescue SystemCallError
       end
     end
   end
@@ -344,17 +339,17 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L339
   else
     tag ||= vcs.revision_name(revision)
   end
-  unless v == $exported
-    if $archname
-      n = $archname
-    elsif tag.empty?
-      n = "ruby-#{version}"
-    else
-      n = "ruby-#{version}-#{tag}"
-    end
-    File.directory?(n) or File.rename v, n
-    vcs.chdir(File.expand_path(v = n))
+
+  if $archname
+    n = $archname
+  elsif tag.empty?
+    n = "ruby-#{version}"
+  else
+    n = "ruby-#{version}-#{tag}"
   end
+  File.directory?(n) or File.rename v, n
+  vcs.chdir(File.expand_path(v = n))
+
   system(*%W"patch -d #{v} -p0 -i #{$patch_file}") if $patch_file
   def (clean = []).add(n) push(n); n end
   Dir.chdir(v) do
@@ -362,7 +357,7 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L357
       vcs.export_changelog(url, nil, revision, "ChangeLog")
     end
 
-    if !$exported or $patch_file and !touch_all(modified, "**/*", File::FNM_DOTMATCH)
+    unless touch_all(modified, "**/*", File::FNM_DOTMATCH)
       modified = nil
       colors = %w[red yellow green cyan blue magenta]
       "take a breath, and go ahead".scan(/./) do |c|
@@ -553,7 +548,7 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L548
     end
   end.compact
 ensure
-  FileUtils.rm_rf(tmp ? File.join(tmp, v) : v) if v and !$exported and !$keep_temp
+  FileUtils.rm_rf(tmp ? File.join(tmp, v) : v) if v and !$keep_temp
   Dir.chdir(pwd)
 end
 
-- 
cgit v0.10.2


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

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