diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb index 58cb0b8788..98131816c9 100644 --- a/tool/lib/vcs.rb +++ b/tool/lib/vcs.rb @@ -158,6 +158,10 @@ class VCS super() end + def chdir(path) + @srcdir = path + end + def parse_options(opts, parser = OptionParser.new) case opts when Array @@ -377,13 +381,13 @@ class VCS FileUtils.mv(Dir.glob("#{tmpdir}/#{subdir}/{.[^.]*,..?*,*}"), dir) Dir.rmdir(tmpdir) end - return true + return self end end IO.popen(%W"#{COMMAND} export -r #{revision} #{url} #{dir}") do |pipe| pipe.each {|line| /^A/ =~ line or yield line} end - $?.success? + self if $?.success? end def after_export(dir) @@ -574,8 +578,9 @@ class VCS end def export(revision, url, dir, keep_temp = false) - system(COMMAND, "clone", "-s", (@srcdir || '.').to_s, "-b", url, dir) - system(COMMAND, "fetch", "origin", "+refs/notes/commits:refs/notes/commits", chdir: dir) + system(COMMAND, "clone", "-s", (@srcdir || '.').to_s, "-b", url, dir) or return + system(COMMAND, "fetch", "origin", "+refs/notes/commits:refs/notes/commits", chdir: dir) or return + (Integer === revision ? GITSVN : GIT).new(File.expand_path(dir)) end def branch_beginning(url) diff --git a/tool/make-snapshot b/tool/make-snapshot index ebf926f77f..721636175e 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -259,7 +259,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, true) {|line| print line} + unless vcs = vcs.export(revision, url, exported, true) {|line| print line} warn("Export failed") return end @@ -330,7 +330,7 @@ def package(vcs, rev, destdir, tmp = nil) n = "ruby-#{version}-#{tag}" end File.directory?(n) or File.rename v, n - v = n + vcs.chdir(File.expand_path(v = n)) end system(*%W"patch -d #{v} -p0 -i #{$patch_file}") if $patch_file if !$exported or $patch_file