ruby-changes:57465
From: Nobuyoshi <ko1@a...>
Date: Sun, 1 Sep 2019 23:29:21 +0900 (JST)
Subject: [ruby-changes:57465] Nobuyoshi Nakada: fd4aad6d41 (master): Support packaging different branch/tag
https://git.ruby-lang.org/ruby.git/commit/?id=fd4aad6d41 From fd4aad6d41da016f3a7aa7d3f130c39fe7bf082b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 1 Sep 2019 22:16:18 +0900 Subject: Support packaging different branch/tag diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb index 58cb0b8..9813181 100644 --- a/tool/lib/vcs.rb +++ b/tool/lib/vcs.rb @@ -158,6 +158,10 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L158 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L381 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L578 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 ebf926f..7216361 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -259,7 +259,7 @@ def package(vcs, rev, destdir, tmp = nil) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L259 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) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L330 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/