Title: [101285] trunk/Tools
Revision
101285
Author
t...@chromium.org
Date
2011-11-28 14:52:56 -0800 (Mon, 28 Nov 2011)

Log Message

ews bots should pass --force to update-webkit-chromium
https://bugs.webkit.org/show_bug.cgi?id=73230

Reviewed by Adam Barth.

This makes it less likely for gclient changes to break the bots (e.g.,
if a DEPS repository moves or is switched to a branch).

Also pass --force when using |build-webkit --update-chromium| since this
appears to only be used by the bots.

Take 2: Add Options.non_interactive to update.py's options() method.

* Scripts/update-webkit:
* Scripts/webkitdirs.pm:
(determineIsChromium): Add --force-update to update-webkit --chromium.
(forceChromiumUpdate):
(buildChromium): Pass --force to update-webkit-chromium.
* Scripts/webkitpy/tool/steps/update.py:
(Update.run): Add --force-update if non-interactive (i.e., bots).
* Scripts/webkitpy/tool/steps/update_unittest.py:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (101284 => 101285)


--- trunk/Tools/ChangeLog	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/ChangeLog	2011-11-28 22:52:56 UTC (rev 101285)
@@ -1,5 +1,29 @@
 2011-11-28  Tony Chang  <t...@chromium.org>
 
+        ews bots should pass --force to update-webkit-chromium
+        https://bugs.webkit.org/show_bug.cgi?id=73230
+
+        Reviewed by Adam Barth.
+
+        This makes it less likely for gclient changes to break the bots (e.g.,
+        if a DEPS repository moves or is switched to a branch).
+
+        Also pass --force when using |build-webkit --update-chromium| since this
+        appears to only be used by the bots.
+
+        Take 2: Add Options.non_interactive to update.py's options() method.
+
+        * Scripts/update-webkit:
+        * Scripts/webkitdirs.pm:
+        (determineIsChromium): Add --force-update to update-webkit --chromium.
+        (forceChromiumUpdate):
+        (buildChromium): Pass --force to update-webkit-chromium.
+        * Scripts/webkitpy/tool/steps/update.py:
+        (Update.run): Add --force-update if non-interactive (i.e., bots).
+        * Scripts/webkitpy/tool/steps/update_unittest.py:
+
+2011-11-28  Tony Chang  <t...@chromium.org>
+
         Revert r101279, broke the ews and cq bots.
 
         * Scripts/update-webkit:

Modified: trunk/Tools/Scripts/update-webkit (101284 => 101285)


--- trunk/Tools/Scripts/update-webkit	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/Scripts/update-webkit	2011-11-28 22:52:56 UTC (rev 101285)
@@ -108,6 +108,7 @@
 
     my @chromiumUpdateArgs = ("perl", "Tools/Scripts/update-webkit-chromium");
     push @chromiumUpdateArgs, "--chromium-android" if isChromiumAndroid();
+    push @chromiumUpdateArgs, "--force" if forceChromiumUpdate();
     system(@chromiumUpdateArgs) == 0 or die $!;
 } elsif (isAppleWinWebKit()) {
     system("perl", "Tools/Scripts/update-webkit-auxiliary-libs") == 0 or die;

Modified: trunk/Tools/Scripts/webkitdirs.pm (101284 => 101285)


--- trunk/Tools/Scripts/webkitdirs.pm	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/Scripts/webkitdirs.pm	2011-11-28 22:52:56 UTC (rev 101285)
@@ -92,6 +92,7 @@
 my $isChromium;
 my $isChromiumAndroid;
 my $isChromiumMacMake;
+my $forceChromiumUpdate;
 my $isInspectorFrontend;
 my $isWK2;
 
@@ -964,6 +965,9 @@
 {
     return if defined($isChromium);
     $isChromium = checkForArgumentAndRemoveFromARGV("--chromium");
+    if ($isChromium) {
+        $forceChromiumUpdate = checkForArgumentAndRemoveFromARGV("--force-update");
+    }
 }
 
 sub isChromiumAndroid()
@@ -999,6 +1003,11 @@
     $isChromiumMacMake = isDarwin() && $hasUpToDateMakefile;
 }
 
