| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 '''Bundles the Blimp Engine and its runtime dependencies into a tarball. | 6 '''Bundles the Blimp Engine and its runtime dependencies into a tarball. |
| 7 | 7 |
| 8 The created bundle can be passed as input to docker build. E.g. | 8 The created bundle can be passed as input to docker build. E.g. |
| 9 docker build - < ../../out-linux/Debug/blimp_engine_deps.tar | 9 docker build - < ../../out-linux/Debug/blimp_engine_deps.tar |
| 10 ''' | 10 ''' |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 def main(): | 34 def main(): |
| 35 parser = argparse.ArgumentParser(description=__doc__) | 35 parser = argparse.ArgumentParser(description=__doc__) |
| 36 parser.add_argument('--build-dir', | 36 parser.add_argument('--build-dir', |
| 37 help=('build output directory (e.g. out/Debug)'), | 37 help=('build output directory (e.g. out/Debug)'), |
| 38 required=True, | 38 required=True, |
| 39 metavar='DIR') | 39 metavar='DIR') |
| 40 parser.add_argument('--dockerfile', | 40 parser.add_argument('--dockerfile', |
| 41 help=('Dockerfile to add to the bundle'), | 41 help=('Dockerfile to add to the bundle'), |
| 42 required=True, | 42 required=True, |
| 43 metavar='FILE') | 43 metavar='FILE') |
| 44 parser.add_argument('--startup-script', |
| 45 help=('Engine startup script to add to the bundle'), |
| 46 required=True, |
| 47 metavar='FILE') |
| 44 parser.add_argument('--manifest', | 48 parser.add_argument('--manifest', |
| 45 help=('engine manifest'), | 49 help=('engine manifest'), |
| 46 required=True) | 50 required=True) |
| 47 parser.add_argument('--output', | 51 parser.add_argument('--output', |
| 48 help=('name and path of bundle to create'), | 52 help=('name and path of bundle to create'), |
| 49 required=True, | 53 required=True, |
| 50 metavar='FILE') | 54 metavar='FILE') |
| 51 args = parser.parse_args() | 55 args = parser.parse_args() |
| 52 | 56 |
| 53 deps = ReadDependencies(args.manifest) | 57 deps = ReadDependencies(args.manifest) |
| 54 | 58 |
| 55 # Add the deps to the tarball along with the Dockerfile. | 59 # Add the deps to the tarball along with the Dockerfile. |
| 56 with tarfile.open(args.output, 'w') as tarball: | 60 with tarfile.open(args.output, 'w') as tarball: |
| 57 tarball.add(args.dockerfile, arcname='Dockerfile') | 61 tarball.add(args.dockerfile, arcname='Dockerfile') |
| 62 tarball.add(args.startup_script, arcname='start_engine.sh') |
| 58 os.chdir(args.build_dir) | 63 os.chdir(args.build_dir) |
| 59 for dep in deps: | 64 for dep in deps: |
| 60 try: | 65 try: |
| 61 tarball.add(dep) | 66 tarball.add(dep) |
| 62 except OSError as e: | 67 except OSError as e: |
| 63 if e.errno == errno.ENOENT: | 68 if e.errno == errno.ENOENT: |
| 64 print >> sys.stderr, dep + " not found (did you build the engine?)" | 69 print >> sys.stderr, dep + " not found (did you build the engine?)" |
| 65 exit(1) | 70 exit(1) |
| 66 | 71 |
| 67 if __name__ == "__main__": | 72 if __name__ == "__main__": |
| 68 main() | 73 main() |
| OLD | NEW |