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

Side by Side Diff: native_client_sdk/src/build_tools/nacl-mono-builder.py

Issue 10156003: [NaCl SDK] Build naclmono packages based on the sdk manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: merge with HEAD Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/nacl-mono-buildbot.py ('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
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 import optparse 6 import optparse
7 import os 7 import os
8 import sys 8 import sys
9 import tarfile 9 import tarfile
10 10
11 import buildbot_common 11 import buildbot_common
12 12
13 SDK_BUILD_DIR = buildbot_common.SCRIPT_DIR 13 SDK_BUILD_DIR = buildbot_common.SCRIPT_DIR
14 MONO_BUILD_DIR = os.path.join(SDK_BUILD_DIR, 'mono_build') 14 MONO_BUILD_DIR = os.path.join(SDK_BUILD_DIR, 'mono_build')
15 MONO_DIR = os.path.join(MONO_BUILD_DIR, 'nacl-mono') 15 MONO_DIR = os.path.join(MONO_BUILD_DIR, 'nacl-mono')
16 16
17 def main(args): 17 def main(args):
18 parser = optparse.OptionParser() 18 parser = optparse.OptionParser()
19 parser.add_option('--arch', 19 parser.add_option('--arch',
20 help='Target architecture', 20 help='Target architecture',
21 dest='arch', 21 dest='arch',
22 default='x86-32') 22 default='x86-32')
23 parser.add_option('--sdk_version', 23 parser.add_option('--sdk-revision',
24 help='SDK Version (pepper_[X], r[X])' 24 help='SDK Revision'
25 ' (default=buildbot revision)', 25 ' (default=buildbot revision)',
26 dest='sdk_version', 26 dest='sdk_revision',
27 default='') 27 default=None)
28 parser.add_option('--sdk-url',
29 help='SDK Download URL',
30 dest='sdk_url',
31 default=None)
28 parser.add_option('--install-dir', 32 parser.add_option('--install-dir',
29 help='Install Directory', 33 help='Install Directory',
30 dest='install_dir', 34 dest='install_dir',
31 default='naclmono') 35 default='naclmono')
32 (options, args) = parser.parse_args(args[1:]) 36 (options, args) = parser.parse_args(args[1:])
33 37
34 assert sys.platform.find('linux') != -1 38 assert sys.platform.find('linux') != -1
35 39
36 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') 40 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '')
37 41
38 build_prefix = options.arch + ' ' 42 build_prefix = options.arch + ' '
39 43
40 buildbot_common.BuildStep(build_prefix + 'Clean Old SDK') 44 buildbot_common.BuildStep(build_prefix + 'Clean Old SDK')
41 buildbot_common.MakeDir(MONO_BUILD_DIR) 45 buildbot_common.MakeDir(MONO_BUILD_DIR)
42 buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*')) 46 buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*'))
43 47
44 buildbot_common.BuildStep(build_prefix + 'Setup New SDK') 48 buildbot_common.BuildStep(build_prefix + 'Setup New SDK')
45 sdk_dir = None 49 sdk_dir = None
46 sdk_revision = None 50 sdk_revision = options.sdk_revision
47 if options.sdk_version == '': 51 sdk_url = options.sdk_url
48 assert buildbot_revision 52 if not sdk_url:
49 sdk_revision = buildbot_revision.split(':')[0] 53 if not sdk_revision:
50 url = 'gs://nativeclient-mirror/nacl/nacl_sdk/'\ 54 assert buildbot_revision
51 'trunk.%s/naclsdk_linux.bz2' % sdk_revision 55 sdk_revision = buildbot_revision.split(':')[0]
52 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', url, '.'], 56 sdk_url = 'gs://nativeclient-mirror/nacl/nacl_sdk/'\
53 cwd=MONO_BUILD_DIR) 57 'trunk.%s/naclsdk_linux.bz2' % sdk_revision
54 tar_file = None 58
55 try: 59 sdk_url = sdk_url.replace('https://commondatastorage.googleapis.com/',
56 tar_file = tarfile.open(os.path.join(MONO_BUILD_DIR, 'naclsdk_linux.bz2')) 60 'gs://')
57 pepper_dir = os.path.commonprefix(tar_file.getnames()) 61
58 tar_file.extractall(path=MONO_BUILD_DIR) 62 sdk_file = sdk_url.split('/')[-1]
59 sdk_dir = os.path.join(MONO_BUILD_DIR, pepper_dir) 63
60 finally: 64 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', sdk_url, sdk_file],
61 if tar_file: 65 cwd=MONO_BUILD_DIR)
62 tar_file.close() 66 tar_file = None
63 else: 67 try:
64 buildbot_common.ErrorExit('sdk_version not yet supported') 68 tar_file = tarfile.open(os.path.join(MONO_BUILD_DIR, sdk_file))
69 pepper_dir = os.path.commonprefix(tar_file.getnames())
70 tar_file.extractall(path=MONO_BUILD_DIR)
71 sdk_dir = os.path.join(MONO_BUILD_DIR, pepper_dir)
72 finally:
73 if tar_file:
74 tar_file.close()
65 75
66 assert sdk_dir 76 assert sdk_dir
67 assert sdk_revision
68 77
69 buildbot_common.BuildStep(build_prefix + 'Checkout Mono') 78 buildbot_common.BuildStep(build_prefix + 'Checkout Mono')
70 # TODO(elijahtaylor): Get git URL from master/trigger to make this 79 # TODO(elijahtaylor): Get git URL from master/trigger to make this
71 # more flexible for building from upstream and release branches. 80 # more flexible for building from upstream and release branches.
72 git_url = 'git://github.com/elijahtaylor/mono.git' 81 git_url = 'git://github.com/elijahtaylor/mono.git'
73 git_rev = None 82 git_rev = 'HEAD'
74 if buildbot_revision: 83 if buildbot_revision:
75 git_rev = buildbot_revision.split(':')[1] 84 git_rev = buildbot_revision.split(':')[1]
76 if not os.path.exists(MONO_DIR): 85 if not os.path.exists(MONO_DIR):
77 buildbot_common.MakeDir(MONO_DIR) 86 buildbot_common.MakeDir(MONO_DIR)
78 buildbot_common.Run(['git', 'clone', git_url, MONO_DIR]) 87 buildbot_common.Run(['git', 'clone', git_url, MONO_DIR])
79 else: 88 else:
80 buildbot_common.Run(['git', 'fetch'], cwd=MONO_DIR) 89 buildbot_common.Run(['git', 'fetch'], cwd=MONO_DIR)
81 if git_rev: 90 if git_rev:
82 buildbot_common.Run(['git', 'checkout', git_rev], cwd=MONO_DIR) 91 buildbot_common.Run(['git', 'checkout', git_rev], cwd=MONO_DIR)
83 92
(...skipping 18 matching lines...) Expand all
102 cwd=SDK_BUILD_DIR) 111 cwd=SDK_BUILD_DIR)
103 112
104 buildbot_common.BuildStep(build_prefix + 'Test Mono') 113 buildbot_common.BuildStep(build_prefix + 'Test Mono')
105 buildbot_common.Run(['make', 'check', '-j8'], 114 buildbot_common.Run(['make', 'check', '-j8'],
106 cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch])) 115 cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch]))
107 116
108 return 0 117 return 0
109 118
110 if __name__ == '__main__': 119 if __name__ == '__main__':
111 sys.exit(main(sys.argv)) 120 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/nacl-mono-buildbot.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698