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

Side by Side Diff: blimp/tools/create-bundle.py

Issue 2028353003: Support for bundling Chromium unittests into a tarball. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates based on review feedback. Created 4 years, 6 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
« no previous file with comments | « blimp/tools/bundle-engine.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 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 target 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.gz 9 docker build - < ../../out-linux/Debug/blimp_engine_deps.tar.gz
10 ''' 10 '''
11 11
12 12
13 import argparse 13 import argparse
14 import os 14 import os
15 import subprocess 15 import subprocess
16 import sys 16 import sys
(...skipping 16 matching lines...) Expand all
33 parser = argparse.ArgumentParser(description=__doc__) 33 parser = argparse.ArgumentParser(description=__doc__)
34 parser.add_argument('--build-dir', 34 parser.add_argument('--build-dir',
35 help=('build output directory (e.g. out/Debug)'), 35 help=('build output directory (e.g. out/Debug)'),
36 required=True, 36 required=True,
37 metavar='DIR') 37 metavar='DIR')
38 parser.add_argument('--dockerfile', 38 parser.add_argument('--dockerfile',
39 help=('Dockerfile to add to the bundle'), 39 help=('Dockerfile to add to the bundle'),
40 required=True, 40 required=True,
41 metavar='FILE') 41 metavar='FILE')
42 parser.add_argument('--startup-script', 42 parser.add_argument('--startup-script',
43 help=('Engine startup script to add to the bundle'), 43 help=('optional startup script to add to the bundle'),
44 required=True, 44 required=False,
45 metavar='FILE') 45 metavar='FILE')
46 parser.add_argument('--manifest', 46 parser.add_argument('--manifest',
47 help=('engine manifest'), 47 help=('file listing the set of files to include in '
48 'the bundle'),
48 required=True) 49 required=True)
49 parser.add_argument('--output', 50 parser.add_argument('--output',
50 help=('name and path of bundle to create'), 51 help=('name and path of bundle to create'),
51 required=True, 52 required=True,
52 metavar='FILE') 53 metavar='FILE')
53 args = parser.parse_args() 54 args = parser.parse_args()
54 55
55 deps = ReadDependencies(args.manifest) 56 deps = ReadDependencies(args.manifest)
56 57
57 dockerfile_dirname, dockerfile_basename = os.path.split(args.dockerfile) 58 dockerfile_dirname, dockerfile_basename = os.path.split(args.dockerfile)
58 startup_script_dirname, startup_script_basename = os.path.split( 59 if args.startup_script:
59 args.startup_script) 60 startup_script_dirname, startup_script_basename = os.path.split(
61 args.startup_script)
60 62
61 try: 63 try:
62 env = os.environ.copy() 64 env = os.environ.copy()
63 # Use fastest possible mode when gzipping. 65 # Use fastest possible mode when gzipping.
64 env["GZIP"] = "-1" 66 env["GZIP"] = "-1"
67 subprocess_args = [
68 "tar",
69 "-zcf", args.output,
70 # Ensure tarball content group permissions are appropriately set for
71 # use as part of a "docker build". That is group readable with
72 # executable files also being group executable.
73 "--mode=g+rX",
74 "-C", dockerfile_dirname, dockerfile_basename,
75 "-C", args.build_dir] + deps
76 if args.startup_script:
77 startup_script_dirname, startup_script_basename = os.path.split(
78 args.startup_script)
79 subprocess_args.extend(
80 ["-C", startup_script_dirname, startup_script_basename])
65 subprocess.check_output( 81 subprocess.check_output(
66 ["tar", 82 subprocess_args,
67 "-zcf", args.output,
68 # Ensure tarball content group permissions are appropriately set for
69 # use as part of a "docker build". That is group readable with
70 # executable files also being group executable.
71 "--mode=g+rX",
72 "-C", dockerfile_dirname, dockerfile_basename,
73 "-C", startup_script_dirname, startup_script_basename,
74 "-C", args.build_dir] + deps,
75 # Redirect stderr to stdout, so that its output is captured. 83 # Redirect stderr to stdout, so that its output is captured.
76 stderr=subprocess.STDOUT, 84 stderr=subprocess.STDOUT,
77 env=env) 85 env=env)
78 except subprocess.CalledProcessError as e: 86 except subprocess.CalledProcessError as e:
79 print >> sys.stderr, "Failed to create tarball:" 87 print >> sys.stderr, "Failed to create tarball:"
80 print >> sys.stderr, e.output 88 print >> sys.stderr, e.output
81 sys.exit(1) 89 sys.exit(1)
82 90
83 if __name__ == "__main__": 91 if __name__ == "__main__":
84 main() 92 main()
OLDNEW
« no previous file with comments | « blimp/tools/bundle-engine.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698