Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

build-ruby-parallel implemented.

  • Loading branch information...
commit 6585e5830d074ee6afcf924697ecb2f1365fc345 1 parent b50764c
akr authored
Showing with 104 additions and 6 deletions.
  1. +2 −2 chkbuild/build.rb
  2. +13 −4 chkbuild/ruby.rb
  3. +89 −0 sample/build-ruby-parallel
4 chkbuild/build.rb
View
@@ -1525,7 +1525,7 @@ def make(*args)
opts = opts.dup
opts[:alt_commands] = ['make']
- make_opts, targets = args.partition {|a| /=/ =~ a }
+ make_opts, targets = args.partition {|a| /\A-|=/ =~ a }
if targets.empty?
opts[:section] ||= 'make'
self.run("gmake", *(make_opts + [opts]))
@@ -1534,7 +1534,7 @@ def make(*args)
h = opts.dup
h[:reason] = target
h[:section] ||= target
- self.run("gmake", target, *(make_opts + [h]))
+ self.run("gmake", *(make_opts + [target, h]))
}
end
end
17 chkbuild/ruby.rb
View
@@ -265,6 +265,7 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
use_rubyspec = bopts[:use_rubyspec]
force_gperf = bopts[:force_gperf]
inplace_build = bopts[:inplace_build]
+ parallel = bopts[:parallel]
b.run(autoconf_command, '--version', :section=>'autoconf-version')
b.run('bison', '--version', :section=>'bison-version')
@@ -344,7 +345,9 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
end
end
- b.make("miniruby", make_options)
+ make_args = ["miniruby", make_options]
+ make_args.unshift "-j#{parallel}" if parallel
+ b.make(*make_args)
b.catch_error { b.run("./miniruby", "-v", :section=>"miniversion") }
if File.directory? "#{srcdir}/bootstraptest"
b.catch_error { b.make("btest", "OPTS=-v -q", make_options.merge(:section=>"btest")) }
@@ -361,10 +364,14 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
makefile = File.read('Makefile')
makefile << File.read('uncommon.mk') if File.file?('GNUmakefile') && File.file?('uncommon.mk')
if /^main:/ =~ makefile
- b.make('main', make_options)
+ make_args = ['main', make_options]
+ make_args.unshift "-j#{parallel}" if parallel
+ b.make(*make_args)
end
- b.make(make_options)
+ make_args = [make_options]
+ make_args.unshift "-j#{parallel}" if parallel
+ b.make(*make_args)
b.catch_error { b.run("./ruby", "-v", :section=>"version") }
b.make("install-nodoc", make_options)
bindir = ruby_build_dir+'bin'
@@ -375,7 +382,9 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
end
#b.catch_error { b.run("./ruby", "#{srcdir+'test/runner.rb'}", "-v", :section=>"test-all") }
b.catch_error {
- b.make("test-all", "TESTS=-v", "RUBYOPT=-w", make_options.merge(:section=>"test-all"))
+ parallel_option = ''
+ parallel_option = "j#{parallel}" if parallel
+ b.make("test-all", "TESTS=-v#{parallel_option}", "RUBYOPT=-w", make_options.merge(:section=>"test-all"))
}
b.catch_error {
if /^\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/ !~ b.logfile.get_section('test-all')
89 sample/build-ruby-parallel
View
@@ -0,0 +1,89 @@
+#!/usr/bin/env ruby
+
+# sample/build-ruby - build script for ruby
+#
+# Copyright (C) 2005-2012 Tanaka Akira <akr@fsij.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+# OF SUCH DAMAGE.
+
+require 'chkbuild'
+
+#ENV['LC_ALL'] = 'C'
+
+# resource limits
+word_bytes = [nil].pack("p").length
+ChkBuild.limit(:cpu => 3600*4) # seconds
+ChkBuild.limit(:stack => 1024*1024*10*word_bytes) # bytes
+ChkBuild.limit(:data => 1024*1024*500*word_bytes) # bytes
+ChkBuild.limit(:as => 1024*1024*500*word_bytes) # bytes
+
+# ChkBuild.nickname identify chkbuild installation.
+# It is used for title of HTML, etc.
+# The default is the hostname (without domain).
+# ChkBuild.nickname = 'nickname'
+
+# ChkBuild.top_uri is used for RSS.
+# ChkBuild.top_uri = "file://#{ChkBuild.public_top}/"
+# ChkBuild.top_uri = nil # use relative URL
+
+ChkBuild::Ruby.def_target(
+ [
+ { :suffix_? => 'trunk', :output_interval_timeout => '10min' },
+ #'1.9.3',
+ #'1.9.2',
+ #'1.8',
+ #'1.8.7',
+ ],
+
+ # ChkBuild::Ruby::MaintainedBranches,
+ # %w[trunk 1.8],
+ # %w[trunk 1.9.3 1.9.2],
+ # %w[1.9.1],
+ # %w[trunk],
+
+ # ['o0', 'o1', nil, 'o3', 'os'],
+
+ [nil, "pth"],
+
+ # ['m32', 'm64'],
+
+ # [nil, { :suffix_? => "-outofplace", :inplace_build => false}]
+
+ # :autoconf_command => 'autoconf',
+ # :configure_args => %w[--with-valgrind],
+ # :cppflags => %w[-DRUBY_DEBUG_ENV],
+ # :optflags => %w[-O2],
+ # :debugflags => %w[-g],
+ # :warnflags => %w[-W -Wall -Wformat=2 -Wundef -Wno-parentheses -Wno-unused-parameter -Wno-missing-field-initializers],
+ # :dldflags => %w[],
+
+ # :old => 1,
+
+ :parallel => 5,
+
+ :timeout => '1h',
+
+ :output_interval_timeout => '5min'
+ )
+
+ChkBuild.main
Please sign in to comment.
Something went wrong with that request. Please try again.