diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-20 23:57:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-20 23:57:38 +0000 |
commit | df0dcd4815873462769e171224b1705be506f440 (patch) | |
tree | e6ad3f722730be24d80737e3fcdaa073ebb5e174 /tool | |
parent | b448b79217a75b6198ae13c7ce715e68cfc522f5 (diff) | |
download | ruby-df0dcd4815873462769e171224b1705be506f440.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/make-snapshot | 4 | ||||
-rw-r--r-- | tool/vcs.rb | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot index ffd9bcaa88..e87356455b 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -183,7 +183,7 @@ def package(vcs, rev, destdir, tmp = nil) 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) 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) else system(*%W"#{YACC} -o parse.c parse.y") end + vcs.after_export(".") if exported FileUtils.rm_rf(clean) unless $?.success? puts " failed" diff --git a/tool/vcs.rb b/tool/vcs.rb index 361e11b78e..af1461d405 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -128,6 +128,9 @@ class VCS else '.' end + + def after_export(dir) + end end class SVN < self @@ -212,7 +215,7 @@ class VCS 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 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 end $?.success? end + + def after_export(dir) + FileUtils.rm_rf(dir+"/.svn") + end end class GIT < self @@ -308,10 +315,14 @@ class VCS 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 |