+sub forceChromiumUpdate()
+{
+    determineIsChromium();
+    return $forceChromiumUpdate;
+}
 
 sub isWinCairo()
 {
@@ -2008,7 +2017,7 @@
 
     # We might need to update DEPS or re-run GYP if things have changed.
     if (checkForArgumentAndRemoveFromArrayRef("--update-chromium", \@options)) {
-        system("perl", "Tools/Scripts/update-webkit-chromium") == 0 or die $!;
+        system("perl", "Tools/Scripts/update-webkit-chromium", "--force") == 0 or die $!;
     }
 
     my $result = 1;

Modified: trunk/Tools/Scripts/webkitpy/common/config/ports.py (101284 => 101285)


--- trunk/Tools/Scripts/webkitpy/common/config/ports.py	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/Scripts/webkitpy/common/config/ports.py	2011-11-28 22:52:56 UTC (rev 101285)
@@ -80,7 +80,7 @@
         raise NotImplementedError("subclasses must implement")
 
     @classmethod
-    def update_webkit_command(cls):
+    def update_webkit_command(cls, non_interactive=False):
         return cls.script_shell_command("update-webkit")
 
     @classmethod
@@ -225,9 +225,11 @@
         return "--port=chromium"
 
     @classmethod
-    def update_webkit_command(cls):
-        command = WebKitPort.update_webkit_command()
+    def update_webkit_command(cls, non_interactive=False):
+        command = WebKitPort.update_webkit_command(non_interactive=non_interactive)
         command.append("--chromium")
+        if non_interactive:
+            command.append("--force-update")
         return command
 
     @classmethod

Modified: trunk/Tools/Scripts/webkitpy/common/config/ports_mock.py (101284 => 101285)


--- trunk/Tools/Scripts/webkitpy/common/config/ports_mock.py	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/Scripts/webkitpy/common/config/ports_mock.py	2011-11-28 22:52:56 UTC (rev 101285)
@@ -37,7 +37,7 @@
     def check_webkit_style_command(self):
         return ["mock-check-webkit-style"]
 
-    def update_webkit_command(self):
+    def update_webkit_command(self, non_interactive=False):
         return ["mock-update-webkit"]
 
     def build_webkit_command(self, build_style=None):

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/update.py (101284 => 101285)


--- trunk/Tools/Scripts/webkitpy/tool/steps/update.py	2011-11-28 22:49:34 UTC (rev 101284)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/update.py	2011-11-28 22:52:56 UTC (rev 101285)
@@ -35,6 +35,7 @@
     @classmethod
     def options(cls):
         return AbstractStep.options() + [
+            Options.non_interactive,
             Options.update,
             Options.quiet,
         ]
@@ -43,4 +44,8 @@
         if not self._options.update:
             return
         log("Updating working directory")
-        self._tool.executive.run_and_throw_if_fail(self._tool.port().update_webkit_command(), quiet=self._options.quiet, cwd=self._tool.scm().checkout_root)
+        self._tool.executive.run_and_throw_if_fail(self._update_command(), quiet=self._options.quiet, cwd=self._tool.scm().checkout_root)
+
+    def _update_command(self):
+        update_command = self._tool.port().update_webkit_command(self._options.non_interactive)
+        return update_command

Copied: trunk/Tools/Scripts/webkitpy/tool/steps/update_unittest.py (from rev 101282, trunk/Tools/Scripts/webkitpy/tool/steps/update.py) (0 => 101285)


--- trunk/Tools/Scripts/webkitpy/tool/steps/update_unittest.py	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/update_unittest.py	2011-11-28 22:52:56 UTC (rev 101285)
@@ -0,0 +1,60 @@
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * 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.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "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 COPYRIGHT
+# OWNER OR CONTRIBUTORS 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.
+
+import unittest
+
+from webkitpy.common.config.ports import ChromiumPort, ChromiumXVFBPort
+from webkitpy.tool.mocktool import MockOptions, MockTool
+from webkitpy.tool.steps.update import Update
+
+
+class UpdateTest(unittest.TestCase):
+
+    def test_update_command_non_interactive(self):
+        tool = MockTool()
+        options = MockOptions(non_interactive=True)
+        step = Update(tool, options)
+        self.assertEqual(["mock-update-webkit"], step._update_command())
+
+        tool._deprecated_port = ChromiumPort()
+        self.assertEqual(["Tools/Scripts/update-webkit", "--chromium", "--force-update"], step._update_command())
+
+        tool._deprecated_port = ChromiumXVFBPort()
+        self.assertEqual(["Tools/Scripts/update-webkit", "--chromium", "--force-update"], step._update_command())
+
+    def test_update_command_interactive(self):
+        tool = MockTool()
+        options = MockOptions(non_interactive=False)
+        step = Update(tool, options)
+        self.assertEqual(["mock-update-webkit"], step._update_command())
+
+        tool._deprecated_port = ChromiumPort()
+        self.assertEqual(["Tools/Scripts/update-webkit", "--chromium"], step._update_command())
+
+        tool._deprecated_port = ChromiumXVFBPort()
+        self.assertEqual(["Tools/Scripts/update-webkit", "--chromium"], step._update_command())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to