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

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 4 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') | 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 will run on Debian Wheezy,
10 # the oldest supported linux distribution. For ARM64 linux, we have Debian 10 # the oldest supported linux distribution. For ARM64 linux, we have Debian
11 # Jessie sysroot as Jessie is the first version with ARM64 support. This script 11 # Jessie sysroot as Jessie is the first version with ARM64 support. This script
Tom (Use chromium acct) 2016/12/12 17:52:15 Please update these paragraphs
Sam Clegg 2016/12/20 21:40:21 Done.
12 # can be run manually but is more often run as part of gclient hooks. When run 12 # can be run manually but is more often run as part of gclient hooks. When run
13 # 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 14
15 # The sysroot image could be constructed from scratch based on the current 15 # 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 16 # state or Debian Wheezy/Jessie but for consistency we currently use a
17 # pre-built root image. The image will normally need to be rebuilt every time 17 # pre-built root image. The image will normally need to be rebuilt every time
18 # chrome's build dependencies are changed. 18 # chrome's build dependencies are changed.
19 19
20 import hashlib 20 import hashlib
21 import platform 21 import platform
22 import optparse 22 import optparse
23 import os 23 import os
24 import re 24 import re
25 import shutil 25 import shutil
26 import subprocess 26 import subprocess
27 import sys 27 import sys
28 import urllib2 28 import urllib2
29 29
30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
31 sys.path.append(os.path.dirname(os.path.dirname(SCRIPT_DIR))) 31 sys.path.append(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
32 import detect_host_arch 32 import detect_host_arch
33 import gyp_chromium 33 import gyp_chromium
34 import gyp_environment 34 import gyp_environment
35 35
36 36
37 URL_PREFIX = 'https://commondatastorage.googleapis.com' 37 URL_PREFIX = 'https://commondatastorage.googleapis.com'
38 URL_PATH = 'chrome-linux-sysroot/toolchain' 38 URL_PATH = 'chrome-linux-sysroot/toolchain'
39 39
40 SYSROOTS = { 40 SYSROOTS = {
41 ('Wheezy', 'amd64'): { 41 ('Jessie', 'amd64'): {
42 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02', 42 'Revision' : '9f61b42c2dffb6122926aaa27cd9aeb5739140d3',
43 'Tarball' : 'debian_wheezy_amd64_sysroot.tgz', 43 'Tarball' : 'debian_jessie_amd64_sysroot.tgz',
44 'Sha1Sum' : 'cc43f16c817fbb8c525405363ece863347210a30', 44 'Sha1Sum' : 'e025b5e60c129dc424edb3a74874fe289cfc216e',
45 'SysrootDir' : 'debian_wheezy_amd64-sysroot' 45 'SysrootDir' : 'debian_jessie_amd64-sysroot'
46 }, 46 },
47 ('Wheezy', 'arm'): { 47 ('Jessie', 'arm'): {
48 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02', 48 'Revision' : '9f61b42c2dffb6122926aaa27cd9aeb5739140d3',
49 'Tarball' : 'debian_wheezy_arm_sysroot.tgz', 49 'Tarball' : 'debian_jessie_arm_sysroot.tgz',
50 'Sha1Sum' : 'c09ac9576642d81209f25cde19a64f427b5fbaf8', 50 'Sha1Sum' : '53b8c516cfffa0ee8ec3a6eb14260dcae26dc4cd',
51 'SysrootDir' : 'debian_wheezy_arm-sysroot' 51 'SysrootDir' : 'debian_jessie_arm-sysroot'
52 }, 52 },
53 ('Wheezy', 'i386'): { 53 ('Jessie', 'i386'): {
54 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02', 54 'Revision' : '9f61b42c2dffb6122926aaa27cd9aeb5739140d3',
55 'Tarball' : 'debian_wheezy_i386_sysroot.tgz', 55 'Tarball' : 'debian_jessie_i386_sysroot.tgz',
56 'Sha1Sum' : '1b28326d17094b9d3616579b988eb5554c3dc9f8', 56 'Sha1Sum' : '3a2277b561a6348fcf4fc17abd1ccc44e8eac77f',
57 'SysrootDir' : 'debian_wheezy_i386-sysroot' 57 'SysrootDir' : 'debian_jessie_i386-sysroot'
58 }, 58 },
59 ('Wheezy', 'mips'): { 59 ('Jessie', 'mips'): {
60 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02', 60 'Revision' : '9f61b42c2dffb6122926aaa27cd9aeb5739140d3',
61 'Tarball' : 'debian_wheezy_mips_sysroot.tgz', 61 'Tarball' : 'debian_jessie_mips_sysroot.tgz',
62 'Sha1Sum' : 'c0948a2c955588079dc31d688e8105730744ef45', 62 'Sha1Sum' : '11ccc3ee056f185d8f1f9b0d41822fbd9f4c4013',
63 'SysrootDir' : 'debian_wheezy_mips-sysroot' 63 'SysrootDir' : 'debian_jessie_mips-sysroot'
64 }, 64 },
65 ('Jessie', 'arm64'): { 65 ('Jessie', 'arm64'): {
66 'Revision' : '5735a5e9605d549acb6495e1fb65384a54fe0a48', 66 'Revision' : '9f61b42c2dffb6122926aaa27cd9aeb5739140d3',
67 'Tarball' : 'debian_jessie_arm64_sysroot.tgz', 67 'Tarball' : 'debian_jessie_arm64_sysroot.tgz',
68 'Sha1Sum' : '82ebae900d0aadd52cf76a8e7cdb6a782df6ef28', 68 'Sha1Sum' : '8c9656da2017b45b7890b1ab10894ff686cf0517',
69 'SysrootDir' : 'debian_jessie_arm64-sysroot' 69 'SysrootDir' : 'debian_jessie_arm64-sysroot'
70 }, 70 },
71 ('Precise', 'amd64'): { 71 ('Precise', 'amd64'): {
72 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02', 72 'Revision' : '7d200a1ddfeb50dbf9f7e2c1c4ff1080679edf02',
73 'Tarball' : 'ubuntu_precise_amd64_sysroot.tgz', 73 'Tarball' : 'ubuntu_precise_amd64_sysroot.tgz',
74 'Sha1Sum' : 'fdf81c55a0c6decd44f07781ebf163f97deb26cc', 74 'Sha1Sum' : 'fdf81c55a0c6decd44f07781ebf163f97deb26cc',
75 'SysrootDir' : 'ubuntu_precise_amd64-sysroot' 75 'SysrootDir' : 'ubuntu_precise_amd64-sysroot'
76 } 76 }
77 } 77 }
78 78
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 InstallDefaultSysrootForArch(target_arch) 174 InstallDefaultSysrootForArch(target_arch)
175 175
176 176
177 def main(args): 177 def main(args):
178 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) 178 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
179 parser.add_option('--running-as-hook', action='store_true', 179 parser.add_option('--running-as-hook', action='store_true',
180 default=False, help='Used when running from gclient hooks.' 180 default=False, help='Used when running from gclient hooks.'
181 ' Installs default sysroot images.') 181 ' Installs default sysroot images.')
182 parser.add_option('--arch', type='choice', choices=valid_archs, 182 parser.add_option('--arch', type='choice', choices=valid_archs,
183 help='Sysroot architecture: %s' % ', '.join(valid_archs)) 183 help='Sysroot architecture: %s' % ', '.join(valid_archs))
184 parser.add_option('--all', action='store_true',
185 help='Install all sysroot images (useful when updating the'
186 ' images)')
184 options, _ = parser.parse_args(args) 187 options, _ = parser.parse_args(args)
185 if options.running_as_hook and not sys.platform.startswith('linux'): 188 if options.running_as_hook and not sys.platform.startswith('linux'):
186 return 0 189 return 0
187 190
188 if options.running_as_hook: 191 if options.running_as_hook:
189 host_arch = DetectHostArch() 192 host_arch = DetectHostArch()
190 # PPC/s390 don't use sysroot, see http://crbug.com/646169 193 # PPC/s390 don't use sysroot, see http://crbug.com/646169
191 if host_arch in ['ppc','s390']: 194 if host_arch in ['ppc','s390']:
192 return 0 195 return 0
193 InstallDefaultSysroots(host_arch) 196 InstallDefaultSysroots(host_arch)
194 else: 197 else:
195 if not options.arch: 198 if options.arch:
199 InstallDefaultSysrootForArch(options.arch)
200 elif options.all:
201 for arch in valid_archs:
202 InstallDefaultSysrootForArch(arch)
203 else:
196 print 'You much specify either --arch or --running-as-hook' 204 print 'You much specify either --arch or --running-as-hook'
197 return 1 205 return 1
198 InstallDefaultSysrootForArch(options.arch)
199 206
200 return 0 207 return 0
201 208
202 def InstallDefaultSysrootForArch(target_arch): 209 def InstallDefaultSysrootForArch(target_arch):
203 if target_arch == 'amd64': 210 if target_arch == 'amd64':
204 InstallSysroot('Wheezy', 'amd64') 211 InstallSysroot('Jessie', 'amd64')
205 elif target_arch == 'arm': 212 elif target_arch == 'arm':
206 InstallSysroot('Wheezy', 'arm') 213 InstallSysroot('Jessie', 'arm')
207 elif target_arch == 'arm64': 214 elif target_arch == 'arm64':
208 InstallSysroot('Jessie', 'arm64') 215 InstallSysroot('Jessie', 'arm64')
209 elif target_arch == 'i386': 216 elif target_arch == 'i386':
210 InstallSysroot('Wheezy', 'i386') 217 InstallSysroot('Jessie', 'i386')
211 elif target_arch == 'mips': 218 elif target_arch == 'mips':
212 InstallSysroot('Wheezy', 'mips') 219 InstallSysroot('Jessie', 'mips')
213 else: 220 else:
214 raise Error('Unknown architecture: %s' % target_arch) 221 raise Error('Unknown architecture: %s' % target_arch)
215 222
216 def InstallSysroot(target_platform, target_arch): 223 def InstallSysroot(target_platform, target_arch):
217 # The sysroot directory should match the one specified in build/common.gypi. 224 # The sysroot directory should match the one specified in build/common.gypi.
218 # TODO(thestig) Consider putting this else where to avoid having to recreate 225 # TODO(thestig) Consider putting this else where to avoid having to recreate
219 # it on every build. 226 # it on every build.
220 linux_dir = os.path.dirname(SCRIPT_DIR) 227 linux_dir = os.path.dirname(SCRIPT_DIR)
221 228
222 if (target_platform, target_arch) not in SYSROOTS: 229 if (target_platform, target_arch) not in SYSROOTS:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 with open(stamp, 'w') as s: 273 with open(stamp, 'w') as s:
267 s.write(url) 274 s.write(url)
268 275
269 276
270 if __name__ == '__main__': 277 if __name__ == '__main__':
271 try: 278 try:
272 sys.exit(main(sys.argv[1:])) 279 sys.exit(main(sys.argv[1:]))
273 except Error as e: 280 except Error as e:
274 sys.stderr.write(str(e) + '\n') 281 sys.stderr.write(str(e) + '\n')
275 sys.exit(1) 282 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