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

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

Issue 2776773002: Reland of "Update linux sysroot from Wheezy to Jessie" (Closed)
Patch Set: revert expected_deps_x64_jessie change 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') | chrome/installer/linux/debian/expected_deps_ia32_jessie » ('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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 # available. 128 # available.
128 InstallSysroot('Precise', 'amd64') 129 InstallSysroot('Precise', 'amd64')
129 130
130 # If we can detect a non-standard target_arch such as ARM or MIPS, 131 # If we can detect a non-standard target_arch such as ARM or MIPS,
131 # then install the sysroot too. Don't attempt to install arm64 132 # then install the sysroot too. Don't attempt to install arm64
132 # since this is currently and android-only architecture. 133 # since this is currently and android-only architecture.
133 target_arch = DetectTargetArch() 134 target_arch = DetectTargetArch()
134 if target_arch and target_arch not in (host_arch, 'i386'): 135 if target_arch and target_arch not in (host_arch, 'i386'):
135 InstallDefaultSysrootForArch(target_arch) 136 InstallDefaultSysrootForArch(target_arch)
136 137
137 # Desktop Linux ozone builds require libxkbcommon* which is not
138 # available in Wheezy.
139 # TODO(thomasanderson): Remove this once the Jessie sysroot is used
140 # by default.
141 gyp_defines = gyp_chromium.GetGypVars(gyp_chromium.GetSupplementalFiles())
142 if gyp_defines.get('use_ozone') == '1':
143 InstallSysroot('Jessie', 'amd64')
144
145 138
146 def main(args): 139 def main(args):
147 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) 140 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
148 parser.add_option('--running-as-hook', action='store_true', 141 parser.add_option('--running-as-hook', action='store_true',
149 default=False, help='Used when running from gclient hooks.' 142 default=False, help='Used when running from gclient hooks.'
150 ' Installs default sysroot images.') 143 ' Installs default sysroot images.')
151 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, 144 parser.add_option('--arch', type='choice', choices=VALID_ARCHS,
152 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) 145 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS))
146 parser.add_option('--all', action='store_true',
147 help='Install all sysroot images (useful when updating the'
148 ' images)')
153 options, _ = parser.parse_args(args) 149 options, _ = parser.parse_args(args)
154 if options.running_as_hook and not sys.platform.startswith('linux'): 150 if options.running_as_hook and not sys.platform.startswith('linux'):
155 return 0 151 return 0
156 152
157 if options.running_as_hook: 153 if options.running_as_hook:
158 host_arch = DetectHostArch() 154 host_arch = DetectHostArch()
159 # PPC/s390 don't use sysroot, see http://crbug.com/646169 155 # PPC/s390 don't use sysroot, see http://crbug.com/646169
160 if host_arch in ['ppc','s390']: 156 if host_arch in ['ppc','s390']:
161 return 0 157 return 0
162 InstallDefaultSysroots(host_arch) 158 InstallDefaultSysroots(host_arch)
159 elif options.arch:
160 InstallDefaultSysrootForArch(options.arch)
161 elif options.all:
162 for arch in VALID_ARCHS:
163 InstallDefaultSysrootForArch(arch)
163 else: 164 else:
164 if not options.arch: 165 print 'You much specify either --arch, --all or --running-as-hook'
165 print 'You much specify either --arch or --running-as-hook' 166 return 1
166 return 1
167 InstallDefaultSysrootForArch(options.arch)
168 167
169 return 0 168 return 0
170 169
170
171 def InstallDefaultSysrootForArch(target_arch): 171 def InstallDefaultSysrootForArch(target_arch):
172 if target_arch == 'amd64': 172 if target_arch not in VALID_ARCHS:
173 InstallSysroot('Wheezy', 'amd64')
174 elif target_arch == 'arm':
175 InstallSysroot('Wheezy', 'arm')
176 elif target_arch == 'arm64':
177 InstallSysroot('Jessie', 'arm64')
178 elif target_arch == 'i386':
179 InstallSysroot('Wheezy', 'i386')
180 elif target_arch == 'mips':
181 InstallSysroot('Wheezy', 'mips')
182 else:
183 raise Error('Unknown architecture: %s' % target_arch) 173 raise Error('Unknown architecture: %s' % target_arch)
174 InstallSysroot('Jessie', target_arch)
175
184 176
185 def InstallSysroot(target_platform, target_arch): 177 def InstallSysroot(target_platform, target_arch):
186 # The sysroot directory should match the one specified in build/common.gypi. 178 # The sysroot directory should match the one specified in build/common.gypi.
187 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate 179 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate
188 # it on every build. 180 # it on every build.
189 linux_dir = os.path.dirname(SCRIPT_DIR) 181 linux_dir = os.path.dirname(SCRIPT_DIR)
190 182
191 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json') 183 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json')
192 sysroots = json.load(open(sysroots_file)) 184 sysroots = json.load(open(sysroots_file))
193 sysroot_key = '%s_%s' % (target_platform.lower(), target_arch) 185 sysroot_key = '%s_%s' % (target_platform.lower(), target_arch)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 with open(stamp, 'w') as s: 230 with open(stamp, 'w') as s:
239 s.write(url) 231 s.write(url)
240 232
241 233
242 if __name__ == '__main__': 234 if __name__ == '__main__':
243 try: 235 try:
244 sys.exit(main(sys.argv[1:])) 236 sys.exit(main(sys.argv[1:]))
245 except Error as e: 237 except Error as e:
246 sys.stderr.write(str(e) + '\n') 238 sys.stderr.write(str(e) + '\n')
247 sys.exit(1) 239 sys.exit(1)
OLDNEW
« no previous file with comments | « build/config/sysroot.gni ('k') | chrome/installer/linux/debian/expected_deps_ia32_jessie » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698