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

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

Issue 11468014: Download arm sysroot as part of gclient hooks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 8 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 | Annotate | Revision Log
« no previous file with comments | « build/install-build-deps.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Script to install arm choot image for cross building of arm chrome on linux.
7 # This script can be run manually but is more often run as part of gclient
8 # hooks. When run from hooks this script should be a no-op on non-linux
9 # platforms.
10
11 # The sysroot image could be constructed from scratch based on the current
12 # state or precise/arm but for consistency we currently use a pre-built root
13 # image which was originally designed for building trusted NaCl code. The image
14 # will normally need to be rebuilt every time chrome's build dependancies are
15 # changed.
16
17 import os
18 import shutil
19 import subprocess
20 import sys
21
22
23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
24 url_prefix = 'https://commondatastorage.googleapis.com/nativeclient-archive2/too lchain'
25 revision = 8002
iannucci 2012/12/07 23:50:08 nit: upcase for globals
Sam Clegg 2012/12/07 23:57:36 Done.
26
27 def main(args):
28 if '--linux-only' in args:
29 # This argument is passed when run from the gclient hooks.
30 # In this case we return early on non-linux platforms
31 # or if GYP_DEFINES doesn't include target_arch=arm
32 if not sys.platform.startswith('linux'):
33 return 0
34
35 if "target_arch=arm" not in os.environ.get('GYP_DEFINES', ''):
36 return 0
37
38 src_root = os.path.dirname(os.path.dirname(SCRIPT_DIR))
39 sysroot = os.path.join(src_root, 'arm-sysroot')
40 url = "%s/%s/naclsdk_linux_arm-trusted.tgz" % (url_prefix, revision)
41
42 stamp = os.path.join(sysroot, ".stamp")
43 if os.path.exists(stamp):
44 with open(stamp) as s:
45 if s.read() == url:
46 print "ARM root image already up-to-date: %s" % sysroot
47 return 0
48
49 print "Installing ARM root image: %s" % sysroot
50 if os.path.isdir(sysroot):
iannucci 2012/12/07 23:50:08 Nit: this would fail if sysroot is something other
Sam Clegg 2012/12/07 23:57:36 Hmm. Interesting failure cases here. os.path.isdi
51 shutil.rmtree(sysroot)
52 os.mkdir(sysroot)
53 tarball = os.path.join(sysroot, 'naclsdk_linux_arm-trusted.tgz')
54 subprocess.check_call(['curl', '-L', url, '-o', tarball])
55 subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot])
56 os.remove(tarball)
57
58 with open(stamp, 'w') as s:
59 s.write(url)
60 return 0
61
62
63 if __name__ == '__main__':
64 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/install-build-deps.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698