Title: [138888] trunk/Tools
Revision
138888
Author
rn...@webkit.org
Date
2013-01-05 00:20:09 -0800 (Sat, 05 Jan 2013)

Log Message

Add a script to delete stale zero-byte build files
https://bugs.webkit.org/show_bug.cgi?id=106131

Reviewed by Tony Chang.

Delete zero-byte build files on Mac port for now. It doesn't do anything on other ports.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(DeleteStaleBuildFiles): Added.
(Factory.__init__): Add DeleteStaleBuildFiles step.
* BuildSlaveSupport/delete-stale-build-files: Added.
(main): Delete zero-byte files except ones intentionally generated by our build process.
(webkitBuildDirectory): Copied from build-product-archive.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg (138887 => 138888)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg	2013-01-05 07:36:55 UTC (rev 138887)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg	2013-01-05 08:20:09 UTC (rev 138888)
@@ -141,6 +141,12 @@
     descriptionDone = ["killed old processes"]
     command = ["python", "./Tools/BuildSlaveSupport/kill-old-processes"]
 
+class DeleteStaleBuildFiles(shell.Compile):
+    name = "delete stale build files"
+    description = ["deleting stale build files"]
+    descriptionDone = ["delete stale build files"]
+    command = ["python", "./Tools/BuildSlaveSupport/delete-stale-build-files", WithProperties("--platform=%(fullPlatform)s"), WithProperties("--%(configuration)s")]
+
 class InstallEflDependencies(shell.ShellCommand):
     name = "jhbuild"
     description = ["updating efl dependencies"]
@@ -747,6 +753,7 @@
         # There are multiple Qt slaves running on same machines, so buildslaves shouldn't kill the processes of other slaves.
         if not platform.startswith("qt"):
             self.addStep(KillOldProcesses())
+        self.addStep(DeleteStaleBuildFiles())
         if platform == "win":
             self.addStep(InstallWin32Dependencies())
         if platform.startswith("chromium"):

Added: trunk/Tools/BuildSlaveSupport/delete-stale-build-files (0 => 138888)


--- trunk/Tools/BuildSlaveSupport/delete-stale-build-files	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/delete-stale-build-files	2013-01-05 08:20:09 UTC (rev 138888)
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+# Copyright (C) 2013 Apple Inc.  All rights reserved.
+# Copyright (C) 2012 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:
+#
+# 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.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 optparse
+import os
+import subprocess
+import sys
+
+
+def main():
+    parser = optparse.OptionParser("usage: %prog [options]")
+    parser.add_option("--platform", dest="platform")
+    parser.add_option("--debug", action="" const="debug", dest="configuration")
+    parser.add_option("--release", action="" const="release", dest="configuration")
+
+    options, parameters = parser.parse_args()
+    if not options.platform:
+        parser.error("Platform is required")
+        return -1
+    if not options.configuration:
+        parser.error("Configuration is required")
+        return -2
+
+    genericPlatform = options.platform.split('-', 1)[0]
+    if genericPlatform != 'mac':
+        print 'Exited without removing any files.'
+        return 0
+
+    directory = webkitBuildDirectory(genericPlatform, options.configuration)
+    exit_code = 0
+
+    for root, _, files in os.walk(directory):
+        for name in files:
+            full_path = os.path.join(root, name)
+            ext = os.path.splitext(full_path)[1]
+
+            try:
+                if ext in ('.dep', '.timestamp', '.txt', '.html', '.js', '.generated') or os.path.getsize(full_path):
+                    continue
+            except OSError as exception:
+                print exception
+                continue
+
+            try:
+                os.remove(full_path)
+                print 'Removed', full_path
+            except OSError as exception:
+                print exception
+                exit_code += 1
+
+    return exit_code
+
+
+def webkitBuildDirectory(platform, configuration):
+    return subprocess.Popen(['perl', os.path.join(os.path.dirname(__file__), "..", "Scripts", "webkit-build-directory"),
+        "--" + platform, "--" + configuration, '--top-level'], stdout=subprocess.PIPE).communicate()[0].strip()
+
+
+if __name__ == '__main__':
+    sys.exit(main())
Property changes on: trunk/Tools/BuildSlaveSupport/delete-stale-build-files
___________________________________________________________________

Added: svn:executable

Modified: trunk/Tools/ChangeLog (138887 => 138888)


--- trunk/Tools/ChangeLog	2013-01-05 07:36:55 UTC (rev 138887)
+++ trunk/Tools/ChangeLog	2013-01-05 08:20:09 UTC (rev 138888)
@@ -1,3 +1,19 @@
+2013-01-04  Ryosuke Niwa  <rn...@webkit.org>
+
+        Add a script to delete stale zero-byte build files
+        https://bugs.webkit.org/show_bug.cgi?id=106131
+
+        Reviewed by Tony Chang.
+
+        Delete zero-byte build files on Mac port for now. It doesn't do anything on other ports.
+
+        * BuildSlaveSupport/build.webkit.org-config/master.cfg:
+        (DeleteStaleBuildFiles): Added.
+        (Factory.__init__): Add DeleteStaleBuildFiles step.
+        * BuildSlaveSupport/delete-stale-build-files: Added.
+        (main): Delete zero-byte files except ones intentionally generated by our build process.
+        (webkitBuildDirectory): Copied from build-product-archive.
+
 2013-01-04  Michael Pruett  <mich...@68k.org>
 
         [GTK] Fix build error on GTK due to r138836
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to