diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-04 19:01:10 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-04 19:01:10 +0900 |
commit | 8be254f99e881b769a2e6891cbc7d77f6e8b8a29 (patch) | |
tree | acae1bce8252abf32f2bcbfa7d7676931f03b22f | |
parent | d102fd64ed97401600aedbd8f14053902e6b5083 (diff) | |
download | poe-8be254f99e881b769a2e6891cbc7d77f6e8b8a29.tar.gz |
rakefile: dedupe patches before apply
-rw-r--r-- | Rakefile | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -22,7 +22,7 @@ rescue puts "An error occurred: #{$!}" puts "Current directory: #{`pwd`}" print "Press a key to retry:" - $stdin.getch + $stdin.getc retry end @@ -49,21 +49,24 @@ namespace :compiler do system("curl -o archive.tar.gz #{Shellwords.escape(url)}") or raise("failed to download") system("tar xf archive.tar.gz") or raise("failed to extract") FileUtils.chdir("ruby-#{version}") { - patch_ccnames = ["ruby", "ruby/#{version.split("-")[0]}", "ruby/#{version.split("-").join("/")}"] + to_be_applied = [] + patch_ccnames = ["ruby/#{version.split("-").join("/")}", "ruby/#{version.split("-")[0]}", "ruby"] patch_ccnames.each { |patch_ccname| rvm_patchsets_path = File.expand_path("../vendor/rvm/patchsets/#{patch_ccname}/default", __FILE__) if File.exist?(rvm_patchsets_path) - puts "RVM patchset found (#{patch_ccname})... applying..." patches = File.read(rvm_patchsets_path).lines.map(&:chomp) - patches.each { |patch| - patch_path = patch_ccnames - .map { |pp| File.expand_path("../vendor/rvm/patches/#{pp}/#{patch}.patch", __FILE__) } - .find(&File.method(:exist?)) - patch_path and system("patch -R -p1 --silent --dry-run <#{patch_path} || patch -p1 <#{patch_path}") or - raise("failed to apply patch") - } + puts "RVM patchset found (#{patch_ccname})... #{patches.join(" ")}" + to_be_applied += patches end } + to_be_applied.uniq.each { |patch| + patch_path = patch_ccnames + .flat_map { |pp| ["patch", "diff"].map { |ext| File.expand_path("../vendor/rvm/patches/#{pp}/#{patch}.#{ext}", __FILE__) } } + .find(&File.method(:exist?)) + puts "applying... #{patch}" + patch_path and system("patch -R -N -p1 --dry-run <#{patch_path} || patch -N -p1 <#{patch_path}") or + raise("failed to apply patch") + } retriable { system("./configure --prefix=#{prefix} --enable-shared --disable-install-doc") or raise("failed to configure") system("make -j6") or raise("failed to make") |