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

Side by Side Diff: chrome/tools/build/win/create_installer_archive.py

Issue 6730044: Upgrading lzma_sdk to version 9.20. Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/installer/util/lzma_util.cc ('k') | courgette/crc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 elif line.startswith('MINOR='): 67 elif line.startswith('MINOR='):
68 minor = line[6:] 68 minor = line[6:]
69 elif line.startswith('BUILD='): 69 elif line.startswith('BUILD='):
70 build = line[6:] 70 build = line[6:]
71 elif line.startswith('PATCH='): 71 elif line.startswith('PATCH='):
72 patch = line[6:] 72 patch = line[6:]
73 return '%s.%s.%s.%s' % (major, minor, build, patch) 73 return '%s.%s.%s.%s' % (major, minor, build, patch)
74 74
75 def CompressUsingLZMA(output_dir, compressed_file, input_file): 75 def CompressUsingLZMA(output_dir, compressed_file, input_file):
76 lzma_exec = GetLZMAExec(output_dir) 76 lzma_exec = GetLZMAExec(output_dir)
77 cmd = '%s a -t7z "%s" "%s" -mx9' % (lzma_exec, compressed_file, input_file) 77 cmd = ('%s a -t7z '
78 # Flags equivalent to -mx9 but with bcj2 turned on (exe pre-filter).
79 # This results in ~3MB decrease in installer size on a 24MB installer.
80 '-m0=BCJ2 '
81 '-m1=LZMA:d26:fb64 '
82 '-m2=LZMA:d20:fb64:mf=bt2 '
83 '-m3=LZMA:d20:fb64:mf=bt2 '
84 '-mb0:1 -mb0s1:2 '
85 '-mb0s2:3 '
86 '"%s" "%s"') % (lzma_exec, compressed_file, input_file)
78 if os.path.exists(compressed_file): 87 if os.path.exists(compressed_file):
79 os.remove(compressed_file) 88 os.remove(compressed_file)
80 RunSystemCommand(cmd) 89 RunSystemCommand(cmd)
81 90
82 def CopyAllFilesToStagingDir(config, distribution, staging_dir, output_dir): 91 def CopyAllFilesToStagingDir(config, distribution, staging_dir, output_dir):
83 """Copies the files required for installer archive. 92 """Copies the files required for installer archive.
84 Copies all common files required for various distributions of Chromium and 93 Copies all common files required for various distributions of Chromium and
85 also files for the specific Chromium build specified by distribution. 94 also files for the specific Chromium build specified by distribution.
86 """ 95 """
87 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, output_dir) 96 CopySectionFilesToStagingDir(config, 'GENERAL', staging_dir, output_dir)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (options.diff_algorithm == "COURGETTE"): 134 if (options.diff_algorithm == "COURGETTE"):
126 exe_file = os.path.join(options.last_chrome_installer, COURGETTE_EXEC) 135 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) 136 cmd = '%s -gen "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file)
128 else: 137 else:
129 exe_file = os.path.join(options.output_dir, BSDIFF_EXEC) 138 exe_file = os.path.join(options.output_dir, BSDIFF_EXEC)
130 cmd = '%s "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file) 139 cmd = '%s "%s" "%s" "%s"' % (exe_file, orig_file, new_file, patch_file)
131 RunSystemCommand(cmd) 140 RunSystemCommand(cmd)
132 141
133 def GetLZMAExec(output_dir): 142 def GetLZMAExec(output_dir):
134 lzma_exec = os.path.join(output_dir, "..", "..", "third_party", 143 lzma_exec = os.path.join(output_dir, "..", "..", "third_party",
135 "lzma_sdk", "Executable", "7za.exe") 144 "lzma_sdk", "7zr.exe")
136 return lzma_exec 145 return lzma_exec
137 146
138 def GetPrevVersion(output_dir, temp_dir, last_chrome_installer): 147 def GetPrevVersion(output_dir, temp_dir, last_chrome_installer):
139 if not last_chrome_installer: 148 if not last_chrome_installer:
140 return '' 149 return ''
141 150
142 lzma_exec = GetLZMAExec(options.output_dir) 151 lzma_exec = GetLZMAExec(options.output_dir)
143 prev_archive_file = os.path.join(options.last_chrome_installer, 152 prev_archive_file = os.path.join(options.last_chrome_installer,
144 options.output_name + ARCHIVE_SUFFIX) 153 options.output_name + ARCHIVE_SUFFIX)
145 cmd = '%s x -o"%s" "%s" Chrome-bin/*/chrome.dll' % (lzma_exec, temp_dir, 154 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
184 193
185 def CreateArchiveFile(options, staging_dir, current_version, prev_version): 194 def CreateArchiveFile(options, staging_dir, current_version, prev_version):
186 """Creates a new installer archive file after deleting any existing old file. 195 """Creates a new installer archive file after deleting any existing old file.
187 """ 196 """
188 # First create an uncompressed archive file for the current build (chrome.7z) 197 # First create an uncompressed archive file for the current build (chrome.7z)
189 lzma_exec = GetLZMAExec(options.output_dir) 198 lzma_exec = GetLZMAExec(options.output_dir)
190 archive_file = os.path.join(options.output_dir, 199 archive_file = os.path.join(options.output_dir,
191 options.output_name + ARCHIVE_SUFFIX) 200 options.output_name + ARCHIVE_SUFFIX)
192 cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file, 201 cmd = '%s a -t7z "%s" "%s" -mx0' % (lzma_exec, archive_file,
193 os.path.join(staging_dir, CHROME_DIR)) 202 os.path.join(staging_dir, CHROME_DIR))
194 # There doesnt seem to be any way in 7za.exe to override existing file so 203 # There doesnt seem to be any way in 7zr.exe to override existing file so
195 # we always delete before creating a new one. 204 # we always delete before creating a new one.
196 if not os.path.exists(archive_file): 205 if not os.path.exists(archive_file):
197 RunSystemCommand(cmd) 206 RunSystemCommand(cmd)
198 elif options.skip_rebuild_archive != "true": 207 elif options.skip_rebuild_archive != "true":
199 os.remove(archive_file) 208 os.remove(archive_file)
200 RunSystemCommand(cmd) 209 RunSystemCommand(cmd)
201 210
202 # If we are generating a patch, run bsdiff against previous build and 211 # 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 212 # compress the resulting patch file. If this is not a patch just compress the
204 # uncompressed archive file. 213 # uncompressed archive file.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.') 338 help='How setup.exe should be included {COMPRESSED|DIFF|FULL}.')
330 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF', 339 option_parser.add_option('-a', '--diff_algorithm', default='BSDIFF',
331 help='Diff algorithm to use when generating differential patches ' + 340 help='Diff algorithm to use when generating differential patches ' +
332 '{BSDIFF|COURGETTE}.') 341 '{BSDIFF|COURGETTE}.')
333 option_parser.add_option('-n', '--output_name', default='chrome', 342 option_parser.add_option('-n', '--output_name', default='chrome',
334 help='Name used to prefix names of generated archives.') 343 help='Name used to prefix names of generated archives.')
335 344
336 options, args = option_parser.parse_args() 345 options, args = option_parser.parse_args()
337 print sys.argv 346 print sys.argv
338 sys.exit(main(options)) 347 sys.exit(main(options))
OLDNEW
« no previous file with comments | « chrome/installer/util/lzma_util.cc ('k') | courgette/crc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698