OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Script to create Chrome Installer archive. | 6 """Script to create Chrome Installer archive. |
7 | 7 |
8 This script is used to create an archive of all the files required for a | 8 This script is used to create an archive of all the files required for a |
9 Chrome install in appropriate directory structure. It reads chrome.release | 9 Chrome install in appropriate directory structure. It reads chrome.release |
10 file as input, creates chrome.7z archive, compresses setup.exe and | 10 file as input, creates chrome.7z archive, compresses setup.exe and |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 cmd = '%s x -o"%s" "%s" Chrome-bin/*/gears.dll' % (lzma_exec, temp_dir, | 140 cmd = '%s x -o"%s" "%s" Chrome-bin/*/gears.dll' % (lzma_exec, temp_dir, |
141 prev_archive_file) | 141 prev_archive_file) |
142 RunSystemCommand(cmd) | 142 RunSystemCommand(cmd) |
143 dll_path = glob.glob(os.path.join(temp_dir, 'Chrome-bin', '*', 'gears.dll')) | 143 dll_path = glob.glob(os.path.join(temp_dir, 'Chrome-bin', '*', 'gears.dll')) |
144 return os.path.split(os.path.split(dll_path[0])[0])[1] | 144 return os.path.split(os.path.split(dll_path[0])[0])[1] |
145 | 145 |
146 def MakeStagingDirectories(output_dir): | 146 def MakeStagingDirectories(output_dir): |
147 """Creates a staging path for installer archive. If directory exists already, | 147 """Creates a staging path for installer archive. If directory exists already, |
148 deletes the existing directory. | 148 deletes the existing directory. |
149 """ | 149 """ |
150 file_path = os.path.join(output_dir, ARCHIVE_DIR) | 150 prefixed_archive_dir = (options.archive_prefix or "") + ARCHIVE_DIR |
| 151 file_path = os.path.join(output_dir, prefixed_archive_dir) |
151 if os.path.exists(file_path): | 152 if os.path.exists(file_path): |
152 shutil.rmtree(file_path) | 153 shutil.rmtree(file_path) |
153 os.makedirs(file_path) | 154 os.makedirs(file_path) |
154 | 155 |
155 temp_file_path = os.path.join(output_dir, TEMP_ARCHIVE_DIR) | 156 prefixed_temp_archive_dir = (options.archive_prefix or "") + TEMP_ARCHIVE_DIR |
| 157 temp_file_path = os.path.join(output_dir, prefixed_temp_archive_dir) |
156 if os.path.exists(temp_file_path): | 158 if os.path.exists(temp_file_path): |
157 shutil.rmtree(temp_file_path) | 159 shutil.rmtree(temp_file_path) |
158 os.makedirs(temp_file_path) | 160 os.makedirs(temp_file_path) |
159 return (file_path, temp_file_path) | 161 return (file_path, temp_file_path) |
160 | 162 |
161 def Readconfig(output_dir, input_file, current_version): | 163 def Readconfig(output_dir, input_file, current_version): |
162 """Reads config information from input file after setting default value of | 164 """Reads config information from input file after setting default value of |
163 global variabes. | 165 global variabes. |
164 """ | 166 """ |
165 variables = {} | 167 variables = {} |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 option_parser.add_option('-i', '--input_file', help='Input file') | 308 option_parser.add_option('-i', '--input_file', help='Input file') |
307 option_parser.add_option('-d', '--distribution', | 309 option_parser.add_option('-d', '--distribution', |
308 help='Name of Chromium Distribution. Optional.') | 310 help='Name of Chromium Distribution. Optional.') |
309 option_parser.add_option('-s', '--skip_rebuild_archive', | 311 option_parser.add_option('-s', '--skip_rebuild_archive', |
310 default="False", help='Skip re-building Chrome.7z archive if it exists.') | 312 default="False", help='Skip re-building Chrome.7z archive if it exists.') |
311 option_parser.add_option('-l', '--last_chrome_installer', | 313 option_parser.add_option('-l', '--last_chrome_installer', |
312 help='Generate differential installer. The value of this parameter ' + | 314 help='Generate differential installer. The value of this parameter ' + |
313 'specifies the directory that contains base versions of ' + | 315 'specifies the directory that contains base versions of ' + |
314 'setup.exe, courgette.exe (if --diff_algorithm is COURGETTE) ' + | 316 'setup.exe, courgette.exe (if --diff_algorithm is COURGETTE) ' + |
315 '& chrome.7z.') | 317 '& chrome.7z.') |
| 318 option_parser.add_option('-p', '--archive_prefix', |
| 319 help='Specifies a prefix to the archive path. Useful if building ' + |
| 320 'multiple installer archives.') |
316 option_parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', | 321 option_parser.add_option('-f', '--setup_exe_format', default='COMPRESSED', |
317 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') | 322 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') |
318 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF', | 323 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF', |
319 help='Diff algorithm to use when generating differential patches ' + | 324 help='Diff algorithm to use when generating differential patches ' + |
320 '{BSDIFF|COURGETTE}.') | 325 '{BSDIFF|COURGETTE}.') |
321 | 326 |
322 options, args = option_parser.parse_args() | 327 options, args = option_parser.parse_args() |
323 print sys.argv | 328 print sys.argv |
324 sys.exit(main(options)) | 329 sys.exit(main(options)) |
OLD | NEW |