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

Side by Side Diff: telemetry/bin/update_wpr_go_binary

Issue 3004523004: wpr_go: support armv7l and aarch64 (Closed)
Patch Set: wpr_go: support armv7l and aarch64 Created 3 years, 4 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 | « no previous file | telemetry/telemetry/internal/binary_dependencies.json » ('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) 2017 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2017 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 os 6 import os
7 import sys 7 import sys
8 import subprocess 8 import subprocess
9 import platform 9 import platform
10 10
(...skipping 27 matching lines...) Expand all
38 # go build command recognizes 'amd64' but not 'x86_64', so we switch 'x86_64' 38 # go build command recognizes 'amd64' but not 'x86_64', so we switch 'x86_64'
39 # to 'amd64' string here. 39 # to 'amd64' string here.
40 # The two names can be used interchangbly, see: 40 # The two names can be used interchangbly, see:
41 # https://wiki.debian.org/DebianAMD64Faq?action=recall&rev=65 41 # https://wiki.debian.org/DebianAMD64Faq?action=recall&rev=65
42 if os_arch == 'x86_64' or os_arch == 'AMD64': 42 if os_arch == 'x86_64' or os_arch == 'AMD64':
43 os_arch = 'amd64' 43 os_arch = 'amd64'
44 44
45 if os_arch == 'x86': 45 if os_arch == 'x86':
46 os_arch = '386' 46 os_arch = '386'
47 47
48 if os_arch == 'armv7l':
49 os_arch = 'arm'
50
51 if os_arch == 'aarch64':
52 os_arch = 'arm64'
53
48 # go build command recognizes 'darwin' but not 'mac'. 54 # go build command recognizes 'darwin' but not 'mac'.
49 if os_name == 'mac': 55 if os_name == 'mac':
50 os_name = 'darwin' 56 os_name = 'darwin'
51 57
52 if os_name == 'win': 58 if os_name == 'win':
53 os_name = 'windows' 59 os_name = 'windows'
54 60
55 check_go_version() 61 check_go_version()
56 env = os.environ.copy() 62 env = os.environ.copy()
57 env['GOPATH'] = '%s:%s' % (_WPR_GO_DIR, _GO_LIB_DIR) 63 env['GOPATH'] = '%s:%s' % (_WPR_GO_DIR, _GO_LIB_DIR)
58 env['GOOS'] = os_name 64 env['GOOS'] = os_name
59 env['GOARCH'] = os_arch 65 env['GOARCH'] = os_arch
60 env['CGO_ENABLED'] = '0' 66 env['CGO_ENABLED'] = '0'
61 67
62 build_cmd = ['go', 'build', '-v', os.path.join('src', 'wpr.go')] 68 build_cmd = ['go', 'build', '-v', os.path.join('src', 'wpr.go')]
63 print 'Running build command: %s' % ' '.join(build_cmd) 69 print 'Running build command: %s' % ' '.join(build_cmd)
64 subprocess.check_call(build_cmd, env=env, cwd=_WPR_GO_DIR) 70 subprocess.check_call(build_cmd, env=env, cwd=_WPR_GO_DIR)
65 if os_name == 'windows': 71 if os_name == 'windows':
66 return os.path.join(_WPR_GO_DIR, 'wpr.exe') 72 return os.path.join(_WPR_GO_DIR, 'wpr.exe')
67 return os.path.join(_WPR_GO_DIR, 'wpr') 73 return os.path.join(_WPR_GO_DIR, 'wpr')
68 74
69 75
70 # TODO(nedn): support building other architectures & OSes. 76 # TODO(nedn): support building other architectures & OSes.
71 _SUPPORTED_PLATFORMS = ( 77 _SUPPORTED_PLATFORMS = (
72 ('win', 'x86'), 78 ('win', 'x86'),
73 ('mac', 'x86_64'), 79 ('mac', 'x86_64'),
74 ('linux', 'x86_64'), 80 ('linux', 'x86_64'),
75 ('win', 'AMD64'), 81 ('win', 'AMD64'),
82 ('linux', 'armv7l'),
83 ('linux', 'aarch64'),
76 ) 84 )
77 85
78 86
79 def get_latest_wpr_go_commit_hash(): 87 def get_latest_wpr_go_commit_hash():
80 return subprocess.check_output( 88 return subprocess.check_output(
81 ['git', 'log', '-n', '1', '--pretty=format:%H', _WPR_GO_DIR]).strip() 89 ['git', 'log', '-n', '1', '--pretty=format:%H', _WPR_GO_DIR]).strip()
82 90
83 91
84 def BuildAndUpdateWPRGoBinary(os_name, arch_name): 92 def BuildAndUpdateWPRGoBinary(os_name, arch_name):
85 if (os_name, arch_name) not in _SUPPORTED_PLATFORMS: 93 if (os_name, arch_name) not in _SUPPORTED_PLATFORMS:
(...skipping 11 matching lines...) Expand all
97 os_name=os_name, arch_name=arch_name) 105 os_name=os_name, arch_name=arch_name)
98 106
99 107
100 def main(): 108 def main():
101 for os_name, arch_name in _SUPPORTED_PLATFORMS: 109 for os_name, arch_name in _SUPPORTED_PLATFORMS:
102 BuildAndUpdateWPRGoBinary(os_name, arch_name) 110 BuildAndUpdateWPRGoBinary(os_name, arch_name)
103 111
104 112
105 if __name__ == "__main__": 113 if __name__ == "__main__":
106 sys.exit(main()) 114 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | telemetry/telemetry/internal/binary_dependencies.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698