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

Side by Side Diff: build/linux/sysroot_scripts/install-sysroot.py

Issue 1493043002: GN: Add an assert that sysroot exists (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « build/config/sysroot.gni ('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) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 install a Debian Wheezy sysroot for making official Google Chrome 6 # Script to install a Debian Wheezy sysroot for making official Google Chrome
7 # Linux builds. 7 # Linux builds.
8 # The sysroot is needed to make Chrome work for Debian Wheezy. 8 # The sysroot is needed to make Chrome work for Debian Wheezy.
9 # This script can be run manually but is more often run as part of gclient 9 # This script can be run manually but is more often run as part of gclient
10 # hooks. When run from hooks this script should be a no-op on non-linux 10 # hooks. When run from hooks this script should be a no-op on non-linux
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TARBALL_MIPS = 'debian_wheezy_mips_sysroot.tgz' 43 TARBALL_MIPS = 'debian_wheezy_mips_sysroot.tgz'
44 TARBALL_AMD64_SHA1SUM = '546f211d47a6544994bb6f7cf9800c3a73a12d3a' 44 TARBALL_AMD64_SHA1SUM = '546f211d47a6544994bb6f7cf9800c3a73a12d3a'
45 TARBALL_ARM_SHA1SUM = '457ee7165526846a8bef08f64c58db994481f159' 45 TARBALL_ARM_SHA1SUM = '457ee7165526846a8bef08f64c58db994481f159'
46 TARBALL_I386_SHA1SUM = '8d00eb9e60009ec23e7cb47c6ecbcf85b319e09e' 46 TARBALL_I386_SHA1SUM = '8d00eb9e60009ec23e7cb47c6ecbcf85b319e09e'
47 TARBALL_MIPS_SHA1SUM = '358d8fe133575c41354fa7fe5d9c591d199f6033' 47 TARBALL_MIPS_SHA1SUM = '358d8fe133575c41354fa7fe5d9c591d199f6033'
48 SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' 48 SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot'
49 SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot' 49 SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot'
50 SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' 50 SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot'
51 SYSROOT_DIR_MIPS = 'debian_wheezy_mips-sysroot' 51 SYSROOT_DIR_MIPS = 'debian_wheezy_mips-sysroot'
52 52
53 valid_archs = ('arm', 'i386', 'amd64', 'mips') 53 ARCH_MAP = {
54 'x86': 'i386',
55 'x64': 'amd64'
56 }
57
58 valid_archs = ['arm', 'i386', 'amd64', 'mips'] + ARCH_MAP.keys()
Dirk Pranke 2015/12/02 22:55:44 why do we need to support both 'i386' and 'x86' ?
agrieve 2015/12/03 01:49:29 I didn't want to have to apply the mapping within
54 59
55 60
56 def GetSha1(filename): 61 def GetSha1(filename):
57 sha1 = hashlib.sha1() 62 sha1 = hashlib.sha1()
58 with open(filename, 'rb') as f: 63 with open(filename, 'rb') as f:
59 while True: 64 while True:
60 # Read in 1mb chunks, so it doesn't all have to be loaded into memory. 65 # Read in 1mb chunks, so it doesn't all have to be loaded into memory.
61 chunk = f.read(1024*1024) 66 chunk = f.read(1024*1024)
62 if not chunk: 67 if not chunk:
63 break 68 break
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 gyp_environment.SetEnvironment() 115 gyp_environment.SetEnvironment()
111 supplemental_includes = gyp_chromium.GetSupplementalFiles() 116 supplemental_includes = gyp_chromium.GetSupplementalFiles()
112 gyp_defines = gyp_chromium.GetGypVars(supplemental_includes) 117 gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
113 is_android = gyp_defines.get('OS') == 'android' 118 is_android = gyp_defines.get('OS') == 'android'
114 119
115 if (options.running_as_hook and (not is_android) and 120 if (options.running_as_hook and (not is_android) and
116 (gyp_defines.get('chromeos') or gyp_defines.get('use_sysroot') == '0')): 121 (gyp_defines.get('chromeos') or gyp_defines.get('use_sysroot') == '0')):
117 return 0 122 return 0
118 123
119 if options.arch: 124 if options.arch:
120 target_arch = options.arch 125 target_arch = ARCH_MAP.get(options.arch, options.arch)
121 else: 126 else:
122 target_arch = DetectArch(gyp_defines, is_android) 127 target_arch = DetectArch(gyp_defines, is_android)
123 if not target_arch: 128 if not target_arch:
124 print 'Unable to detect target architecture' 129 print 'Unable to detect target architecture'
125 return 1 130 return 1
126 131
127 if is_android: 132 if is_android:
128 # 32-bit Android builds require a 32-bit host sysroot for the v8 snapshot. 133 # 32-bit Android builds require a 32-bit host sysroot for the v8 snapshot.
129 if '64' not in target_arch: 134 if '64' not in target_arch:
130 ret = _InstallSysroot('i386') 135 ret = _InstallSysroot('i386')
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 parser = optparse.OptionParser('usage: %prog [OPTIONS]') 206 parser = optparse.OptionParser('usage: %prog [OPTIONS]')
202 parser.add_option('--running-as-hook', action='store_true', 207 parser.add_option('--running-as-hook', action='store_true',
203 default=False, help='Used when running from gclient hooks.' 208 default=False, help='Used when running from gclient hooks.'
204 ' In this mode the sysroot will only ' 209 ' In this mode the sysroot will only '
205 'be installed for official Linux ' 210 'be installed for official Linux '
206 'builds or ARM Linux builds') 211 'builds or ARM Linux builds')
207 parser.add_option('--arch', type='choice', choices=valid_archs, 212 parser.add_option('--arch', type='choice', choices=valid_archs,
208 help='Sysroot architecture: %s' % ', '.join(valid_archs)) 213 help='Sysroot architecture: %s' % ', '.join(valid_archs))
209 options, _ = parser.parse_args() 214 options, _ = parser.parse_args()
210 sys.exit(main()) 215 sys.exit(main())
OLDNEW
« no previous file with comments | « build/config/sysroot.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698