OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Common utilities for all buildbot scripts that specifically don't rely | 5 """Common utilities for all buildbot scripts that specifically don't rely |
6 on having a full chromium checkout. | 6 on having a full chromium checkout. |
7 """ | 7 """ |
8 | 8 |
9 import os | 9 import os |
10 import subprocess | 10 import subprocess |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 sys.stdout.flush() | 45 sys.stdout.flush() |
46 sys.stderr.flush() | 46 sys.stderr.flush() |
47 | 47 |
48 | 48 |
49 def CopyDir(src, dst, excludes=['.svn', '*/.svn']): | 49 def CopyDir(src, dst, excludes=['.svn', '*/.svn']): |
50 """Recursively copy a directory using.""" | 50 """Recursively copy a directory using.""" |
51 args = ['-r', src, dst] | 51 args = ['-r', src, dst] |
52 for exc in excludes: | 52 for exc in excludes: |
53 args.append('--exclude=' + exc) | 53 args.append('--exclude=' + exc) |
54 print 'cp -r %s %s' % (src, dst) | 54 print 'cp -r %s %s' % (src, dst) |
| 55 if os.path.abspath(src) == os.path.abspath(dst): |
| 56 ErrorExit('ERROR: Copying directory onto itself: ' + src) |
55 oshelpers.Copy(args) | 57 oshelpers.Copy(args) |
56 | 58 |
57 | 59 |
58 def CopyFile(src, dst): | 60 def CopyFile(src, dst): |
59 print 'cp -r %s %s' % (src, dst) | 61 print 'cp -r %s %s' % (src, dst) |
| 62 if os.path.abspath(src) == os.path.abspath(dst): |
| 63 ErrorExit('ERROR: Copying file onto itself: ' + src) |
60 args = [src, dst] | 64 args = [src, dst] |
61 oshelpers.Copy(args) | 65 oshelpers.Copy(args) |
62 | 66 |
63 | 67 |
64 def RemoveDir(dst): | 68 def RemoveDir(dst): |
65 """Remove the provided path.""" | 69 """Remove the provided path.""" |
66 print 'rm -fr ' + dst | 70 print 'rm -fr ' + dst |
67 oshelpers.Remove(['-fr', dst]) | 71 oshelpers.Remove(['-fr', dst]) |
68 | 72 |
69 | 73 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 106 |
103 subprocess.check_call( | 107 subprocess.check_call( |
104 '%s cp -a public-read %s %s' % (GetGsutil(), filename, full_dst), | 108 '%s cp -a public-read %s %s' % (GetGsutil(), filename, full_dst), |
105 shell=True, | 109 shell=True, |
106 cwd=cwd) | 110 cwd=cwd) |
107 url = 'https://commondatastorage.googleapis.com/'\ | 111 url = 'https://commondatastorage.googleapis.com/'\ |
108 '%s/%s' % (bucket_path, filename) | 112 '%s/%s' % (bucket_path, filename) |
109 if step_link: | 113 if step_link: |
110 print '@@@STEP_LINK@download@%s@@@' % url | 114 print '@@@STEP_LINK@download@%s@@@' % url |
111 sys.stdout.flush() | 115 sys.stdout.flush() |
OLD | NEW |