Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: dartium_tools/archive.py

Issue 239993009: Revert accidental dartium code push (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/worker/worker_webkitplatformsupport_impl.cc ('k') | dartium_tools/build.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2
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
5 # found in the LICENSE file.
6
7 import glob
8 import optparse
9 import os
10 import shutil
11 import subprocess
12 import sys
13 import utils
14
15 HOST_OS = utils.guessOS()
16
17 if HOST_OS == 'mac':
18 VERSION_FILE = 'Chromium.app/Contents/MacOS/VERSION'
19 CONTENTSHELL_FILES = ['Content Shell.app', 'ffmpegsumo.so', 'osmesa.so',
20 'lib']
21 CHROMEDRIVER_FILES = ['chromedriver']
22 elif HOST_OS == 'linux':
23 VERSION_FILE = 'VERSION'
24 CONTENTSHELL_FILES = ['content_shell', 'content_shell.pak', 'fonts.conf',
25 'libffmpegsumo.so', 'libosmesa.so', 'lib',
26 'icudtl.dat']
27 CHROMEDRIVER_FILES = ['chromedriver']
28 elif HOST_OS == 'win':
29 VERSION_FILE = 'VERSION'
30 # TODO: provide proper list.
31 CONTENTSHELL_FILES = ['content_shell.exe', 'AHEM____.ttf']
32 CHROMEDRIVER_FILES = ['chromedriver.exe']
33 else:
34 raise Exception('Unsupported platform')
35
36 # Append a file with size of the snapshot.
37 CONTENTSHELL_FILES.append('snapshot-size.txt')
38
39
40 def GenerateVersionFile():
41 # TODO: fix it.
42 if HOST_OS == 'win': return
43 versionInfo = utils.getCommandOutput(os.path.join('..', '..',
44 'dartium_tools',
45 'print_dart_version.sh'))
46 file = open(VERSION_FILE, 'w')
47 file.write(versionInfo)
48 file.close()
49
50
51 def GenerateDartiumFileList(mode, srcpath):
52 def blacklisted(name):
53 # We include everything if this is a debug build.
54 if mode.lower() == 'debug':
55 return True
56 else:
57 # We don't include .debug/.pdb files if this is a release build.
58 if name.endswith('.debug') or name.endswith('.pdb'):
59 return False
60 return True
61
62 configFile = os.path.join(srcpath, 'chrome', 'tools', 'build', HOST_OS,
63 'FILES.cfg')
64 configNamespace = {}
65 execfile(configFile, configNamespace)
66 fileList = [file['filename'] for file in configNamespace['FILES']]
67
68 # The debug version of dartium on our bots build with
69 # 'component=shared_library', so we need to include all libraries
70 # (i.e. 'lib/*.so) as we do on the CONTENTSHELL_FILES list above.
71 if HOST_OS == 'linux' and mode.lower() == 'debug':
72 fileList.append('lib')
73
74 # Filter out files we've blacklisted and don't want to include.
75 fileList = filter(blacklisted, fileList)
76 return fileList
77
78
79 def GenerateContentShellFileList(srcpath):
80 return CONTENTSHELL_FILES
81
82
83 def GenerateChromeDriverFileList(srcpath):
84 return CHROMEDRIVER_FILES
85
86
87 def ZipDir(zipFile, directory):
88 if HOST_OS == 'win':
89 cmd = os.path.normpath(os.path.join(
90 os.path.dirname(__file__),
91 '../third_party/lzma_sdk/Executable/7za.exe'))
92 options = ['a', '-r', '-tzip']
93 else:
94 cmd = 'zip'
95 options = ['-yr']
96 utils.runCommand([cmd] + options + [zipFile, directory])
97
98
99 def GenerateZipFile(zipFile, stageDir, fileList):
100 # Stage files.
101 for fileName in fileList:
102 fileName = fileName.rstrip(os.linesep)
103 targetName = os.path.join(stageDir, fileName)
104 try:
105 targetDir = os.path.dirname(targetName)
106 if not os.path.exists(targetDir):
107 os.makedirs(targetDir)
108 if os.path.isdir(fileName):
109 # TODO: This is a hack to handle duplicates on the fileList of the
110 # form: [ 'lib/foo.so', 'lib' ]
111 if os.path.exists(targetName) and os.path.isdir(targetName):
112 shutil.rmtree(targetName)
113 shutil.copytree(fileName, targetName)
114 elif os.path.exists(fileName):
115 shutil.copy2(fileName, targetName)
116 except:
117 import traceback
118 print 'Troubles processing %s [cwd=%s]: %s' % (fileName, os.getcwd(), trac eback.format_exc())
119
120 ZipDir(zipFile, stageDir)
121
122
123 def StageAndZip(fileList, target):
124 if not target:
125 return None
126
127 stageDir = target
128 zipFile = stageDir + '.zip'
129
130 # Cleanup old files.
131 if os.path.exists(stageDir):
132 shutil.rmtree(stageDir)
133 os.mkdir(stageDir)
134 oldFiles = glob.glob(target.split('-')[0] + '*.zip')
135 for oldFile in oldFiles:
136 os.remove(oldFile)
137
138 GenerateVersionFile()
139 GenerateZipFile(zipFile, stageDir, fileList)
140 print 'last change: %s' % (zipFile)
141
142 # Clean up. Buildbot disk space is limited.
143 shutil.rmtree(stageDir)
144
145 return zipFile
146
147
148 def Archive(srcpath, mode, dartium_target, contentshell_target,
149 chromedriver_target, is_win_ninja=False):
150 # We currently build using ninja on mac debug.
151 if HOST_OS == 'mac':
152 releaseDir = os.path.join(srcpath, 'out', mode)
153 # Also package dynamic libraries.
154 extra_files = [file for file in os.listdir(releaseDir) if file.endswith('.dy lib')]
155 elif HOST_OS == 'linux':
156 releaseDir = os.path.join(srcpath, 'out', mode)
157 extra_files = []
158 elif HOST_OS == 'win':
159 if is_win_ninja:
160 releaseDir = os.path.join(srcpath, 'out', mode)
161 else:
162 releaseDir = os.path.join(srcpath, 'out', mode)
163 # issue(16760) - we _need_ to fix our parsing of the FILES.cfg
164 extra_files = [file for file in os.listdir(releaseDir) if file.endswith('man ifest')]
165 else:
166 raise Exception('Unsupported platform')
167 os.chdir(releaseDir)
168
169 dartium_zip = StageAndZip(
170 GenerateDartiumFileList(mode, srcpath) + extra_files, dartium_target)
171 contentshell_zip = StageAndZip(GenerateContentShellFileList(srcpath) + extra_f iles,
172 contentshell_target)
173 chromedriver_zip = StageAndZip(GenerateChromeDriverFileList(srcpath) + extra_f iles,
174 chromedriver_target)
175 return (dartium_zip, contentshell_zip, chromedriver_zip)
176
177
178 def main():
179 pathname = os.path.dirname(sys.argv[0])
180 fullpath = os.path.abspath(pathname)
181 srcpath = os.path.join(fullpath, '..')
182
183 parser = optparse.OptionParser()
184 parser.add_option('--dartium', dest='dartium',
185 action='store', type='string',
186 help='dartium archive name')
187 parser.add_option('--contentshell', dest='contentshell',
188 action='store', type='string',
189 help='content shell archive name')
190 parser.add_option('--chromedriver', dest='chromedriver',
191 action='store', type='string',
192 help='chromedriver archive name')
193 parser.add_option('--mode', dest='mode',
194 default='Release',
195 action='store', type='string',
196 help='(Release|Debug)')
197 (options, args) = parser.parse_args()
198 Archive(srcpath, options.mode, options.dartium, options.contentshell,
199 options.chromedriver)
200 return 0
201
202
203 if __name__ == '__main__':
204 sys.exit(main())
OLDNEW
« no previous file with comments | « content/worker/worker_webkitplatformsupport_impl.cc ('k') | dartium_tools/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698