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

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

Issue 2772113002: Revert of "Update linux sysroot from Wheezy to 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') | 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 that get built will run on 9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy,
10 # the oldest stable version of Debian that we currently support. 10 # the oldest supported linux distribution. For ARM64 linux, we have Debian
11 # This script can be run manually but is more often run as part of gclient 11 # Jessie sysroot as Jessie is the first version with ARM64 support. This script
12 # hooks. When run from hooks this script is a no-op on non-linux platforms. 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 14
14 # The sysroot image could be constructed from scratch based on the current state 15 # The sysroot image could be constructed from scratch based on the current
15 # of the Debian archive but for consistency we use a pre-built root image (we 16 # state or Debian Wheezy/Jessie but for consistency we currently use a
16 # don't want upstream changes to Debian to effect the chromium build until we 17 # pre-built root image. The image will normally need to be rebuilt every time
17 # choose to pull them in). The images will normally need to be rebuilt every 18 # chrome's build dependencies are changed.
18 # time chrome's build dependencies are changed but should also be updated
19 # periodically to include upstream security fixes from Debian.
20 19
21 import hashlib 20 import hashlib
22 import json 21 import json
23 import platform 22 import platform
24 import optparse 23 import optparse
25 import os 24 import os
26 import re 25 import re
27 import shutil 26 import shutil
28 import subprocess 27 import subprocess
29 import sys 28 import sys
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 # available. 127 # available.
129 InstallSysroot('Precise', 'amd64') 128 InstallSysroot('Precise', 'amd64')
130 129
131 # If we can detect a non-standard target_arch such as ARM or MIPS, 130 # If we can detect a non-standard target_arch such as ARM or MIPS,
132 # then install the sysroot too. Don't attempt to install arm64 131 # then install the sysroot too. Don't attempt to install arm64
133 # since this is currently and android-only architecture. 132 # since this is currently and android-only architecture.
134 target_arch = DetectTargetArch() 133 target_arch = DetectTargetArch()
135 if target_arch and target_arch not in (host_arch, 'i386'): 134 if target_arch and target_arch not in (host_arch, 'i386'):
136 InstallDefaultSysrootForArch(target_arch) 135 InstallDefaultSysrootForArch(target_arch)
137 136
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
138 145
139 def main(args): 146 def main(args):
140 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) 147 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
141 parser.add_option('--running-as-hook', action='store_true', 148 parser.add_option('--running-as-hook', action='store_true',
142 default=False, help='Used when running from gclient hooks.' 149 default=False, help='Used when running from gclient hooks.'
143 ' Installs default sysroot images.') 150 ' Installs default sysroot images.')
144 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, 151 parser.add_option('--arch', type='choice', choices=VALID_ARCHS,
145 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) 152 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)')
149 options, _ = parser.parse_args(args) 153 options, _ = parser.parse_args(args)
150 if options.running_as_hook and not sys.platform.startswith('linux'): 154 if options.running_as_hook and not sys.platform.startswith('linux'):
151 return 0 155 return 0
152 156
153 if options.running_as_hook: 157 if options.running_as_hook:
154 host_arch = DetectHostArch() 158 host_arch = DetectHostArch()
155 # PPC/s390 don't use sysroot, see http://crbug.com/646169 159 # PPC/s390 don't use sysroot, see http://crbug.com/646169
156 if host_arch in ['ppc','s390']: 160 if host_arch in ['ppc','s390']:
157 return 0 161 return 0
158 InstallDefaultSysroots(host_arch) 162 InstallDefaultSysroots(host_arch)
159 elif options.arch: 163 else:
164 if not options.arch:
165 print 'You much specify either --arch or --running-as-hook'
166 return 1
160 InstallDefaultSysrootForArch(options.arch) 167 InstallDefaultSysrootForArch(options.arch)
161 elif options.all:
162 for arch in VALID_ARCHS:
163 InstallDefaultSysrootForArch(arch)
164 else:
165 print 'You much specify either --arch, --all or --running-as-hook'
166 return 1
167 168
168 return 0 169 return 0
169 170
170
171 def InstallDefaultSysrootForArch(target_arch): 171 def InstallDefaultSysrootForArch(target_arch):
172 if target_arch not in VALID_ARCHS: 172 if target_arch == 'amd64':
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:
173 raise Error('Unknown architecture: %s' % target_arch) 183 raise Error('Unknown architecture: %s' % target_arch)
174 InstallSysroot('Jessie', target_arch)
175
176 184
177 def InstallSysroot(target_platform, target_arch): 185 def InstallSysroot(target_platform, target_arch):
178 # The sysroot directory should match the one specified in build/common.gypi. 186 # The sysroot directory should match the one specified in build/common.gypi.
179 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate 187 # TODO(thestig) Consider putting this elsewhere to avoid having to recreate
180 # it on every build. 188 # it on every build.
181 linux_dir = os.path.dirname(SCRIPT_DIR) 189 linux_dir = os.path.dirname(SCRIPT_DIR)
182 190
183 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json') 191 sysroots_file = os.path.join(SCRIPT_DIR, 'sysroots.json')
184 sysroots = json.load(open(sysroots_file)) 192 sysroots = json.load(open(sysroots_file))
185 sysroot_key = '%s_%s' % (target_platform.lower(), target_arch) 193 sysroot_key = '%s_%s' % (target_platform.lower(), target_arch)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 with open(stamp, 'w') as s: 238 with open(stamp, 'w') as s:
231 s.write(url) 239 s.write(url)
232 240
233 241
234 if __name__ == '__main__': 242 if __name__ == '__main__':
235 try: 243 try:
236 sys.exit(main(sys.argv[1:])) 244 sys.exit(main(sys.argv[1:]))
237 except Error as e: 245 except Error as e:
238 sys.stderr.write(str(e) + '\n') 246 sys.stderr.write(str(e) + '\n')
239 sys.exit(1) 247 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