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

Side by Side Diff: native_client_sdk/src/build_tools/build_sdk.py

Issue 10065030: [NaCl SDK] Change build script to test sdk_updater, also push manifest snippets per bot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 | « no previous file | native_client_sdk/src/build_tools/buildbot_common.py » ('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) 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 """Entry point for both build and try bots 6 """Entry point for both build and try bots
7 7
8 This script is invoked from XXX, usually without arguments 8 This script is invoked from XXX, usually without arguments
9 to package an SDK. It automatically determines whether 9 to package an SDK. It automatically determines whether
10 this SDK is for mac, win, linux. 10 this SDK is for mac, win, linux.
11 11
12 The script inspects the following environment variables: 12 The script inspects the following environment variables:
13 13
14 BUILDBOT_BUILDERNAME to determine whether the script is run locally 14 BUILDBOT_BUILDERNAME to determine whether the script is run locally
15 and whether it should upload an SDK to file storage (GSTORE) 15 and whether it should upload an SDK to file storage (GSTORE)
16 """ 16 """
17 17
18 18
19 # std python includes 19 # std python includes
20 import multiprocessing
20 import optparse 21 import optparse
21 import os 22 import os
22 import platform 23 import platform
24 import subprocess
23 import sys 25 import sys
24 26
25 # local includes 27 # local includes
26 import buildbot_common 28 import buildbot_common
27 import build_utils 29 import build_utils
28 import lastchange 30 import lastchange
31 import manifest_util
29 32
30 # Create the various paths of interest 33 # Create the various paths of interest
31 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 34 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
32 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) 35 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
33 SDK_EXAMPLE_DIR = os.path.join(SDK_SRC_DIR, 'examples') 36 SDK_EXAMPLE_DIR = os.path.join(SDK_SRC_DIR, 'examples')
34 SDK_DIR = os.path.dirname(SDK_SRC_DIR) 37 SDK_DIR = os.path.dirname(SDK_SRC_DIR)
35 SRC_DIR = os.path.dirname(SDK_DIR) 38 SRC_DIR = os.path.dirname(SDK_DIR)
36 NACL_DIR = os.path.join(SRC_DIR, 'native_client') 39 NACL_DIR = os.path.join(SRC_DIR, 'native_client')
37 OUT_DIR = os.path.join(SRC_DIR, 'out') 40 OUT_DIR = os.path.join(SRC_DIR, 'out')
38 PPAPI_DIR = os.path.join(SRC_DIR, 'ppapi') 41 PPAPI_DIR = os.path.join(SRC_DIR, 'ppapi')
42 SERVER_DIR = os.path.join(OUT_DIR, 'local_server')
39 43
40 44
41 # Add SDK make tools scripts to the python path. 45 # Add SDK make tools scripts to the python path.
42 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) 46 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools'))
43 sys.path.append(os.path.join(NACL_DIR, 'build')) 47 sys.path.append(os.path.join(NACL_DIR, 'build'))
44 48
45 import getos 49 import getos
46 import http_download 50 import http_download
47 import oshelpers 51 import oshelpers
48 52
49 GSTORE = 'http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/' 53 GSTORE = 'http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/'
50 MAKE = 'nacl_sdk/make_3_81/make.exe' 54 MAKE = 'nacl_sdk/make_3_81/make.exe'
51 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') 55 CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py')
52 56
53 57
58 def HTTPServerProcess(conn, serve_dir):
59 """Run a local httpserver with a randomly-chosen port.
60
61 This function assumes it is run as a child process using multiprocessing.
62
63 Args:
64 conn: A connection to the parent process. The child process sends
65 the local port, and waits for a message from the parent to
66 stop serving.
67 serve_dir: The directory to serve. All files are accessible through
68 http://localhost:<port>/path/to/filename.
69 """
70 import BaseHTTPServer
71 import SimpleHTTPServer
72
73 os.chdir(serve_dir)
74 httpd = BaseHTTPServer.HTTPServer(('', 0),
75 SimpleHTTPServer.SimpleHTTPRequestHandler)
76 conn.send(httpd.server_address[1]) # the chosen port number
77 httpd.timeout = 0.5 # seconds
78 running = True
79 while running:
80 httpd.handle_request()
81 if conn.poll():
82 running = conn.recv()
83 conn.close()
84
85
86 class LocalHTTPServer(object):
87 """Class to start a local HTTP server as a child process."""
88
89 def __init__(self, serve_dir):
90 parent_conn, child_conn = multiprocessing.Pipe()
91 self.process = multiprocessing.Process(target=HTTPServerProcess,
92 args=(child_conn, serve_dir))
93 self.process.start()
94 if parent_conn.poll(1): # wait a second
95 self.port = parent_conn.recv()
96 else:
97 raise Exception('Unable to launch HTTP server.')
98
99 self.conn = parent_conn
100
101 def Shutdown(self):
102 """Send a message to the child HTTP server process and wait for it to
103 finish."""
104 self.conn.send(False)
105 self.process.join()
106
107 def GetURL(self, rel_url):
108 """Get the full url for a file on the local HTTP server.
109
110 Args:
111 rel_url: A URL fragment to convert to a full URL. For example,
112 GetURL('foobar.baz') -> 'http://localhost:1234/foobar.baz'
113 """
114 return 'http://localhost:%d/%s' % (self.port, rel_url)
115
116
54 def AddMakeBat(pepperdir, makepath): 117 def AddMakeBat(pepperdir, makepath):
55 """Create a simple batch file to execute Make. 118 """Create a simple batch file to execute Make.
56 119
57 Creates a simple batch file named make.bat for the Windows platform at the 120 Creates a simple batch file named make.bat for the Windows platform at the
58 given path, pointing to the Make executable in the SDK.""" 121 given path, pointing to the Make executable in the SDK."""
59 122
60 makepath = os.path.abspath(makepath) 123 makepath = os.path.abspath(makepath)
61 if not makepath.startswith(pepperdir): 124 if not makepath.startswith(pepperdir):
62 buildbot_common.ErrorExit('Make.bat not relative to Pepper directory: ' + 125 buildbot_common.ErrorExit('Make.bat not relative to Pepper directory: ' +
63 makepath) 126 makepath)
64 127
65 makeexe = os.path.abspath(os.path.join(pepperdir, 'tools')) 128 makeexe = os.path.abspath(os.path.join(pepperdir, 'tools'))
66 relpath = os.path.relpath(makeexe, makepath) 129 relpath = os.path.relpath(makeexe, makepath)
67 130
68 fp = open(os.path.join(makepath, 'make.bat'), 'wb') 131 fp = open(os.path.join(makepath, 'make.bat'), 'wb')
69 outpath = os.path.join(relpath, 'make.exe') 132 outpath = os.path.join(relpath, 'make.exe')
70 133
71 # Since make.bat is only used by Windows, for Windows path style 134 # Since make.bat is only used by Windows, for Windows path style
72 outpath = outpath.replace(os.path.sep, '\\') 135 outpath = outpath.replace(os.path.sep, '\\')
73 fp.write('@%s %%*\n' % outpath) 136 fp.write('@%s %%*\n' % outpath)
74 fp.close() 137 fp.close()
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 ppapi = os.path.join(tc_dst_inc, 'ppapi') 258 ppapi = os.path.join(tc_dst_inc, 'ppapi')
196 buildbot_common.RemoveDir(ppapi) 259 buildbot_common.RemoveDir(ppapi)
197 260
198 # Copy in c and c/dev headers 261 # Copy in c and c/dev headers
199 buildbot_common.MakeDir(os.path.join(ppapi, 'c', 'dev')) 262 buildbot_common.MakeDir(os.path.join(ppapi, 'c', 'dev'))
200 buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', '*.h'), 263 buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', '*.h'),
201 os.path.join(ppapi, 'c')) 264 os.path.join(ppapi, 'c'))
202 buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', 'dev', '*.h'), 265 buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', 'dev', '*.h'),
203 os.path.join(ppapi, 'c', 'dev')) 266 os.path.join(ppapi, 'c', 'dev'))
204 267
205 # Run the generator to overwrite IDL files 268 # Run the generator to overwrite IDL files
206 buildbot_common.Run([sys.executable, 'generator.py', '--wnone', '--cgen', 269 buildbot_common.Run([sys.executable, 'generator.py', '--wnone', '--cgen',
207 '--release=M' + pepper_ver, '--verbose', '--dstroot=%s/c' % ppapi], 270 '--release=M' + pepper_ver, '--verbose', '--dstroot=%s/c' % ppapi],
208 cwd=os.path.join(PPAPI_DIR, 'generators')) 271 cwd=os.path.join(PPAPI_DIR, 'generators'))
209 272
210 # Remove private and trusted interfaces 273 # Remove private and trusted interfaces
211 buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'private')) 274 buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'private'))
212 buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'trusted')) 275 buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'trusted'))
213 276
214 # Copy in the C++ headers 277 # Copy in the C++ headers
215 buildbot_common.MakeDir(os.path.join(ppapi, 'cpp', 'dev')) 278 buildbot_common.MakeDir(os.path.join(ppapi, 'cpp', 'dev'))
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 tcname = platform + '_' + arch 315 tcname = platform + '_' + arch
253 tmpdir = os.path.join(SRC_DIR, 'out', 'tc_temp') 316 tmpdir = os.path.join(SRC_DIR, 'out', 'tc_temp')
254 buildbot_common.RemoveDir(tmpdir) 317 buildbot_common.RemoveDir(tmpdir)
255 buildbot_common.MakeDir(tmpdir) 318 buildbot_common.MakeDir(tmpdir)
256 319
257 if 'newlib' in toolchains: 320 if 'newlib' in toolchains:
258 # Untar the newlib toolchains 321 # Untar the newlib toolchains
259 tarfile = GetNewlibToolchain(platform, arch) 322 tarfile = GetNewlibToolchain(platform, arch)
260 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], 323 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile],
261 cwd=NACL_DIR) 324 cwd=NACL_DIR)
262 325
263 # Then rename/move it to the pepper toolchain directory 326 # Then rename/move it to the pepper toolchain directory
264 srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') 327 srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk')
265 newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') 328 newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib')
266 buildbot_common.Move(srcdir, newlibdir) 329 buildbot_common.Move(srcdir, newlibdir)
267 330
268 if 'glibc' in toolchains: 331 if 'glibc' in toolchains:
269 # Untar the glibc toolchains 332 # Untar the glibc toolchains
270 tarfile = GetGlibcToolchain(platform, arch) 333 tarfile = GetGlibcToolchain(platform, arch)
271 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], 334 buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile],
272 cwd=NACL_DIR) 335 cwd=NACL_DIR)
273 336
274 # Then rename/move it to the pepper toolchain directory 337 # Then rename/move it to the pepper toolchain directory
275 srcdir = os.path.join(tmpdir, 'toolchain', tcname) 338 srcdir = os.path.join(tmpdir, 'toolchain', tcname)
276 glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') 339 glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc')
277 buildbot_common.Move(srcdir, glibcdir) 340 buildbot_common.Move(srcdir, glibcdir)
278 341
279 # Untar the pnacl toolchains 342 # Untar the pnacl toolchains
280 if 'pnacl' in toolchains: 343 if 'pnacl' in toolchains:
281 tmpdir = os.path.join(tmpdir, 'pnacl') 344 tmpdir = os.path.join(tmpdir, 'pnacl')
282 buildbot_common.RemoveDir(tmpdir) 345 buildbot_common.RemoveDir(tmpdir)
283 buildbot_common.MakeDir(tmpdir) 346 buildbot_common.MakeDir(tmpdir)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 buildbot_common.ErrorExit('Missing arch %s' % arch) 405 buildbot_common.ErrorExit('Missing arch %s' % arch)
343 406
344 407
345 EXAMPLE_MAP = { 408 EXAMPLE_MAP = {
346 'newlib': [ 409 'newlib': [
347 'debugging', 410 'debugging',
348 'file_histogram', 411 'file_histogram',
349 'fullscreen_tumbler', 412 'fullscreen_tumbler',
350 'gamepad', 413 'gamepad',
351 'geturl', 414 'geturl',
352 'hello_world_interactive', 415 'hello_world_interactive',
353 'hello_world_newlib', 416 'hello_world_newlib',
354 'input_events', 417 'input_events',
355 'load_progress', 418 'load_progress',
356 'mouselock', 419 'mouselock',
357 'multithreaded_input_events', 420 'multithreaded_input_events',
358 'pi_generator', 421 'pi_generator',
359 'pong', 422 'pong',
360 'sine_synth', 423 'sine_synth',
361 'tumbler', 424 'tumbler',
362 'websocket' 425 'websocket'
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 buildbot_common.Run([sys.executable, CYGTAR, '-C', 514 buildbot_common.Run([sys.executable, CYGTAR, '-C',
452 os.path.join(OUT_DIR, sdktoolsdir), '-czf', tarname] + files_to_tar, 515 os.path.join(OUT_DIR, sdktoolsdir), '-czf', tarname] + files_to_tar,
453 cwd=NACL_DIR) 516 cwd=NACL_DIR)
454 sys.stdout.write('\n') 517 sys.stdout.write('\n')
455 518
456 519
457 def main(args): 520 def main(args):
458 parser = optparse.OptionParser() 521 parser = optparse.OptionParser()
459 parser.add_option('--pnacl', help='Enable pnacl build.', 522 parser.add_option('--pnacl', help='Enable pnacl build.',
460 action='store_true', dest='pnacl', default=False) 523 action='store_true', dest='pnacl', default=False)
461 parser.add_option('--examples', help='Rebuild the examples.', 524 parser.add_option('--examples', help='Only build the examples.',
462 action='store_true', dest='examples', default=False) 525 action='store_true', dest='only_examples', default=False)
463 parser.add_option('--update', help='Rebuild the updater.', 526 parser.add_option('--update', help='Only build the updater.',
464 action='store_true', dest='update', default=False) 527 action='store_true', dest='only_updater', default=False)
465 parser.add_option('--skip-tar', help='Skip generating a tarball.', 528 parser.add_option('--skip-tar', help='Skip generating a tarball.',
466 action='store_true', dest='skip_tar', default=False) 529 action='store_true', dest='skip_tar', default=False)
467 parser.add_option('--archive', help='Force the archive step.', 530 parser.add_option('--archive', help='Force the archive step.',
468 action='store_true', dest='archive', default=False) 531 action='store_true', dest='archive', default=False)
469 parser.add_option('--release', help='PPAPI release version.', 532 parser.add_option('--release', help='PPAPI release version.',
470 dest='release', default=None) 533 dest='release', default=None)
471 534
472 options, args = parser.parse_args(args[1:]) 535 options, args = parser.parse_args(args[1:])
473 platform = getos.GetPlatform() 536 platform = getos.GetPlatform()
474 arch = 'x86' 537 arch = 'x86'
475 538
476 builder_name = os.getenv('BUILDBOT_BUILDERNAME','') 539 builder_name = os.getenv('BUILDBOT_BUILDERNAME','')
477 if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0: 540 if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0:
478 options.pnacl = True 541 options.pnacl = True
479 542
480 if options.pnacl: 543 if options.pnacl:
481 toolchains = ['pnacl'] 544 toolchains = ['pnacl']
482 else: 545 else:
483 toolchains = ['newlib', 'glibc'] 546 toolchains = ['newlib', 'glibc']
484 print 'Building: ' + ' '.join(toolchains) 547 print 'Building: ' + ' '.join(toolchains)
485 skip = options.examples or options.update 548 skip = options.only_examples or options.only_updater
486 549
487 skip_examples = skip 550 skip_examples = skip and not options.only_examples
488 skip_update = skip 551 skip_update = skip and not options.only_updater
489 skip_untar = skip 552 skip_untar = skip
490 skip_build = skip 553 skip_build = skip
554 skip_test_updater = skip
491 skip_tar = skip or options.skip_tar 555 skip_tar = skip or options.skip_tar
492 556
493 557 if options.archive and (options.only_examples or options.skip_tar):
494 if options.examples: skip_examples = False
495 skip_update = not options.update
496
497 if options.archive and (options.examples or options.skip_tar):
498 parser.error('Incompatible arguments with archive.') 558 parser.error('Incompatible arguments with archive.')
499 559
500 pepper_ver = str(int(build_utils.ChromeMajorVersion())) 560 pepper_ver = str(int(build_utils.ChromeMajorVersion()))
501 clnumber = lastchange.FetchVersionInfo(None).revision 561 clnumber = lastchange.FetchVersionInfo(None).revision
502 if options.release: 562 if options.release:
503 pepper_ver = options.release 563 pepper_ver = options.release
504 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) 564 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber)
505 565
506 if not skip_build: 566 if not skip_build:
507 buildbot_common.BuildStep('Rerun hooks to get toolchains') 567 buildbot_common.BuildStep('Rerun hooks to get toolchains')
508 buildbot_common.Run(['gclient', 'runhooks'], 568 buildbot_common.Run(['gclient', 'runhooks'],
509 cwd=SRC_DIR, shell=(platform=='win')) 569 cwd=SRC_DIR, shell=(platform=='win'))
510 570
511 buildbot_common.BuildStep('Clean Pepper Dir')
512 pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver) 571 pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver)
513 if not skip_untar: 572 if not skip_untar:
573 buildbot_common.BuildStep('Clean Pepper Dir')
514 buildbot_common.RemoveDir(pepperdir) 574 buildbot_common.RemoveDir(pepperdir)
515 buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain')) 575 buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain'))
516 buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) 576 buildbot_common.MakeDir(os.path.join(pepperdir, 'tools'))
517 577
518 buildbot_common.BuildStep('Add Text Files') 578 if not skip_build:
519 files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README'] 579 buildbot_common.BuildStep('Add Text Files')
520 files = [os.path.join(SDK_SRC_DIR, filename) for filename in files] 580 files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README']
521 oshelpers.Copy(['-v'] + files + [pepperdir]) 581 files = [os.path.join(SDK_SRC_DIR, filename) for filename in files]
582 oshelpers.Copy(['-v'] + files + [pepperdir])
522 583
523 584
524 # Clean out the temporary toolchain untar directory 585 # Clean out the temporary toolchain untar directory
525 if not skip_untar: 586 if not skip_untar:
526 UntarToolchains(pepperdir, platform, arch, toolchains) 587 UntarToolchains(pepperdir, platform, arch, toolchains)
527 588
528 if not skip_build: 589 if not skip_build:
529 BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) 590 BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains)
530 591
531 buildbot_common.BuildStep('Copy make OS helpers') 592 if not skip_build:
532 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), 593 buildbot_common.BuildStep('Copy make OS helpers')
533 os.path.join(pepperdir, 'tools')) 594 buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'),
534 if platform == 'win': 595 os.path.join(pepperdir, 'tools'))
535 buildbot_common.BuildStep('Add MAKE') 596 if platform == 'win':
536 http_download.HttpDownload(GSTORE + MAKE, 597 buildbot_common.BuildStep('Add MAKE')
537 os.path.join(pepperdir, 'tools' ,'make.exe')) 598 http_download.HttpDownload(GSTORE + MAKE,
599 os.path.join(pepperdir, 'tools' ,'make.exe'))
538 600
539 if not skip_examples: 601 if not skip_examples:
540 CopyExamples(pepperdir, toolchains) 602 CopyExamples(pepperdir, toolchains)
541 603
604 tarname = 'naclsdk_' + platform + '.bz2'
605 if 'pnacl' in toolchains:
606 tarname = 'p' + tarname
607 tarfile = os.path.join(OUT_DIR, tarname)
608
542 if not skip_tar: 609 if not skip_tar:
543 buildbot_common.BuildStep('Tar Pepper Bundle') 610 buildbot_common.BuildStep('Tar Pepper Bundle')
544 tarname = 'naclsdk_' + platform + '.bz2'
545 if 'pnacl' in toolchains:
546 tarname = 'p' + tarname
547 tarfile = os.path.join(OUT_DIR, tarname)
548 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, 611 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile,
549 'pepper_' + pepper_ver], cwd=NACL_DIR) 612 'pepper_' + pepper_ver], cwd=NACL_DIR)
550 613
551 # Archive on non-trybots. 614 # build sdk update
552 if options.archive or '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''): 615 if not skip_update:
553 buildbot_common.BuildStep('Archive build') 616 BuildUpdater()
554 buildbot_common.Archive(tarname,
555 'nativeclient-mirror/nacl/nacl_sdk/%s' % build_utils.ChromeVersion(),
556 OUT_DIR)
557 617
618 # start local server sharing a manifest + the new bundle
619 if not skip_test_updater:
620 try:
621 buildbot_common.BuildStep('Move bundle to localserver dir')
622 buildbot_common.MakeDir(SERVER_DIR)
623 buildbot_common.Move(tarfile, SERVER_DIR)
624 tarfile = os.path.join(SERVER_DIR, tarname)
625
626 buildbot_common.BuildStep('Run local server')
627 server = LocalHTTPServer(SERVER_DIR)
628
629 buildbot_common.BuildStep('Generate manifest')
630 with open(tarfile, 'rb') as tarfile_stream:
631 archive_sha1, archive_size = manifest_util.DownloadAndComputeHash(
632 tarfile_stream)
633 archive = manifest_util.Archive(manifest_util.GetHostOS())
634 archive.CopyFrom({'url': server.GetURL(tarname),
635 'size': archive_size,
636 'checksum': {'sha1': archive_sha1}})
637 bundle = manifest_util.Bundle('pepper_' + pepper_ver)
638 bundle.CopyFrom({
639 'revision': clnumber,
640 'repath': 'pepper_' + pepper_ver,
641 'version': pepper_ver,
642 'description': 'Chrome %s bundle, revision %s' % (
643 pepper_ver, clnumber),
644 'stability': 'dev',
645 'recommended': 'no',
646 'archives': [archive]})
647 manifest = manifest_util.SDKManifest()
648 manifest.SetBundle(bundle)
649 manifest_name = 'naclsdk_manifest2.json'
650 with open(os.path.join(SERVER_DIR, manifest_name), 'wb') as \
651 manifest_stream:
652 manifest_stream.write(manifest.GetManifestString())
653
654 # use newly built sdk updater to pull this bundle
655 buildbot_common.BuildStep('Update from local server')
656 updater_py = os.path.join(OUT_DIR, 'nacl_sdk', 'sdk_tools',
657 'sdk_update.py')
658 buildbot_common.Run([sys.executable, updater_py, '-U',
659 server.GetURL(manifest_name), 'update', 'pepper_' + pepper_ver])
660
661 # If we are testing examples, do it in the newly pulled directory.
662 pepperdir = os.path.join(OUT_DIR, 'nacl_sdk', 'pepper_' + pepper_ver)
663
664 # kill server
665 finally:
666 server.Shutdown()
667
668 # build examples.
558 if not skip_examples: 669 if not skip_examples:
559 buildbot_common.BuildStep('Test Build Examples') 670 buildbot_common.BuildStep('Test Build Examples')
560 filelist = os.listdir(os.path.join(pepperdir, 'examples')) 671 filelist = os.listdir(os.path.join(pepperdir, 'examples'))
561 for filenode in filelist: 672 for filenode in filelist:
562 dirnode = os.path.join(pepperdir, 'examples', filenode) 673 dirnode = os.path.join(pepperdir, 'examples', filenode)
563 makefile = os.path.join(dirnode, 'Makefile') 674 makefile = os.path.join(dirnode, 'Makefile')
564 if os.path.isfile(makefile): 675 if os.path.isfile(makefile):
565 print "\n\nMake: " + dirnode 676 print "\n\nMake: " + dirnode
566 buildbot_common.Run(['make', 'all', '-j8'], 677 buildbot_common.Run(['make', 'all', '-j8'],
567 cwd=os.path.abspath(dirnode), shell=True) 678 cwd=os.path.abspath(dirnode), shell=True)
568 679
569 # Build SDK Tools 680 # Archive on non-trybots.
570 if not skip_update: 681 if options.archive or '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''):
571 BuildUpdater() 682 buildbot_common.BuildStep('Archive build')
683 bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s' % \
684 build_utils.ChromeVersion()
685 buildbot_common.Archive(tarname, bucket_path, OUT_DIR)
686
687 # generate "manifest snippet" for this archive.
688 if not skip_test_updater:
689 archive = bundle.GetArchive(manifest_util.GetHostOS())
690 archive.url = 'https://commondatastorage.googleapis.com/' \
691 'nativeclient-mirror/nacl/nacl_sdk/%s/%s' % (
692 build_utils.ChromeVersion(), tarname)
693 manifest_snippet_file = os.path.join(OUT_DIR, tarname + '.json')
694 with open(manifest_snippet_file, 'wb') as manifest_snippet_stream:
695 manifest_snippet_stream.write(bundle.ToJSON())
696
697 buildbot_common.Archive(tarname + '.json', bucket_path, OUT_DIR,
698 step_link=False)
572 699
573 return 0 700 return 0
574 701
575 702
576 if __name__ == '__main__': 703 if __name__ == '__main__':
577 sys.exit(main(sys.argv)) 704 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/build_tools/buildbot_common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698