aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-01 22:16:18 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-01 23:22:50 +0900
commitfd4aad6d41da016f3a7aa7d3f130c39fe7bf082b (patch)
treecc3afe7991cac508ef8fa56fc867da5f976e1156
parentd8260bc872c8c562fff90278bb21815b9e7946e5 (diff)
downloadruby-fd4aad6d41da016f3a7aa7d3f130c39fe7bf082b.tar.gz
Support packaging different branch/tag
-rw-r--r--tool/lib/vcs.rb13
-rwxr-xr-xtool/make-snapshot4
2 files changed, 11 insertions, 6 deletions
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