Changeset 64959 in webkit


Ignore:
Timestamp:
Aug 8, 2010 6:26:16 PM (14 years ago)
Author:
tkent@chromium.org
Message:

Chromium buildbot: Avoid "zip" command dependency
https://bugs.webkit.org/show_bug.cgi?id=43470

Reviewed by Tony Chang.

  • BuildSlaveSupport/test-result-archive: For Chromium port, creates a zip archive with zipfile package of Python instead of external "zip" command. We'd like to avoid additional command installation.
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/BuildSlaveSupport/test-result-archive

    r64709 r64959  
    2424# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2525
    26 import optparse, os, shutil, subprocess, sys
     26import optparse, os, shutil, subprocess, sys, zipfile
    2727
    2828sourceRootDirectory = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
     
    7373        if subprocess.call(["ditto", "-c", "-k", "--sequesterRsrc", layoutTestResultsDir, archiveFile]):
    7474            return 1
    75     elif platform in ('win', 'gtk', 'qt', 'chromium'):
     75    elif platform in ('win', 'gtk', 'qt'):
    7676        if subprocess.call(["zip", "-r", archiveFile, "."], cwd=layoutTestResultsDir):
    7777            return 1
     78    elif platform == 'chromium':
     79        os.chdir(layoutTestResultsDir)
     80        zipFilesRecursively(archiveFile, ["."])
    7881
    7982    try:
     
    8992            raise
    9093
     94def zipFilesRecursively(archiveFile, files):
     95    """Make a zip archive.
     96
     97    Args:
     98        archiveFile: The resultant zip archive file name.
     99        files: A list of files to be archived.  If a list item is a directory,
     100            files in the directory are archived recursively."""
     101    zipper = zipfile.ZipFile(archiveFile, 'w', zipfile.ZIP_DEFLATED)
     102    for file in files:
     103        if os.path.isdir(file):
     104            for dirPath, dirNames, fileNames in os.walk(file):
     105                for fileName in fileNames:
     106                    relativePath = os.path.join(dirPath, fileName)
     107                    print "Adding", relativePath
     108                    zipper.write(relativePath)
     109        else:
     110            print "Adding", file
     111            zipper.write(file)
     112    zipper.close()
     113    print "Created zip archive: ", archiveFile
     114
    91115if __name__ == '__main__':
    92116    sys.exit(main())
  • trunk/WebKitTools/ChangeLog

    r64948 r64959  
     12010-08-08  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        Chromium buildbot: Avoid "zip" command dependency
     6        https://bugs.webkit.org/show_bug.cgi?id=43470
     7
     8        * BuildSlaveSupport/test-result-archive:
     9         For Chromium port, creates a zip archive with zipfile package of Python
     10         instead of external "zip" command. We'd like to avoid additional
     11         command installation.
     12
    1132010-08-08  Jon Honeycutt  <jhoneycutt@apple.com>
    214
Note: See TracChangeset for help on using the changeset viewer.