[EXPERIMENTAL] Support upload option for s3 package hosting.

Example:
    $ ruby tool/make-snapshot -archname=snapshot -s3=tmp /tmp trunk

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2018-02-27 14:08:26 +00:00
Родитель 2af1761466
Коммит a65b8864a6
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -6,6 +6,7 @@ require 'digest/sha2'
require 'fileutils' require 'fileutils'
require 'shellwords' require 'shellwords'
require 'tmpdir' require 'tmpdir'
require 'pathname'
require File.expand_path("../vcs", __FILE__) require File.expand_path("../vcs", __FILE__)
require File.expand_path("../colorize", __FILE__) require File.expand_path("../colorize", __FILE__)
STDOUT.sync = true STDOUT.sync = true
@ -17,6 +18,7 @@ $keep_temp ||= nil
$patch_file ||= nil $patch_file ||= nil
$packages ||= nil $packages ||= nil
$digests ||= nil $digests ||= nil
$s3 ||= nil
$tooldir = File.expand_path("..", __FILE__) $tooldir = File.expand_path("..", __FILE__)
$unicode_version = nil if ($unicode_version ||= nil) == "" $unicode_version = nil if ($unicode_version ||= nil) == ""
$colorize = Colorize.new $colorize = Colorize.new
@ -37,6 +39,7 @@ options:
(#{SVNURL}) (#{SVNURL})
-git[=URL] make snapshot from GIT repository -git[=URL] make snapshot from GIT repository
(#{GITURL}) (#{GITURL})
-s3=PATH s3 bucket path(default=tmp)
-help, --help show this message -help, --help show this message
version: version:
trunk, stable, branches/*, tags/*, X.Y, X.Y.Z, X.Y.Z-pL trunk, stable, branches/*, tags/*, X.Y, X.Y.Z, X.Y.Z-pL
@ -466,6 +469,11 @@ revisions.collect {|rev| package(vcs, rev, destdir, tmp)}.flatten.each do |name|
next next
end end
str = open(name, "rb") {|f| f.read} str = open(name, "rb") {|f| f.read}
if $s3
`aws s3 cp #{name} s3://ftp.r-l.o/pub/#{$s3}/#{Pathname(name).basename}`
FileUtils.rm_f name
name = "https://s3.amazonaws.com/ftp.r-l.o/pub/#{$s3}/#{Pathname(name).basename}"
end
puts "* #{$colorize.pass(name)}" puts "* #{$colorize.pass(name)}"
puts " SIZE: #{str.bytesize} bytes" puts " SIZE: #{str.bytesize} bytes"
$digests.each do |alg| $digests.each do |alg|