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

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

Issue 11200002: update_nacl_manifest improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 2 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
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 hashlib 6 import hashlib
7 import json 7 import json
8 import os 8 import os
9 import sys 9 import sys
10 10
11 import buildbot_common 11 import buildbot_common
12 import build_utils 12 import build_utils
13 13
14 GS_MANIFEST_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/' 14 GS_MANIFEST_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/'
15 SDK_MANIFEST = 'naclsdk_manifest2.json' 15 SDK_MANIFEST = 'naclsdk_manifest2.json'
16 MONO_MANIFEST = 'naclmono_manifest.json' 16 MONO_MANIFEST = 'naclmono_manifest.json'
17 17
18 def build_and_upload_mono(sdk_revision, pepper_revision, sdk_url, 18 def build_and_upload_mono(sdk_revision, pepper_revision, sdk_url,
19 upload_path, args): 19 upload_path, args):
20 install_dir = 'naclmono' 20 install_dir = 'naclmono'
21 buildbot_common.RemoveDir(install_dir) 21 buildbot_common.RemoveDir(install_dir)
22 22
23 revision_opt = ['--sdk-revision', sdk_revision] if sdk_revision else [] 23 revision_opt = ['--sdk-revision', sdk_revision] if sdk_revision else []
24 url_opt = ['--sdk-url', sdk_url] if sdk_url else [] 24 url_opt = ['--sdk-url', sdk_url] if sdk_url else []
25 25
26 buildbot_common.Run([sys.executable, 'nacl-mono-builder.py', 26 buildbot_common.Run([sys.executable, 'nacl-mono-builder.py',
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 newdict['stability'] = b['stability'] 62 newdict['stability'] = b['stability']
63 newdict['naclmono_name'] = 'naclmono_' + newdict['pepper_revision'] 63 newdict['naclmono_name'] = 'naclmono_' + newdict['pepper_revision']
64 pepper_infos.append(newdict) 64 pepper_infos.append(newdict)
65 65
66 # Get a copy of the naclmono manifest file 66 # Get a copy of the naclmono manifest file
67 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', 67 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp',
68 GS_MANIFEST_PATH + MONO_MANIFEST, '.']) 68 GS_MANIFEST_PATH + MONO_MANIFEST, '.'])
69 manifest_file = open(MONO_MANIFEST, 'r') 69 manifest_file = open(MONO_MANIFEST, 'r')
70 mono_manifest = json.loads(manifest_file.read()) 70 mono_manifest = json.loads(manifest_file.read())
71 manifest_file.close() 71 manifest_file.close()
72 72
73 ret = [] 73 ret = []
74 mono_manifest_dirty = False 74 mono_manifest_dirty = False
75 # Check to see if we need to rebuild mono based on sdk revision 75 # Check to see if we need to rebuild mono based on sdk revision
76 for key, value in mono_manifest.items(): 76 for key, value in mono_manifest.items():
77 if key == 'bundles': 77 if key == 'bundles':
78 for info in pepper_infos: 78 for info in pepper_infos:
79 bundle = filter(lambda b: b['name'] == info['naclmono_name'], value) 79 bundle = filter(lambda b: b['name'] == info['naclmono_name'], value)
80 if len(bundle) == 0: 80 if len(bundle) == 0:
81 info['naclmono_rev'] = '1' 81 info['naclmono_rev'] = '1'
82 ret.append(info) 82 ret.append(info)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 # Insert this new bundle into the manifest, 138 # Insert this new bundle into the manifest,
139 # probably overwriting an existing bundle. 139 # probably overwriting an existing bundle.
140 for key, value in mono_manifest.items(): 140 for key, value in mono_manifest.items():
141 if key == 'bundles': 141 if key == 'bundles':
142 existing = filter(lambda b: b['name'] == info['naclmono_name'], value) 142 existing = filter(lambda b: b['name'] == info['naclmono_name'], value)
143 if len(existing) > 0: 143 if len(existing) > 0:
144 loc = value.index(existing[0]) 144 loc = value.index(existing[0])
145 value[loc] = bundle 145 value[loc] = bundle
146 else: 146 else:
147 value.append(bundle) 147 value.append(bundle)
148 148
149 # Write out the file locally, then upload to its known location. 149 # Write out the file locally, then upload to its known location.
150 manifest_file = open(MONO_MANIFEST, 'w') 150 manifest_file = open(MONO_MANIFEST, 'w')
151 manifest_file.write(json.dumps(mono_manifest, sort_keys=False, indent=2)) 151 manifest_file.write(json.dumps(mono_manifest, sort_keys=False, indent=2))
152 manifest_file.close() 152 manifest_file.close()
153 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', '-a', 'public-read', 153 buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', '-a', 'public-read',
154 MONO_MANIFEST, GS_MANIFEST_PATH + MONO_MANIFEST]) 154 MONO_MANIFEST, GS_MANIFEST_PATH + MONO_MANIFEST])
155 155
156 156
157 def main(args): 157 def main(args):
158 args = args[1:] 158 args = args[1:]
159 159
160 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') 160 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '')
161 buildername = os.environ.get('BUILDBOT_BUILDERNAME', '') 161 buildername = os.environ.get('BUILDBOT_BUILDERNAME', '')
162 162
163 os.chdir(buildbot_common.SCRIPT_DIR) 163 os.chdir(buildbot_common.SCRIPT_DIR)
164 164
165 if buildername == 'linux-sdk-mono32': 165 if buildername == 'linux-sdk-mono32':
166 assert buildbot_revision 166 assert buildbot_revision
167 sdk_revision = buildbot_revision.split(':')[0] 167 sdk_revision = buildbot_revision.split(':')[0]
168 pepper_revision = build_utils.ChromeMajorVersion() 168 pepper_revision = build_utils.ChromeMajorVersion()
169 build_and_upload_mono(sdk_revision, pepper_revision, None, 169 build_and_upload_mono(sdk_revision, pepper_revision, None,
170 'trunk.' + sdk_revision, args) 170 'trunk.' + sdk_revision, args)
171 elif buildername == 'linux-sdk-mono64': 171 elif buildername == 'linux-sdk-mono64':
172 infos = get_sdk_build_info() 172 infos = get_sdk_build_info()
173 for info in infos: 173 for info in infos:
174 # This will put the file in naclmono_19/1/naclmono_19.bz2 for example. 174 # This will put the file in naclmono_19/1/naclmono_19.bz2 for example.
175 upload_path = info['naclmono_name'] + '/' + info['naclmono_rev'] 175 upload_path = info['naclmono_name'] + '/' + info['naclmono_rev']
176 build_and_upload_mono(None, info['pepper_revision'], info['sdk_url'], 176 build_and_upload_mono(None, info['pepper_revision'], info['sdk_url'],
177 upload_path, args) 177 upload_path, args)
178 update_mono_sdk_json(infos) 178 update_mono_sdk_json(infos)
179 179
180 180
181 181
182 if __name__ == '__main__': 182 if __name__ == '__main__':
183 sys.exit(main(sys.argv)) 183 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698