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()
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)

View file

@ -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