make-snapshot: suppress make error messages unless failed

This commit is contained in:
Nobuyoshi Nakada 2019-10-03 19:12:03 +09:00
Родитель 47d143be17
Коммит 8142a9b43d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
1 изменённых файлов: 30 добавлений и 14 удалений

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

@ -216,6 +216,32 @@ else
true true
end 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) def package(vcs, rev, destdir, tmp = nil)
pwd = Dir.pwd pwd = Dir.pwd
patchlevel = false patchlevel = false
@ -447,12 +473,8 @@ touch-unicode-files:
File.open(clean.add("revision.tmp"), "w") {} File.open(clean.add("revision.tmp"), "w") {}
File.open(clean.add(".revision.time"), "w") {} File.open(clean.add(".revision.time"), "w") {}
ENV["CACHE_SAVE"] = "no" ENV["CACHE_SAVE"] = "no"
make = ENV["MAKE"] || ENV["make"] || "make" make = MAKE.new(args)
args = args.map {|arg| arg.join("=")} return unless make.run("update-download")
unless system(make, "update-download", *args)
puts $colorize.fail("update-download failed")
return
end
clean.push("rbconfig.rb", ".rbconfig.time", "enc.mk", "ext/ripper/y.output", ".revision.time") clean.push("rbconfig.rb", ".rbconfig.time", "enc.mk", "ext/ripper/y.output", ".revision.time")
Dir.glob("**/*") do |dest| Dir.glob("**/*") do |dest|
next unless File.symlink?(dest) next unless File.symlink?(dest)
@ -468,14 +490,8 @@ touch-unicode-files:
end end
modified = new_time modified = new_time
end end
unless system(make, "prepare-package", *args) return unless make.run("prepare-package")
puts $colorize.fail("prepare-package failed") return unless make.run("clean-cache")
return
end
unless system(make, "clean-cache", *args)
puts $colorize.fail("clean-cache failed")
return
end
print "prerequisites" print "prerequisites"
else else
system(*%W"#{YACC} -o parse.c parse.y") system(*%W"#{YACC} -o parse.c parse.y")