[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
eric at webkit.org
eric at webkit.org
Wed Jan 20 22:17:51 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 2f443bd10aef903d07af290e72c6d484c4b21f4b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 8 22:45:52 2010 +0000
2010-01-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Optimize the number of CPUs used for building Qt and Gtk
https://bugs.webkit.org/show_bug.cgi?id=33394
Instead of hardcoding the number 8, we should read the number of CPUs
from the environment.
* Scripts/webkitpy/executive.py:
* Scripts/webkitpy/webkitport.py:
* Scripts/webkitpy/webkitport_unittest.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c2417e1..f68f4a6 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Optimize the number of CPUs used for building Qt and Gtk
+ https://bugs.webkit.org/show_bug.cgi?id=33394
+
+ Instead of hardcoding the number 8, we should read the number of CPUs
+ from the environment.
+
+ * Scripts/webkitpy/executive.py:
+ * Scripts/webkitpy/webkitport.py:
+ * Scripts/webkitpy/webkitport_unittest.py:
+
2010-01-08 Chris Fleizach <cfleizach at apple.com>
Reviewed by Eric Seidel.
diff --git a/WebKitTools/Scripts/webkitpy/executive.py b/WebKitTools/Scripts/webkitpy/executive.py
index dd21489..74a39a3 100644
--- a/WebKitTools/Scripts/webkitpy/executive.py
+++ b/WebKitTools/Scripts/webkitpy/executive.py
@@ -98,6 +98,15 @@ class Executive(object):
if exit_code:
raise ScriptError(script_args=args, exit_code=exit_code, output=child_output)
+ @staticmethod
+ def cpu_count():
+ # This API exists only in Python 2.6 and higher. :(
+ try:
+ import multiprocessing
+ return multiprocessing.cpu_count()
+ except (ImportError,NotImplementedError):
+ return 2 # This quantity is a lie but probably a reasonable guess for modern machines.
+
# Error handlers do not need to be static methods once all callers are updated to use an Executive object.
@staticmethod
def default_error_handler(error):
diff --git a/WebKitTools/Scripts/webkitpy/webkitport.py b/WebKitTools/Scripts/webkitpy/webkitport.py
index b468c9d..fcde460 100644
--- a/WebKitTools/Scripts/webkitpy/webkitport.py
+++ b/WebKitTools/Scripts/webkitpy/webkitport.py
@@ -31,6 +31,8 @@
import os
from optparse import make_option
+from webkitpy.executive import Executive
+
class WebKitPort(object):
# We might need to pass scm into this function for scm.checkout_root
@@ -110,6 +112,7 @@ class GtkPort(WebKitPort):
def build_webkit_command(cls, build_style=None):
command = WebKitPort.build_webkit_command(build_style=build_style)
command.append("--gtk")
+ command.append('--makeargs="-j%s"' % Executive.cpu_count())
return command
@classmethod
@@ -132,8 +135,7 @@ class QtPort(WebKitPort):
def build_webkit_command(cls, build_style=None):
command = WebKitPort.build_webkit_command(build_style=build_style)
command.append("--qt")
- # FIXME: We should probably detect the number of cores.
- command.append('--makeargs="-j8"')
+ command.append('--makeargs="-j%s"' % Executive.cpu_count())
return command
diff --git a/WebKitTools/Scripts/webkitpy/webkitport_unittest.py b/WebKitTools/Scripts/webkitpy/webkitport_unittest.py
index b699038..202234f 100644
--- a/WebKitTools/Scripts/webkitpy/webkitport_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/webkitport_unittest.py
@@ -29,8 +29,10 @@
import unittest
+from webkitpy.executive import Executive
from webkitpy.webkitport import WebKitPort, MacPort, GtkPort, QtPort, ChromiumPort
+
class WebKitPortTest(unittest.TestCase):
def test_mac_port(self):
self.assertEquals(MacPort.name(), "Mac")
@@ -44,15 +46,15 @@ class WebKitPortTest(unittest.TestCase):
self.assertEquals(GtkPort.name(), "Gtk")
self.assertEquals(GtkPort.flag(), "--port=gtk")
self.assertEquals(GtkPort.run_webkit_tests_command(), [WebKitPort.script_path("run-webkit-tests"), "--gtk"])
- self.assertEquals(GtkPort.build_webkit_command(), [WebKitPort.script_path("build-webkit"), "--gtk"])
- self.assertEquals(GtkPort.build_webkit_command(build_style="debug"), [WebKitPort.script_path("build-webkit"), "--debug", "--gtk"])
+ self.assertEquals(GtkPort.build_webkit_command(), [WebKitPort.script_path("build-webkit"), "--gtk", '--makeargs="-j%s"' % Executive.cpu_count()])
+ self.assertEquals(GtkPort.build_webkit_command(build_style="debug"), [WebKitPort.script_path("build-webkit"), "--debug", "--gtk", '--makeargs="-j%s"' % Executive.cpu_count()])
def test_qt_port(self):
self.assertEquals(QtPort.name(), "Qt")
self.assertEquals(QtPort.flag(), "--port=qt")
self.assertEquals(QtPort.run_webkit_tests_command(), [WebKitPort.script_path("run-webkit-tests")])
- self.assertEquals(QtPort.build_webkit_command(), [WebKitPort.script_path("build-webkit"), "--qt", '--makeargs="-j8"'])
- self.assertEquals(QtPort.build_webkit_command(build_style="debug"), [WebKitPort.script_path("build-webkit"), "--debug", "--qt", '--makeargs="-j8"'])
+ self.assertEquals(QtPort.build_webkit_command(), [WebKitPort.script_path("build-webkit"), "--qt", '--makeargs="-j%s"' % Executive.cpu_count()])
+ self.assertEquals(QtPort.build_webkit_command(build_style="debug"), [WebKitPort.script_path("build-webkit"), "--debug", "--qt", '--makeargs="-j%s"' % Executive.cpu_count()])
def test_chromium_port(self):
self.assertEquals(ChromiumPort.name(), "Chromium")
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list