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

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
16 # state or Debian Wheezy/Jessie but for consistency we currently use a 15 # state of the Debian archived but for consistency we currently use a
Dirk Pranke 2017/03/07 00:21:04 Nit: "archived"?
Sam Clegg 2017/03/07 14:48:52 Done.
17 # pre-built root image. The image will normally need to be rebuilt every time 16 # pre-built root image (we don't want upstream changes to Debian to effect
18 # chrome's build dependencies are changed. 17 # the chromium build until we choose to pull them in). The images will normally
18 # need to be rebuilt every time chrome's build dependencies are changed but
19 # should also be updated periodically to include upstream security fixed from
Dirk Pranke 2017/03/07 00:21:04 Nit: s/fixed/fixes
Sam Clegg 2017/03/07 14:48:52 Done.
20 # Debian.
19 21
20 import hashlib 22 import hashlib
21 import json 23 import json
22 import platform 24 import platform
23 import optparse 25 import optparse
24 import os 26 import os
25 import re 27 import re
26 import shutil 28 import shutil
27 import subprocess 29 import subprocess
28 import sys 30 import sys
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 InstallSysroot('Jessie', 'amd64') 145 InstallSysroot('Jessie', 'amd64')
144 146
145 147
146 def main(args): 148 def main(args):
147 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) 149 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
148 parser.add_option('--running-as-hook', action='store_true', 150 parser.add_option('--running-as-hook', action='store_true',
149 default=False, help='Used when running from gclient hooks.' 151 default=False, help='Used when running from gclient hooks.'
150 ' Installs default sysroot images.') 152 ' Installs default sysroot images.')
151 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, 153 parser.add_option('--arch', type='choice', choices=VALID_ARCHS,
152 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) 154 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS))
155 parser.add_option('--all', action='store_true',
156 help='Install all sysroot images (useful when updating the'
157 ' images)')
153 options, _ = parser.parse_args(args) 158 options, _ = parser.parse_args(args)
154 if options.running_as_hook and not sys.platform.startswith('linux'): 159 if options.running_as_hook and not sys.platform.startswith('linux'):
155 return 0 160 return 0
156 161
157 if options.running_as_hook: 162 if options.running_as_hook:
158 host_arch = DetectHostArch() 163 host_arch = DetectHostArch()
159 # PPC/s390 don't use sysroot, see http://crbug.com/646169 164 # PPC/s390 don't use sysroot, see http://crbug.com/646169
160 if host_arch in ['ppc','s390']: 165 if host_arch in ['ppc','s390']:
161 return 0 166 return 0
162 InstallDefaultSysroots(host_arch) 167 InstallDefaultSysroots(host_arch)
163 else: 168 else:
164 if not options.arch: 169 if options.arch:
170 InstallDefaultSysrootForArch(options.arch)
171 elif options.all:
172 for arch in VALID_ARCHS:
173 InstallDefaultSysrootForArch(arch)
174 else:
Dirk Pranke 2017/03/07 00:21:04 Nit: you can actually change line 168 to an elif a
Sam Clegg 2017/03/07 14:48:52 Done.
165 print 'You much specify either --arch or --running-as-hook' 175 print 'You much specify either --arch or --running-as-hook'
166 return 1 176 return 1
167 InstallDefaultSysrootForArch(options.arch)
168 177
169 return 0 178 return 0
170 179
171 def InstallDefaultSysrootForArch(target_arch): 180 def InstallDefaultSysrootForArch(target_arch):
172 if target_arch == 'amd64': 181 if target_arch == 'amd64':
173 InstallSysroot('Wheezy', 'amd64') 182 InstallSysroot('Jessie', 'amd64')
174 elif target_arch == 'arm': 183 elif target_arch == 'arm':
175 InstallSysroot('Wheezy', 'arm') 184 InstallSysroot('Jessie', 'arm')
176 elif target_arch == 'arm64': 185 elif target_arch == 'arm64':
177 InstallSysroot('Jessie', 'arm64') 186 InstallSysroot('Jessie', 'arm64')
178 elif target_arch == 'i386': 187 elif target_arch == 'i386':
179 InstallSysroot('Wheezy', 'i386') 188 InstallSysroot('Jessie', 'i386')
180 elif target_arch == 'mips': 189 elif target_arch == 'mips':
181 InstallSysroot('Wheezy', 'mips') 190 InstallSysroot('Jessie', 'mips')
182 else: 191 else:
183 raise Error('Unknown architecture: %s' % target_arch) 192 raise Error('Unknown architecture: %s' % target_arch)
184 193
185 def InstallSysroot(target_platform, target_arch): 194 def InstallSysroot(target_platform, target_arch):
186 # The sysroot directory should match the one specified in build/common.gypi. 195 # The sysroot directory should match the one specified in build/common.gypi.
187 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate 196 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate
188 # it on every build. 197 # it on every build.
189 linux_dir = os.path.dirname(SCRIPT_DIR) 198 linux_dir = os.path.dirname(SCRIPT_DIR)
190 199
191 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json') 200 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: 247 with open(stamp, 'w') as s:
239 s.write(url) 248 s.write(url)
240 249
241 250
242 if __name__ == '__main__': 251 if __name__ == '__main__':
243 try: 252 try:
244 sys.exit(main(sys.argv[1:])) 253 sys.exit(main(sys.argv[1:]))
245 except Error as e: 254 except Error as e:
246 sys.stderr.write(str(e) + '\n') 255 sys.stderr.write(str(e) + '\n')
247 sys.exit(1) 256 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