OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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 import argparse | 6 import argparse |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 if sys.version_info < (2, 7, 0): | 11 if sys.version_info < (2, 7, 0): |
12 sys.stderr.write("python 2.7 or later is required run this script\n") | 12 sys.stderr.write("python 2.7 or later is required run this script\n") |
13 sys.exit(1) | 13 sys.exit(1) |
14 | 14 |
15 import buildbot_common | 15 import buildbot_common |
16 import build_paths | 16 import build_paths |
17 from build_paths import NACL_DIR, SDK_SRC_DIR, EXTRACT_ARCHIVE_DIR | 17 from build_paths import NACL_DIR, SDK_SRC_DIR, EXTRACT_ARCHIVE_DIR |
18 | 18 |
19 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) | 19 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) |
20 | 20 |
21 import getos | 21 import getos |
22 import oshelpers | 22 import oshelpers |
23 | 23 |
24 # TODO(binji): The artifacts should be downloaded; until then, point at the | 24 # TODO(binji): The artifacts should be downloaded; until then, point at the |
25 # directory where the artifacts are built. | 25 # directory where the artifacts are built. |
26 DOWNLOAD_ARCHIVE_DIR = build_paths.BUILD_ARCHIVE_DIR | 26 DOWNLOAD_ARCHIVE_DIR = build_paths.BUILD_ARCHIVE_DIR |
27 | 27 |
28 PLATFORM = getos.GetPlatform() | 28 PLATFORM = getos.GetPlatform() |
29 NEWLIB_X86_TC_DIR = os.path.join('toolchain', '%s_x86_newlib' % PLATFORM) | |
30 NEWLIB_ARM_TC_DIR = os.path.join('toolchain', '%s_arm_newlib' % PLATFORM) | |
31 GLIBC_X86_TC_DIR = os.path.join('toolchain', '%s_x86_glibc' % PLATFORM) | 29 GLIBC_X86_TC_DIR = os.path.join('toolchain', '%s_x86_glibc' % PLATFORM) |
32 PNACL_TC_DIR = os.path.join('toolchain', '%s_pnacl' % PLATFORM) | 30 PNACL_TC_DIR = os.path.join('toolchain', '%s_pnacl' % PLATFORM) |
33 PNACL_TRANSLATOR_DIR = os.path.join(PNACL_TC_DIR, 'translator') | 31 PNACL_TRANSLATOR_DIR = os.path.join(PNACL_TC_DIR, 'translator') |
34 BIONIC_TC_DIR = os.path.join('toolchain', '%s_arm_bionic' % PLATFORM) | |
35 | 32 |
36 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') | 33 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') |
37 TAR = oshelpers.FindExeInPath('tar') | 34 TAR = oshelpers.FindExeInPath('tar') |
38 | 35 |
39 options = None | 36 options = None |
40 | 37 |
41 | 38 |
42 PPAPI_ARCHIVE = os.path.join(DOWNLOAD_ARCHIVE_DIR, | 39 PPAPI_ARCHIVE = os.path.join(DOWNLOAD_ARCHIVE_DIR, |
43 '%s_ppapi.tar.bz2' % PLATFORM) | 40 '%s_ppapi.tar.bz2' % PLATFORM) |
44 | 41 |
45 | |
46 NEWLIB_ARCHIVE_MAP = [ | |
47 ('newlib', NEWLIB_X86_TC_DIR), | |
48 ('arm', NEWLIB_ARM_TC_DIR), | |
49 ('newlib_headers', [ | |
50 os.path.join(NEWLIB_X86_TC_DIR, 'x86_64-nacl', 'include'), | |
51 os.path.join(NEWLIB_ARM_TC_DIR, 'arm-nacl', 'include')]), | |
52 ('newlib_arm_libs', os.path.join(NEWLIB_ARM_TC_DIR, 'arm-nacl', 'lib')), | |
53 ('newlib_x86_32_libs', | |
54 os.path.join(NEWLIB_X86_TC_DIR, 'x86_64-nacl', 'lib32')), | |
55 ('newlib_x86_64_libs', os.path.join(NEWLIB_X86_TC_DIR, 'x86_64-nacl', 'lib'))] | |
56 | |
57 GLIBC_ARCHIVE_MAP = [ | 42 GLIBC_ARCHIVE_MAP = [ |
58 ('glibc', GLIBC_X86_TC_DIR), | 43 ('glibc', GLIBC_X86_TC_DIR), |
59 ('glibc_headers', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'include')), | 44 ('glibc_headers', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'include')), |
60 ('glibc_x86_32_libs', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'lib32')), | 45 ('glibc_x86_32_libs', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'lib32')), |
61 ('glibc_x86_64_libs', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'lib'))] | 46 ('glibc_x86_64_libs', os.path.join(GLIBC_X86_TC_DIR, 'x86_64-nacl', 'lib'))] |
62 | 47 |
63 PNACL_ARCHIVE_MAP = [ | 48 PNACL_ARCHIVE_MAP = [ |
64 ('pnacl', PNACL_TC_DIR), | 49 ('pnacl', PNACL_TC_DIR), |
65 ('newlib_headers', os.path.join(PNACL_TC_DIR, 'le32-nacl', 'include')), | 50 ('newlib_headers', os.path.join(PNACL_TC_DIR, 'le32-nacl', 'include')), |
66 ('pnacl_libs', os.path.join(PNACL_TC_DIR, 'le32-nacl', 'lib')), | 51 ('pnacl_libs', os.path.join(PNACL_TC_DIR, 'le32-nacl', 'lib')), |
67 ('pnacl_translator_arm_libs', | 52 ('pnacl_translator_arm_libs', |
68 os.path.join(PNACL_TRANSLATOR_DIR, 'arm', 'lib')), | 53 os.path.join(PNACL_TRANSLATOR_DIR, 'arm', 'lib')), |
69 ('pnacl_translator_x86_32_libs', | 54 ('pnacl_translator_x86_32_libs', |
70 os.path.join(PNACL_TRANSLATOR_DIR, 'x86-32', 'lib')), | 55 os.path.join(PNACL_TRANSLATOR_DIR, 'x86-32', 'lib')), |
71 ('pnacl_translator_x86_64_libs', | 56 ('pnacl_translator_x86_64_libs', |
72 os.path.join(PNACL_TRANSLATOR_DIR, 'x86-64', 'lib'))] | 57 os.path.join(PNACL_TRANSLATOR_DIR, 'x86-64', 'lib'))] |
73 | 58 |
74 BIONIC_ARCHIVE_MAP = [ | |
75 ('bionic', BIONIC_TC_DIR), | |
76 ('bionic_headers', os.path.join(BIONIC_TC_DIR, 'arm-nacl', 'include')), | |
77 ('bionic_arm_libs', os.path.join(BIONIC_TC_DIR, 'arm-nacl', 'lib'))] | |
78 | |
79 | |
80 TOOLCHAIN_ARCHIVE_MAPS = { | 59 TOOLCHAIN_ARCHIVE_MAPS = { |
81 'newlib': NEWLIB_ARCHIVE_MAP, | |
82 'glibc': GLIBC_ARCHIVE_MAP, | 60 'glibc': GLIBC_ARCHIVE_MAP, |
83 'pnacl': PNACL_ARCHIVE_MAP, | 61 'pnacl': PNACL_ARCHIVE_MAP, |
84 'bionic': BIONIC_ARCHIVE_MAP, | |
85 } | 62 } |
86 | 63 |
87 TOOLS_ARCHIVE_MAP = [('tools', 'tools')] | 64 TOOLS_ARCHIVE_MAP = [('tools', 'tools')] |
88 | 65 |
89 | 66 |
90 def Untar(archive, destdir): | 67 def Untar(archive, destdir): |
91 if os.path.exists(TAR): | 68 if os.path.exists(TAR): |
92 cmd = [TAR] | 69 cmd = [TAR] |
93 else: | 70 else: |
94 cmd = [sys.executable, CYGTAR] | 71 cmd = [sys.executable, CYGTAR] |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ExtractAll(TOOLS_ARCHIVE_MAP, DOWNLOAD_ARCHIVE_DIR, options.outdir) | 130 ExtractAll(TOOLS_ARCHIVE_MAP, DOWNLOAD_ARCHIVE_DIR, options.outdir) |
154 Untar(PPAPI_ARCHIVE, EXTRACT_ARCHIVE_DIR) | 131 Untar(PPAPI_ARCHIVE, EXTRACT_ARCHIVE_DIR) |
155 return 0 | 132 return 0 |
156 | 133 |
157 | 134 |
158 if __name__ == '__main__': | 135 if __name__ == '__main__': |
159 try: | 136 try: |
160 sys.exit(main(sys.argv[1:])) | 137 sys.exit(main(sys.argv[1:])) |
161 except KeyboardInterrupt: | 138 except KeyboardInterrupt: |
162 buildbot_common.ErrorExit('extract_artifacts: interrupted') | 139 buildbot_common.ErrorExit('extract_artifacts: interrupted') |
OLD | NEW |