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

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

Issue 9701050: Make setup.exe compatible with the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: <fixed greg='happy as can be'/> Created 8 years, 7 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 | « chrome/installer/setup/install_worker.cc ('k') | no next file » | 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 'archive_file': archive_file, 305 'archive_file': archive_file,
306 'archive_file_path': 306 'archive_file_path':
307 os.path.join(output_dir, archive_file).replace("\\","/"), 307 os.path.join(output_dir, archive_file).replace("\\","/"),
308 } 308 }
309 resource_file = _RESOURCE_FILE_TEMPLATE % args 309 resource_file = _RESOURCE_FILE_TEMPLATE % args
310 310
311 with open(resource_file_path, 'w') as f: 311 with open(resource_file_path, 'w') as f:
312 f.write(resource_file) 312 f.write(resource_file)
313 313
314 314
315 def DoComponentBuildTasks(staging_dir, build_dir, current_version):
316 # Copy all the DLLs in |build_dir| to the version directory.
317 chrome_dir = os.path.join(staging_dir, CHROME_DIR)
318 version_dir = os.path.join(chrome_dir, current_version)
319 dlls = glob.glob(os.path.join(build_dir, '*.dll'))
320 for dll in dlls:
321 shutil.copy(dll, version_dir)
322
323 # Write chrome.exe.config to point to the version directory.
324 chrome_exe_config = (
325 "<configuration>\n"
326 " <windows>\n"
327 " <assemblyBinding xmlns='urn:schemas-microsoft-com:asm.v1'>\n"
328 " <probing privatePath='{version}'/>\n"
329 " </assemblyBinding>\n"
330 " </windows>\n"
331 "</configuration>".format(version = current_version))
robertshield 2012/05/09 21:42:41 no spaces around '=', consider using %
gab 2012/05/10 00:12:55 Done.
332
333 chrome_exe_config_file = open(
334 os.path.join(chrome_dir, 'chrome.exe.config'), 'w')
335 chrome_exe_config_file.write(chrome_exe_config)
336 chrome_exe_config_file.close()
337
338 # Build a list containing the name of each DLL found in |build_dir|
339 dll_names = []
340 for dll in dlls:
341 dll_names.append(os.path.splitext(os.path.basename(dll))[0])
342
343 # Write chrome.exe.manifest in which we list all the DLLs as side by side
344 # assembly dependencies.
345 chrome_exe_manifest_parts = [
346 "<assembly\n"
347 " xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\n"
348 " <assemblyIdentity\n"
349 " name='chrome.chromeexe' version='0.0.0.0' type='win32'/>\n"]
350
351 for name in dll_names:
352 chrome_exe_manifest_parts.append(
353 " <dependency>\n"
354 " <dependentAssembly>\n"
355 " <assemblyIdentity type='win32' name='chrome.{dll_basename}'\n"
356 " version='0.0.0.0' processorArchitecture='x86'\n"
357 " language='*'/>\n"
358 " </dependentAssembly>\n"
359 " </dependency>\n".format(dll_basename = name))
robertshield 2012/05/09 21:42:41 python style states that there are no spaces aroun
gab 2012/05/10 00:12:55 Done.
360
361 chrome_exe_manifest_parts.append("</assembly>")
362
363 chrome_exe_manifest_file = open(
364 os.path.join(chrome_dir, 'chrome.exe.manifest'), 'w')
365 chrome_exe_manifest_file.write(''.join(chrome_exe_manifest_parts))
366 chrome_exe_manifest_file.close()
367
368 # Write chrome.{dllname}.manifest in the version directory for each DLL list
369 # as a dependency in the previous step.
370 for name in dll_names:
371 dll_manifest = (
372 "<assembly\n"
373 " xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\n"
374 " <assemblyIdentity name='chrome.{dll_basename}' version='0.0.0.0'\n"
375 " type='win32' processorArchitecture='x86'/>\n"
376 " <file name='{dll_basename}.dll'/>\n"
377 "</assembly>".format(dll_basename = name))
robertshield 2012/05/09 21:42:41 no spaces around '=', consider using %
gab 2012/05/10 00:12:55 Done.
378
379 dll_manifest_file = open(os.path.join(
380 version_dir,
381 "chrome.{dll_basename}.manifest".format(dll_basename = name)), 'w')
robertshield 2012/05/09 21:42:41 no spaces around '=', consider using %, like so:
gab 2012/05/10 00:12:55 Done.
382 dll_manifest_file.write(dll_manifest)
383 dll_manifest_file.close()
384
385
315 def main(options): 386 def main(options):
316 """Main method that reads input file, creates archive file and write 387 """Main method that reads input file, creates archive file and write
317 resource input file. 388 resource input file.
318 """ 389 """
319 current_version = BuildVersion(options.build_dir) 390 current_version = BuildVersion(options.build_dir)
320 391
321 config = Readconfig(options.build_dir, options.input_file, current_version) 392 config = Readconfig(options.build_dir, options.input_file, current_version)
322 393
323 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir) 394 (staging_dir, temp_dir) = MakeStagingDirectories(options.staging_dir)
324 395
325 prev_version = GetPrevVersion(options.build_dir, temp_dir, 396 prev_version = GetPrevVersion(options.build_dir, temp_dir,
326 options.last_chrome_installer) 397 options.last_chrome_installer)
327 398
328 # Preferentially copy the files we can find from the output_dir, as 399 # Preferentially copy the files we can find from the output_dir, as
329 # this is where we'll find the Syzygy-optimized executables when 400 # this is where we'll find the Syzygy-optimized executables when
330 # building the optimized mini_installer. 401 # building the optimized mini_installer.
331 if options.build_dir != options.output_dir: 402 if options.build_dir != options.output_dir:
332 CopyAllFilesToStagingDir(config, options.distribution, 403 CopyAllFilesToStagingDir(config, options.distribution,
333 staging_dir, options.output_dir, 404 staging_dir, options.output_dir,
334 options.enable_hidpi, options.enable_metro) 405 options.enable_hidpi, options.enable_metro)
335 406
336 # Now copy the remainder of the files from the build dir. 407 # Now copy the remainder of the files from the build dir.
337 CopyAllFilesToStagingDir(config, options.distribution, 408 CopyAllFilesToStagingDir(config, options.distribution,
338 staging_dir, options.build_dir, 409 staging_dir, options.build_dir,
339 options.enable_hidpi, options.enable_metro) 410 options.enable_hidpi, options.enable_metro)
340 411
412 if options.component_build == '1':
413 DoComponentBuildTasks(staging_dir, options.build_dir, current_version)
414
341 version_numbers = current_version.split('.') 415 version_numbers = current_version.split('.')
342 current_build_number = version_numbers[2] + '.' + version_numbers[3] 416 current_build_number = version_numbers[2] + '.' + version_numbers[3]
343 prev_build_number = '' 417 prev_build_number = ''
344 if prev_version: 418 if prev_version:
345 version_numbers = prev_version.split('.') 419 version_numbers = prev_version.split('.')
346 prev_build_number = version_numbers[2] + '.' + version_numbers[3] 420 prev_build_number = version_numbers[2] + '.' + version_numbers[3]
347 421
348 # Name of the archive file built (for example - chrome.7z or 422 # Name of the archive file built (for example - chrome.7z or
349 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z 423 # patch-<old_version>-<new_version>.7z or patch-<new_version>.7z
350 archive_file = CreateArchiveFile(options, staging_dir, 424 archive_file = CreateArchiveFile(options, staging_dir,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 parser.add_option('-a', '--diff_algorithm', default='BSDIFF', 460 parser.add_option('-a', '--diff_algorithm', default='BSDIFF',
387 help='Diff algorithm to use when generating differential patches ' 461 help='Diff algorithm to use when generating differential patches '
388 '{BSDIFF|COURGETTE}.') 462 '{BSDIFF|COURGETTE}.')
389 parser.add_option('-n', '--output_name', default='chrome', 463 parser.add_option('-n', '--output_name', default='chrome',
390 help='Name used to prefix names of generated archives.') 464 help='Name used to prefix names of generated archives.')
391 parser.add_option('--enable_hidpi', default='0', 465 parser.add_option('--enable_hidpi', default='0',
392 help='Whether to include HiDPI resource files.') 466 help='Whether to include HiDPI resource files.')
393 parser.add_option('--enable_metro', default='0', 467 parser.add_option('--enable_metro', default='0',
394 help='Whether to include resource files from the "METRO" section of the ' 468 help='Whether to include resource files from the "METRO" section of the '
395 'input file.') 469 'input file.')
470 parser.add_option('--component_build', default='0',
471 help='Whether this archive is packaging a component build.')
396 472
397 options, args = parser.parse_args() 473 options, args = parser.parse_args()
398 if not options.build_dir: 474 if not options.build_dir:
399 parser.error('You must provide a build dir.') 475 parser.error('You must provide a build dir.')
400 476
401 if not options.staging_dir: 477 if not options.staging_dir:
402 parser.error('You must provide a staging dir.') 478 parser.error('You must provide a staging dir.')
403 479
480 if not options.input_file:
481 parser.error('You must provide an input file')
482
404 if not options.output_dir: 483 if not options.output_dir:
405 options.output_dir = options.build_dir 484 options.output_dir = options.build_dir
406 485
407 if not options.resource_file_path: 486 if not options.resource_file_path:
408 options.options.resource_file_path = os.path.join(options.build_dir, 487 options.resource_file_path = os.path.join(options.build_dir,
409 MINI_INSTALLER_INPUT_FILE) 488 MINI_INSTALLER_INPUT_FILE)
410 489
411 return options 490 return options
412 491
413 492
414 if '__main__' == __name__: 493 if '__main__' == __name__:
415 print sys.argv 494 print sys.argv
416 sys.exit(main(_ParseOptions())) 495 sys.exit(main(_ParseOptions()))
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698