ruby-changes:37276
From: nobu <ko1@a...>
Date: Wed, 21 Jan 2015 08:58:03 +0900 (JST)
Subject: [ruby-changes:37276] nobu:r49357 (trunk): make-snapshot: make revision.h by make
nobu 2015-01-21 08:57:38 +0900 (Wed, 21 Jan 2015) New Revision: 49357 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49357 Log: make-snapshot: make revision.h by make * tool/make-snapshot (package): keep VCS management files until prerequisites build, so that revision.h can be made by make. Modified files: trunk/tool/make-snapshot trunk/tool/vcs.rb Index: tool/vcs.rb =================================================================== --- tool/vcs.rb (revision 49356) +++ tool/vcs.rb (revision 49357) @@ -128,6 +128,9 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L128 else '.' end + + def after_export(dir) + end end class SVN < self @@ -212,7 +215,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L215 end end - def export(revision, url, dir) + def export(revision, url, dir, keep_temp = false) if @srcdir and (rootdir = wcroot) srcdir = File.realpath(@srcdir) rootdir << "/" @@ -222,7 +225,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L225 FileUtils.mkdir_p(svndir = dir+"/.svn") FileUtils.ln_s(Dir.glob(rootdir+"/.svn/*"), svndir) system("svn", "-q", "revert", "-R", subdir || ".", :chdir => dir) or return false - FileUtils.rm_rf(svndir) + FileUtils.rm_rf(svndir) unless keep_temp if subdir tmpdir = Dir.mktmpdir("tmp-co.", "#{dir}/#{subdir}") File.rename(tmpdir, tmpdir = "#{dir}/#{File.basename(tmpdir)}") @@ -241,6 +244,10 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L244 end $?.success? end + + def after_export(dir) + FileUtils.rm_rf(dir+"/.svn") + end end class GIT < self @@ -308,10 +315,14 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L315 end end - def export(revision, url, dir) + def export(revision, url, dir, keep_temp = false) ret = system("git", "clone", "-s", (@srcdir || '.'), "-b", url, dir) - FileUtils.rm_rf("#{dir}/.git") if ret + FileUtils.rm_rf("#{dir}/.git") if ret and !keep_temp ret end + + def after_export(dir) + FileUtils.rm_rf("#{dir}/.git") + end end end Index: tool/make-snapshot =================================================================== --- tool/make-snapshot (revision 49356) +++ tool/make-snapshot (revision 49357) @@ -183,7 +183,7 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L183 v = "ruby" puts "Exporting #{rev}@#{revision}" exported = tmp ? File.join(tmp, v) : v - unless vcs.export(revision, url, exported) {|line| print line} + unless vcs.export(revision, url, exported, true) {|line| print line} warn("Export failed") return end @@ -209,7 +209,6 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L209 v = v[0] end open("#{v}/revision.h", "wb") {|f| f.puts "#define RUBY_REVISION #{revision}"} - open("#{v}/.revision.time", "wb") {} version ||= (versionhdr = IO.read("#{v}/version.h"))[RUBY_VERSION_PATTERN, 1] version or return if patchlevel @@ -310,6 +309,7 @@ def package(vcs, rev, destdir, tmp = nil https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L309 else system(*%W"#{YACC} -o parse.c parse.y") end + vcs.after_export(".") if exported FileUtils.rm_rf(clean) unless $?.success? puts " failed" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/