[前][次][番号順一覧][スレッド一覧]

ruby-changes:58099

From: Nobuyoshi <ko1@a...>
Date: Thu, 3 Oct 2019 19:15:39 +0900 (JST)
Subject: [ruby-changes:58099] 8142a9b43d (master): make-snapshot: suppress make error messages unless failed

https://git.ruby-lang.org/ruby.git/commit/?id=8142a9b43d

From 8142a9b43dfc3e141fd7cb3fc255fc102523f6df Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 3 Oct 2019 19:12:03 +0900
Subject: make-snapshot: suppress make error messages unless failed


diff --git a/tool/make-snapshot b/tool/make-snapshot
index 436863b..6a63305 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -216,6 +216,32 @@ else https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L216
   true
 end
 
+class MAKE < Struct.new(:prog, :args)
+  def initialize(vars)
+    vars = vars.map {|arg| arg.join("=")}
+    super(ENV["MAKE"] || ENV["make"] || "make", vars)
+  end
+
+  def run(target)
+    err = IO.pipe do |r, w|
+      begin
+        pid = Process.spawn(self.prog, *self.args, target, {:err => w, r => :close})
+        w.close
+        r.read
+      ensure
+        Process.wait(pid)
+      end
+    end
+    if $?.success?
+      true
+    else
+      STDERR.puts err
+      $colorize.fail("#{target} failed")
+      false
+    end
+  end
+end
+
 def package(vcs, rev, destdir, tmp = nil)
   pwd = Dir.pwd
   patchlevel = false
@@ -447,12 +473,8 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L473
       File.open(clean.add("revision.tmp"), "w") {}
       File.open(clean.add(".revision.time"), "w") {}
       ENV["CACHE_SAVE"] = "no"
-      make = ENV["MAKE"] || ENV["make"] || "make"
-      args = args.map {|arg| arg.join("=")}
-      unless system(make, "update-download", *args)
-        puts $colorize.fail("update-download failed")
-        return
-      end
+      make = MAKE.new(args)
+      return unless make.run("update-download")
       clean.push("rbconfig.rb", ".rbconfig.time", "enc.mk", "ext/ripper/y.output", ".revision.time")
       Dir.glob("**/*") do |dest|
         next unless File.symlink?(dest)
@@ -468,14 +490,8 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L490
         end
         modified = new_time
       end
-      unless system(make, "prepare-package", *args)
-        puts $colorize.fail("prepare-package failed")
-        return
-      end
-      unless system(make, "clean-cache", *args)
-        puts $colorize.fail("clean-cache failed")
-        return
-      end
+      return unless make.run("prepare-package")
+      return unless make.run("clean-cache")
       print "prerequisites"
     else
       system(*%W"#{YACC} -o parse.c parse.y")
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]