| 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 """Does one of the following depending on the --mode argument: | 6 """Does one of the following depending on the --mode argument: |
| 7 check verify all the inputs exist, touches the file specified with | 7 check verify all the inputs exist, touches the file specified with |
| 8 --result and exits. | 8 --result and exits. |
| 9 hashtable puts a manifest file and hard links each of the inputs into the | 9 hashtable puts a manifest file and hard links each of the inputs into the |
| 10 output directory. | 10 output directory. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 print >> sys.stderr, 'Using first input %s as executable' % infiles[0] | 114 print >> sys.stderr, 'Using first input %s as executable' % infiles[0] |
| 115 cmd = [infiles[0]] | 115 cmd = [infiles[0]] |
| 116 outdir = None | 116 outdir = None |
| 117 try: | 117 try: |
| 118 outdir = tempfile.mkdtemp(prefix='isolate') | 118 outdir = tempfile.mkdtemp(prefix='isolate') |
| 119 tree_creator.recreate_tree( | 119 tree_creator.recreate_tree( |
| 120 outdir, indir, infiles, tree_creator.HARDLINK) | 120 outdir, indir, infiles, tree_creator.HARDLINK) |
| 121 if read_only: | 121 if read_only: |
| 122 tree_creator.make_writable(outdir, True) | 122 tree_creator.make_writable(outdir, True) |
| 123 | 123 |
| 124 # TODO(maruel): Remove me. Layering violation. Used by | |
| 125 # base/base_paths_linux.cc | |
| 126 env = os.environ.copy() | |
| 127 env['CR_SOURCE_ROOT'] = outdir.encode() | |
| 128 # Rebase the command to the right path. | 124 # Rebase the command to the right path. |
| 129 cmd[0] = os.path.join(outdir, cmd[0]) | 125 cmd[0] = os.path.join(outdir, cmd[0]) |
| 130 logging.info('Running %s' % cmd) | 126 logging.info('Running %s' % cmd) |
| 131 result = subprocess.call(cmd, cwd=outdir, env=env) | 127 result = subprocess.call(cmd, cwd=outdir) |
| 132 if not result and resultfile: | 128 if not result and resultfile: |
| 133 # Signal the build tool that the test succeeded. | 129 # Signal the build tool that the test succeeded. |
| 134 touch(resultfile) | 130 touch(resultfile) |
| 135 return result | 131 return result |
| 136 finally: | 132 finally: |
| 137 if read_only: | 133 if read_only: |
| 138 tree_creator.make_writable(outdir, False) | 134 tree_creator.make_writable(outdir, False) |
| 139 rmtree(outdir) | 135 rmtree(outdir) |
| 140 | 136 |
| 141 | 137 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 options.mode, | 202 options.mode, |
| 207 options.read_only, | 203 options.read_only, |
| 208 cmd) | 204 cmd) |
| 209 except tree_creator.MappingError, e: | 205 except tree_creator.MappingError, e: |
| 210 print >> sys.stderr, str(e) | 206 print >> sys.stderr, str(e) |
| 211 return 1 | 207 return 1 |
| 212 | 208 |
| 213 | 209 |
| 214 if __name__ == '__main__': | 210 if __name__ == '__main__': |
| 215 sys.exit(main()) | 211 sys.exit(main()) |
| OLD | NEW |