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