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

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

Issue 2361223002: Update linux sysroot images from debian/wheezy to debian/jessie (Closed)
Patch Set: . Created 3 years, 9 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 | « build/config/sysroot.gni ('k') | tools/checklicenses/checklicenses.py » ('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/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 """Install Debian sysroots for building chromium. 6 """Install Debian sysroots for building chromium.
7 """ 7 """
8 8
9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy, 9 # The sysroot is needed to ensure that binaries that get built will run on
10 # the oldest supported linux distribution. For ARM64 linux, we have Debian 10 # the oldest stable version of Debian that we currently support.
11 # Jessie sysroot as Jessie is the first version with ARM64 support. This script 11 # This script can be run manually but is more often run as part of gclient
12 # can be run manually but is more often run as part of gclient hooks. When run 12 # hooks. When run from hooks this script is a no-op on non-linux platforms.
13 # from hooks this script is a no-op on non-linux platforms.
14 13
15 # The sysroot image could be constructed from scratch based on the current 14 # The sysroot image could be constructed from scratch based on the current state
16 # state or Debian Wheezy/Jessie but for consistency we currently use a 15 # of the Debian archive but for consistency we use a pre-built root image (we
17 # pre-built root image. The image will normally need to be rebuilt every time 16 # don't want upstream changes to Debian to effect the chromium build until we
18 # chrome's build dependencies are changed. 17 # choose to pull them in). The images will normally need to be rebuilt every
18 # time chrome's build dependencies are changed but should also be updated
19 # periodically to include upstream security fixes from Debian.
19 20
20 import hashlib 21 import hashlib
21 import json 22 import json
22 import platform 23 import platform
23 import optparse 24 import optparse
24 import os 25 import os
25 import re 26 import re
26 import shutil 27 import shutil
27 import subprocess 28 import subprocess
28 import sys 29 import sys
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 InstallSysroot('Jessie', 'amd64') 144 InstallSysroot('Jessie', 'amd64')
144 145
145 146
146 def main(args): 147 def main(args):
147 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) 148 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
148 parser.add_option('--running-as-hook', action='store_true', 149 parser.add_option('--running-as-hook', action='store_true',
149 default=False, help='Used when running from gclient hooks.' 150 default=False, help='Used when running from gclient hooks.'
150 ' Installs default sysroot images.') 151 ' Installs default sysroot images.')
151 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, 152 parser.add_option('--arch', type='choice', choices=VALID_ARCHS,
152 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) 153 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS))
154 parser.add_option('--all', action='store_true',
155 help='Install all sysroot images (useful when updating the'
156 ' images)')
153 options, _ = parser.parse_args(args) 157 options, _ = parser.parse_args(args)
154 if options.running_as_hook and not sys.platform.startswith('linux'): 158 if options.running_as_hook and not sys.platform.startswith('linux'):
155 return 0 159 return 0
156 160
157 if options.running_as_hook: 161 if options.running_as_hook:
158 host_arch = DetectHostArch() 162 host_arch = DetectHostArch()
159 # PPC/s390 don't use sysroot, see http://crbug.com/646169 163 # PPC/s390 don't use sysroot, see http://crbug.com/646169
160 if host_arch in ['ppc','s390']: 164 if host_arch in ['ppc','s390']:
161 return 0 165 return 0
162 InstallDefaultSysroots(host_arch) 166 InstallDefaultSysroots(host_arch)
167 elif options.arch:
168 InstallDefaultSysrootForArch(options.arch)
169 elif options.all:
170 for arch in VALID_ARCHS:
171 InstallDefaultSysrootForArch(arch)
163 else: 172 else:
164 if not options.arch: 173 print 'You much specify either --arch, --all or --running-as-hook'
165 print 'You much specify either --arch or --running-as-hook' 174 return 1
166 return 1
167 InstallDefaultSysrootForArch(options.arch)
168 175
169 return 0 176 return 0
170 177
171 def InstallDefaultSysrootForArch(target_arch): 178 def InstallDefaultSysrootForArch(target_arch):
172 if target_arch == 'amd64': 179 if target_arch == 'amd64':
Lei Zhang 2017/03/11 01:17:27 You can write this as: if target_arch not in VALI
Sam Clegg 2017/03/13 16:43:16 Done.
173 InstallSysroot('Wheezy', 'amd64') 180 InstallSysroot('Jessie', 'amd64')
174 elif target_arch == 'arm': 181 elif target_arch == 'arm':
175 InstallSysroot('Wheezy', 'arm') 182 InstallSysroot('Jessie', 'arm')
176 elif target_arch == 'arm64': 183 elif target_arch == 'arm64':
177 InstallSysroot('Jessie', 'arm64') 184 InstallSysroot('Jessie', 'arm64')
178 elif target_arch == 'i386': 185 elif target_arch == 'i386':
179 InstallSysroot('Wheezy', 'i386') 186 InstallSysroot('Jessie', 'i386')
180 elif target_arch == 'mips': 187 elif target_arch == 'mips':
181 InstallSysroot('Wheezy', 'mips') 188 InstallSysroot('Jessie', 'mips')
182 else: 189 else:
183 raise Error('Unknown architecture: %s' % target_arch) 190 raise Error('Unknown architecture: %s' % target_arch)
184 191
185 def InstallSysroot(target_platform, target_arch): 192 def InstallSysroot(target_platform, target_arch):
186 # The sysroot directory should match the one specified in build/common.gypi. 193 # The sysroot directory should match the one specified in build/common.gypi.
187 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate 194 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate
188 # it on every build. 195 # it on every build.
189 linux_dir = os.path.dirname(SCRIPT_DIR) 196 linux_dir = os.path.dirname(SCRIPT_DIR)
190 197
191 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json') 198 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json')
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 with open(stamp, 'w') as s: 245 with open(stamp, 'w') as s:
239 s.write(url) 246 s.write(url)
240 247
241 248
242 if __name__ == '__main__': 249 if __name__ == '__main__':
243 try: 250 try:
244 sys.exit(main(sys.argv[1:])) 251 sys.exit(main(sys.argv[1:]))
245 except Error as e: 252 except Error as e:
246 sys.stderr.write(str(e) + '\n') 253 sys.stderr.write(str(e) + '\n')
247 sys.exit(1) 254 sys.exit(1)
OLDNEW
« no previous file with comments | « build/config/sysroot.gni ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698