extlibs.rb: add --cache option

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-01-20 08:14:24 +00:00
parent 2b02ffa985
commit c23cb3adbe
2 changed files with 31 additions and 17 deletions

View File

@ -1,3 +1,7 @@
Wed Jan 20 17:13:39 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Jan 19 17:03:40 2016 Martin Duerst <duerst@it.aoyama.ac.jp> Tue Jan 19 17:03:40 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* common.mk: Added Unicode data file CaseFolding.txt to be additionally * common.mk: Added Unicode data file CaseFolding.txt to be additionally

View File

@ -3,9 +3,6 @@ require 'fileutils'
require 'digest' require 'digest'
require_relative 'downloader' require_relative 'downloader'
cache_dir = ".downloaded-cache"
FileUtils.mkdir_p(cache_dir)
def do_download(url, base, cache_dir) def do_download(url, base, cache_dir)
Downloader.download(url, base, cache_dir, nil) Downloader.download(url, base, cache_dir, nil)
end end
@ -74,22 +71,35 @@ def do_patch(dest, patch, args)
$?.success? or raise "failed to patch #{patch}" $?.success? or raise "failed to patch #{patch}"
end end
cache_dir = ENV['CACHE_DIR'] || ".downloaded-cache"
mode = :all
until ARGV.empty?
case ARGV[0] case ARGV[0]
when '--download' when '--download'
mode = :download mode = :download
ARGV.shift
when '--extract' when '--extract'
mode = :extract mode = :extract
ARGV.shift
when '--patch' when '--patch'
mode = :patch mode = :patch
ARGV.shift
when '--all' when '--all'
mode = :all mode = :all
when '--cache'
ARGV.shift ARGV.shift
cache_dir = ARGV[0]
when /\A--cache=/
cache_dir = $'
when '--'
ARGV.shift
break
when /\A-/
abort "unknown option: #{ARGV[0]}"
else else
mode = :all break
end end
ARGV.shift
end
FileUtils.mkdir_p(cache_dir)
success = true success = true
ARGV.each do |dir| ARGV.each do |dir|