OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 """Script to install ARM root image for cross building of ARM chrome on linux. | 6 """Script to install ARM root 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 | 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 | 8 hooks. When run from hooks this script should be a no-op on non-linux |
9 platforms. | 9 platforms. |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 nativeclient-archive2/toolchain/$NACL_REV/sysroot-arm-trusted.tgz | 25 nativeclient-archive2/toolchain/$NACL_REV/sysroot-arm-trusted.tgz |
26 """ | 26 """ |
27 | 27 |
28 import os | 28 import os |
29 import shutil | 29 import shutil |
30 import subprocess | 30 import subprocess |
31 import sys | 31 import sys |
32 | 32 |
33 | 33 |
34 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 34 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
35 URL_PREFIX = 'https://commondatastorage.googleapis.com' | 35 URL_PREFIX = 'https://storage.googleapis.com' |
36 URL_PATH = 'nativeclient-archive2/toolchain' | 36 URL_PATH = 'nativeclient-archive2/toolchain' |
37 REVISION = 12356 | 37 REVISION = 13035 |
38 TARBALL = 'sysroot-arm-trusted.tgz' | 38 TARBALL = 'sysroot-arm-trusted.tgz' |
39 | 39 |
40 def main(args): | 40 def main(args): |
41 if '--linux-only' in args: | 41 if '--linux-only' in args: |
42 # This argument is passed when run from the gclient hooks. | 42 # This argument is passed when run from the gclient hooks. |
43 # In this case we return early on non-linux platforms | 43 # In this case we return early on non-linux platforms |
44 # or if GYP_DEFINES doesn't include target_arch=arm | 44 # or if GYP_DEFINES doesn't include target_arch=arm |
45 if not sys.platform.startswith('linux'): | 45 if not sys.platform.startswith('linux'): |
46 return 0 | 46 return 0 |
47 | 47 |
48 if "target_arch=arm" not in os.environ.get('GYP_DEFINES', ''): | 48 if "target_arch=arm" not in os.environ.get('GYP_DEFINES', ''): |
49 return 0 | 49 return 0 |
50 | 50 |
51 src_root = os.path.dirname(os.path.dirname(SCRIPT_DIR)) | 51 src_root = os.path.dirname(os.path.dirname(SCRIPT_DIR)) |
52 sysroot = os.path.join(src_root, 'arm-sysroot') | 52 sysroot = os.path.join(src_root, 'arm-sysroot') |
53 url = "%s/%s/%s/%s" % (URL_PREFIX, URL_PATH, REVISION, TARBALL) | 53 url = "%s/%s/%s/%s" % (URL_PREFIX, URL_PATH, REVISION, TARBALL) |
54 | 54 |
55 stamp = os.path.join(sysroot, ".stamp") | 55 stamp = os.path.join(sysroot, ".stamp") |
56 if os.path.exists(stamp): | 56 if os.path.exists(stamp): |
57 with open(stamp) as s: | 57 with open(stamp) as s: |
58 if s.read() == url: | 58 if s.read() == url: |
59 print "ARM root image already up-to-date: %s" % sysroot | 59 print "ARM root image already up-to-date: %s" % sysroot |
60 return 0 | 60 return 0 |
61 | 61 |
62 print "Installing ARM root image: %s" % sysroot | 62 print "Installing ARM root image: %s" % sysroot |
63 if os.path.isdir(sysroot): | 63 if os.path.isdir(sysroot): |
64 shutil.rmtree(sysroot) | 64 shutil.rmtree(sysroot) |
65 os.mkdir(sysroot) | 65 os.mkdir(sysroot) |
66 tarball = os.path.join(sysroot, TARBALL) | 66 tarball = os.path.join(sysroot, TARBALL) |
67 subprocess.check_call(['curl', '-L', url, '-o', tarball]) | 67 curl = ['curl', '--fail', '-L', url, '-o', tarball] |
| 68 if os.isatty(sys.stdout.fileno()): |
| 69 curl.append('--progress') |
| 70 else: |
| 71 curl.append('--silent') |
| 72 subprocess.check_call(curl) |
68 subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot]) | 73 subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot]) |
69 os.remove(tarball) | 74 os.remove(tarball) |
70 | 75 |
71 with open(stamp, 'w') as s: | 76 with open(stamp, 'w') as s: |
72 s.write(url) | 77 s.write(url) |
73 return 0 | 78 return 0 |
74 | 79 |
75 | 80 |
76 if __name__ == '__main__': | 81 if __name__ == '__main__': |
77 sys.exit(main(sys.argv[1:])) | 82 sys.exit(main(sys.argv[1:])) |
OLD | NEW |