| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2012 The LUCI Authors. All rights reserved. | 2 # Copyright 2012 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs a command with optional isolated input/output. | 6 """Runs a command with optional isolated input/output. |
| 7 | 7 |
| 8 Despite name "run_isolated", can run a generic non-isolated command specified as | 8 Despite name "run_isolated", can run a generic non-isolated command specified as |
| 9 args. | 9 args. |
| 10 | 10 |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 if not site_root.startswith(run_dir): | 756 if not site_root.startswith(run_dir): |
| 757 raise cipd.Error('Invalid CIPD package path "%s"' % path) | 757 raise cipd.Error('Invalid CIPD package path "%s"' % path) |
| 758 | 758 |
| 759 # Do not clean site_root before installation because it may contain other | 759 # Do not clean site_root before installation because it may contain other |
| 760 # site roots. | 760 # site roots. |
| 761 file_path.ensure_tree(site_root, 0770) | 761 file_path.ensure_tree(site_root, 0770) |
| 762 pins = client.ensure( | 762 pins = client.ensure( |
| 763 site_root, [(name, vers) for name, vers, _ in pkgs], | 763 site_root, [(name, vers) for name, vers, _ in pkgs], |
| 764 cache_dir=cipd_cache_dir, | 764 cache_dir=cipd_cache_dir, |
| 765 timeout=timeoutfn()) | 765 timeout=timeoutfn()) |
| 766 for i, pin in enumerate(pins): | 766 for i, pin in enumerate(pins[""]): |
| 767 insert_pin(path, pin[0], pin[1], pkgs[i][2]) | 767 insert_pin(path, pin[0], pin[1], pkgs[i][2]) |
| 768 file_path.make_tree_files_read_only(site_root) | 768 file_path.make_tree_files_read_only(site_root) |
| 769 | 769 |
| 770 total_duration = time.time() - start | 770 total_duration = time.time() - start |
| 771 logging.info( | 771 logging.info( |
| 772 'Installing CIPD client and packages took %d seconds', total_duration) | 772 'Installing CIPD client and packages took %d seconds', total_duration) |
| 773 | 773 |
| 774 assert None not in package_pins | 774 assert None not in package_pins |
| 775 | 775 |
| 776 yield CipdInfo( | 776 yield CipdInfo( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 return 1 | 1007 return 1 |
| 1008 | 1008 |
| 1009 | 1009 |
| 1010 if __name__ == '__main__': | 1010 if __name__ == '__main__': |
| 1011 subprocess42.inhibit_os_error_reporting() | 1011 subprocess42.inhibit_os_error_reporting() |
| 1012 # Ensure that we are always running with the correct encoding. | 1012 # Ensure that we are always running with the correct encoding. |
| 1013 fix_encoding.fix_encoding() | 1013 fix_encoding.fix_encoding() |
| 1014 file_path.enable_symlink() | 1014 file_path.enable_symlink() |
| 1015 | 1015 |
| 1016 sys.exit(main(sys.argv[1:])) | 1016 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |