OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 |
11 generates packed_files.txt for mini_installer project. | 11 generates packed_files.txt for mini_installer project. |
12 | 12 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (options.diff_algorithm == "COURGETTE"): | 125 if (options.diff_algorithm == "COURGETTE"): |
126 exe_file = os.path.join(options.last_chrome_installer, COURGETTE_EXEC) | 126 exe_file = os.path.join(options.last_chrome_installer, COURGETTE_EXEC) |
127 cmd = '%s -gen "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file) | 127 cmd = '%s -gen "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file) |
128 else: | 128 else: |
129 exe_file = os.path.join(options.output_dir, BSDIFF_EXEC) | 129 exe_file = os.path.join(options.output_dir, BSDIFF_EXEC) |
130 cmd = '%s "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file) | 130 cmd = '%s "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file) |
131 RunSystemCommand(cmd) | 131 RunSystemCommand(cmd) |
132 | 132 |
133 def GetLZMAExec(output_dir): | 133 def GetLZMAExec(output_dir): |
134 lzma_exec = os.path.join(output_dir, "..", "..", "third_party", | 134 lzma_exec = os.path.join(output_dir, "..", "..", "third_party", |
135 "lzma_sdk", "Executable", "7za.exe") | 135 "lzma_sdk", "7zr.exe") |
136 return lzma_exec | 136 return lzma_exec |
137 | 137 |
138 def GetPrevVersion(output_dir, temp_dir, last_chrome_installer): | 138 def GetPrevVersion(output_dir, temp_dir, last_chrome_installer): |
139 if not last_chrome_installer: | 139 if not last_chrome_installer: |
140 return '' | 140 return '' |
141 | 141 |
142 lzma_exec = GetLZMAExec(options.output_dir) | 142 lzma_exec = GetLZMAExec(options.output_dir) |
143 prev_archive_file = os.path.join(options.last_chrome_installer, | 143 prev_archive_file = os.path.join(options.last_chrome_installer, |
144 options.output_name + ARCHIVE_SUFFIX) | 144 options.output_name + ARCHIVE_SUFFIX) |
145 cmd = '%s x -o"%s" "%s" Chrome-bin/*/chrome.dll' % (lzma_exec, temp_dir, | 145 cmd = '%s x -o"%s" "%s" Chrome-bin/*/chrome.dll' % (lzma_exec, temp_dir, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 def CreateArchiveFile(options, staging_dir, current_version, prev_version): | 185 def CreateArchiveFile(options, staging_dir, current_version, prev_version): |
186 """Creates a new installer archive file after deleting any existing old file. | 186 """Creates a new installer archive file after deleting any existing old file. |
187 """ | 187 """ |
188 # First create an uncompressed archive file for the current build (chrome.7z) | 188 # First create an uncompressed archive file for the current build (chrome.7z) |
189 lzma_exec = GetLZMAExec(options.output_dir) | 189 lzma_exec = GetLZMAExec(options.output_dir) |
190 archive_file = os.path.join(options.output_dir, | 190 archive_file = os.path.join(options.output_dir, |
191 options.output_name + ARCHIVE_SUFFIX) | 191 options.output_name + ARCHIVE_SUFFIX) |
192 cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file, | 192 cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file, |
193 os.path.join(staging_dir, CHROME_DIR)) | 193 os.path.join(staging_dir, CHROME_DIR)) |
194 # There doesnt seem to be any way in 7za.exe to override existing file so | 194 # There doesnt seem to be any way in 7zr.exe to override existing file so |
195 # we always delete before creating a new one. | 195 # we always delete before creating a new one. |
196 if not os.path.exists(archive_file): | 196 if not os.path.exists(archive_file): |
197 RunSystemCommand(cmd) | 197 RunSystemCommand(cmd) |
198 elif options.skip_rebuild_archive != "true": | 198 elif options.skip_rebuild_archive != "true": |
199 os.remove(archive_file) | 199 os.remove(archive_file) |
200 RunSystemCommand(cmd) | 200 RunSystemCommand(cmd) |
201 | 201 |
202 # If we are generating a patch, run bsdiff against previous build and | 202 # If we are generating a patch, run bsdiff against previous build and |
203 # compress the resulting patch file. If this is not a patch just compress the | 203 # compress the resulting patch file. If this is not a patch just compress the |
204 # uncompressed archive file. | 204 # uncompressed archive file. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') | 329 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') |
330 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF', | 330 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF', |
331 help='Diff algorithm to use when generating differential patches ' + | 331 help='Diff algorithm to use when generating differential patches ' + |
332 '{BSDIFF|COURGETTE}.') | 332 '{BSDIFF|COURGETTE}.') |
333 option_parser.add_option('-n', '--output_name', default='chrome', | 333 option_parser.add_option('-n', '--output_name', default='chrome', |
334 help='Name used to prefix names of generated archives.') | 334 help='Name used to prefix names of generated archives.') |
335 | 335 |
336 options, args = option_parser.parse_args() | 336 options, args = option_parser.parse_args() |
337 print sys.argv | 337 print sys.argv |
338 sys.exit(main(options)) | 338 sys.exit(main(options)) |
OLD | NEW |