Title: [211380] trunk/Tools
Revision
211380
Author
clo...@igalia.com
Date
2017-01-30 12:05:34 -0800 (Mon, 30 Jan 2017)

Log Message

[GTK][EFL] Avoid using a thin directory to create the built product on the archive-built-product step.
https://bugs.webkit.org/show_bug.cgi?id=167596

Reviewed by Daniel Bates.

We avoid needing a thin directory by invoking the zip program with
the list of directories from the build directory to be zipped,
and by using the zip feature to exclude files matching a pattern.

* BuildSlaveSupport/built-product-archive:
(copyBuildFiles):
(createZipFromList):
(archiveBuiltProduct):

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/built-product-archive (211379 => 211380)


--- trunk/Tools/BuildSlaveSupport/built-product-archive	2017-01-30 19:46:40 UTC (rev 211379)
+++ trunk/Tools/BuildSlaveSupport/built-product-archive	2017-01-30 20:05:34 UTC (rev 211380)
@@ -24,6 +24,7 @@
 # (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 errno
 import optparse
 import os
 import shutil
@@ -97,6 +98,25 @@
     shutil.copytree(source, destination, ignore=shutil.ignore_patterns(*patterns))
 
 
+def createZipFromList(listToZip, configuration, excludePattern=None):
+    archiveDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'WebKitBuild'))
+    archiveFile = os.path.join(archiveDir, configuration + '.zip')
+
+    try:
+        os.unlink(archiveFile)
+    except OSError, e:
+        if e.errno != errno.ENOENT:
+            raise
+
+    if sys.platform.startswith('linux'):
+        zipCommand = ['zip', '-y', '-r', archiveFile] + listToZip
+        if excludePattern:
+            zipCommand += ['-x', excludePattern]
+        return subprocess.call(zipCommand, cwd=_configurationBuildDirectory)
+
+    raise NotImplementedError('Unsupported platform: {platform}'.format(platform=sys.platform))
+
+
 def createZipManually(directoryToZip, archiveFile):
     archiveZip = zipfile.ZipFile(archiveFile, "w")
 
@@ -115,7 +135,7 @@
     try:
         os.unlink(archiveFile)
     except OSError, e:
-        if e.errno != 2:
+        if e.errno != errno.ENOENT:
             raise
 
     if sys.platform == 'darwin':
@@ -183,32 +203,17 @@
         shutil.rmtree(thinDirectory)
 
     elif platform == 'gtk' or platform == 'efl':
-        thinDirectory = os.path.join(_configurationBuildDirectory, 'thin')
-
-        removeDirectoryIfExists(thinDirectory)
-        os.mkdir(thinDirectory)
-
-        neededDirectories = ["bin", "lib"]
-
+        # On GTK+/EFL we don't need the intermediate step of creating a thinDirectory
+        # to be compressed in a ZIP file, because we can create the ZIP directly.
+        # This is faster and requires less disk resources.
+        neededDirectories = ['bin', 'lib']
         # When debug fission is enabled the directories below contain dwo files
         # with the debug information needed to generate backtraces with GDB.
-        for objectDir in ["Tools", "Source"]:
+        for objectDir in ['Tools', 'Source']:
             if dirContainsdwo(objectDir):
                 neededDirectories.append(objectDir)
 
-        for dirname in neededDirectories:
-            fromDir = os.path.join(_configurationBuildDirectory, dirname, '.')
-            toDir = os.path.join(thinDirectory, dirname)
-            os.makedirs(toDir)
-            if subprocess.call('cp -R %s %s' % (fromDir, toDir), shell=True):
-                return 1
-
-        for root, dirs, files in os.walk(thinDirectory, topdown=False):
-            for name in files:
-                if name.endswith(".o"):
-                    os.remove(os.path.join(root, name))
-
-        if createZip(thinDirectory, configuration):
+        if createZipFromList(neededDirectories, configuration, excludePattern='*.o'):
             return 1
 
 def unzipArchive(directoryToExtractTo, configuration):

Modified: trunk/Tools/ChangeLog (211379 => 211380)


--- trunk/Tools/ChangeLog	2017-01-30 19:46:40 UTC (rev 211379)
+++ trunk/Tools/ChangeLog	2017-01-30 20:05:34 UTC (rev 211380)
@@ -1,3 +1,19 @@
+2017-01-30  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        [GTK][EFL] Avoid using a thin directory to create the built product on the archive-built-product step.
+        https://bugs.webkit.org/show_bug.cgi?id=167596
+
+        Reviewed by Daniel Bates.
+
+        We avoid needing a thin directory by invoking the zip program with
+        the list of directories from the build directory to be zipped,
+        and by using the zip feature to exclude files matching a pattern.
+
+        * BuildSlaveSupport/built-product-archive:
+        (copyBuildFiles):
+        (createZipFromList):
+        (archiveBuiltProduct):
+
 2017-01-30  Jonathan Bedard  <jbed...@apple.com>
 
         Use simctl instead of LayoutTestRelay
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to