1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Support packaging different branch/tag

This commit is contained in:
Nobuyoshi Nakada 2019-09-01 22:16:18 +09:00
parent d8260bc872
commit fd4aad6d41
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 11 additions and 6 deletions

View file

@ -158,6 +158,10 @@ class VCS
super() super()
end end
def chdir(path)
@srcdir = path
end
def parse_options(opts, parser = OptionParser.new) def parse_options(opts, parser = OptionParser.new)
case opts case opts
when Array when Array
@ -377,13 +381,13 @@ class VCS
FileUtils.mv(Dir.glob("#{tmpdir}/#{subdir}/{.[^.]*,..?*,*}"), dir) FileUtils.mv(Dir.glob("#{tmpdir}/#{subdir}/{.[^.]*,..?*,*}"), dir)
Dir.rmdir(tmpdir) Dir.rmdir(tmpdir)
end end
return true return self
end end
end end
IO.popen(%W"#{COMMAND} export -r #{revision} #{url} #{dir}") do |pipe| IO.popen(%W"#{COMMAND} export -r #{revision} #{url} #{dir}") do |pipe|
pipe.each {|line| /^A/ =~ line or yield line} pipe.each {|line| /^A/ =~ line or yield line}
end end
$?.success? self if $?.success?
end end
def after_export(dir) def after_export(dir)
@ -574,8 +578,9 @@ class VCS
end end
def export(revision, url, dir, keep_temp = false) def export(revision, url, dir, keep_temp = false)
system(COMMAND, "clone", "-s", (@srcdir || '.').to_s, "-b", url, 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) system(COMMAND, "fetch", "origin", "+refs/notes/commits:refs/notes/commits", chdir: dir) or return
(Integer === revision ? GITSVN : GIT).new(File.expand_path(dir))
end end
def branch_beginning(url) def branch_beginning(url)

View file

@ -259,7 +259,7 @@ def package(vcs, rev, destdir, tmp = nil)
v = "ruby" v = "ruby"
puts "Exporting #{rev}@#{revision}" puts "Exporting #{rev}@#{revision}"
exported = tmp ? File.join(tmp, v) : v 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") warn("Export failed")
return return
end end
@ -330,7 +330,7 @@ def package(vcs, rev, destdir, tmp = nil)
n = "ruby-#{version}-#{tag}" n = "ruby-#{version}-#{tag}"
end end
File.directory?(n) or File.rename v, n File.directory?(n) or File.rename v, n
v = n vcs.chdir(File.expand_path(v = n))
end end
system(*%W"patch -d #{v} -p0 -i #{$patch_file}") if $patch_file system(*%W"patch -d #{v} -p0 -i #{$patch_file}") if $patch_file
if !$exported or $patch_file if !$exported or $patch_file