| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import glob | 7 import glob |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| 11 import sys | 11 import sys |
| 12 import utils | 12 import utils |
| 13 | 13 |
| 14 HOST_OS = utils.guessOS() | 14 HOST_OS = utils.guessOS() |
| 15 | 15 |
| 16 if HOST_OS == 'mac': | 16 if HOST_OS == 'mac': |
| 17 VERSION_FILE = 'Chromium.app/Contents/MacOS/VERSION' | |
| 18 CONTENTSHELL_FILES = ['Content Shell.app', 'ffmpegsumo.so', 'osmesa.so', | 17 CONTENTSHELL_FILES = ['Content Shell.app', 'ffmpegsumo.so', 'osmesa.so', |
| 19 'lib'] | 18 'lib'] |
| 20 CHROMEDRIVER_FILES = ['chromedriver'] | 19 CHROMEDRIVER_FILES = ['chromedriver'] |
| 21 elif HOST_OS == 'linux': | 20 elif HOST_OS == 'linux': |
| 22 VERSION_FILE = 'VERSION' | |
| 23 CONTENTSHELL_FILES = ['content_shell', 'content_shell.pak', 'fonts.conf', | 21 CONTENTSHELL_FILES = ['content_shell', 'content_shell.pak', 'fonts.conf', |
| 24 'libffmpegsumo.so', 'libosmesa.so', 'lib', | 22 'libffmpegsumo.so', 'libosmesa.so', 'lib', |
| 25 'icudtl.dat'] | 23 'icudtl.dat'] |
| 26 CHROMEDRIVER_FILES = ['chromedriver'] | 24 CHROMEDRIVER_FILES = ['chromedriver'] |
| 27 elif HOST_OS == 'win': | 25 elif HOST_OS == 'win': |
| 28 VERSION_FILE = 'VERSION' | |
| 29 # TODO: provide proper list. | 26 # TODO: provide proper list. |
| 30 CONTENTSHELL_FILES = ['content_shell.exe', 'AHEM____.ttf'] | 27 CONTENTSHELL_FILES = ['content_shell.exe', 'AHEM____.ttf'] |
| 31 CHROMEDRIVER_FILES = ['chromedriver.exe'] | 28 CHROMEDRIVER_FILES = ['chromedriver.exe'] |
| 32 else: | 29 else: |
| 33 raise Exception('Unsupported platform') | 30 raise Exception('Unsupported platform') |
| 34 | 31 |
| 35 # Append a file with size of the snapshot. | 32 # Append a file with size of the snapshot. |
| 36 CONTENTSHELL_FILES.append('snapshot-size.txt') | 33 CONTENTSHELL_FILES.append('snapshot-size.txt') |
| 37 | 34 |
| 38 | 35 |
| 39 def GenerateVersionFile(): | |
| 40 # TODO: fix it. | |
| 41 if HOST_OS == 'win': return | |
| 42 versionInfo = utils.getCommandOutput(os.path.join('..', '..', | |
| 43 'dart', 'tools', 'dartium', | |
| 44 'print_dart_version.sh')) | |
| 45 file = open(VERSION_FILE, 'w') | |
| 46 file.write(versionInfo) | |
| 47 file.close() | |
| 48 | |
| 49 | |
| 50 def GenerateDartiumFileList(mode, srcpath): | 36 def GenerateDartiumFileList(mode, srcpath): |
| 51 def blacklisted(name): | 37 def blacklisted(name): |
| 52 # We include everything if this is a debug build. | 38 # We include everything if this is a debug build. |
| 53 if mode.lower() == 'debug': | 39 if mode.lower() == 'debug': |
| 54 return True | 40 return True |
| 55 else: | 41 else: |
| 56 # We don't include .debug/.pdb files if this is a release build. | 42 # We don't include .debug/.pdb files if this is a release build. |
| 57 if name.endswith('.debug') or name.endswith('.pdb'): | 43 if name.endswith('.debug') or name.endswith('.pdb'): |
| 58 return False | 44 return False |
| 59 return True | 45 return True |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 114 |
| 129 # Cleanup old files. | 115 # Cleanup old files. |
| 130 if os.path.exists(stageDir): | 116 if os.path.exists(stageDir): |
| 131 shutil.rmtree(stageDir) | 117 shutil.rmtree(stageDir) |
| 132 os.mkdir(stageDir) | 118 os.mkdir(stageDir) |
| 133 revision = target.split('-')[-1] | 119 revision = target.split('-')[-1] |
| 134 oldFiles = glob.glob(target.replace(revision, '*.zip')) | 120 oldFiles = glob.glob(target.replace(revision, '*.zip')) |
| 135 for oldFile in oldFiles: | 121 for oldFile in oldFiles: |
| 136 os.remove(oldFile) | 122 os.remove(oldFile) |
| 137 | 123 |
| 138 GenerateVersionFile() | |
| 139 GenerateZipFile(zipFile, stageDir, fileList) | 124 GenerateZipFile(zipFile, stageDir, fileList) |
| 140 print 'last change: %s' % (zipFile) | 125 print 'last change: %s' % (zipFile) |
| 141 | 126 |
| 142 # Clean up. Buildbot disk space is limited. | 127 # Clean up. Buildbot disk space is limited. |
| 143 shutil.rmtree(stageDir) | 128 shutil.rmtree(stageDir) |
| 144 | 129 |
| 145 return zipFile | 130 return zipFile |
| 146 | 131 |
| 147 | 132 |
| 148 def Archive(srcpath, mode, dartium_target, contentshell_target, | 133 def Archive(srcpath, mode, dartium_target, contentshell_target, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 action='store', type='string', | 180 action='store', type='string', |
| 196 help='(Release|Debug)') | 181 help='(Release|Debug)') |
| 197 (options, args) = parser.parse_args() | 182 (options, args) = parser.parse_args() |
| 198 Archive(srcpath, options.mode, options.dartium, options.contentshell, | 183 Archive(srcpath, options.mode, options.dartium, options.contentshell, |
| 199 options.chromedriver) | 184 options.chromedriver) |
| 200 return 0 | 185 return 0 |
| 201 | 186 |
| 202 | 187 |
| 203 if __name__ == '__main__': | 188 if __name__ == '__main__': |
| 204 sys.exit(main()) | 189 sys.exit(main()) |
| OLD | NEW |