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

Side by Side Diff: chromium_utils.py

Issue 42110: Support Linux build archiving with ssh transfers. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/tools/buildbot/scripts/common/
Patch Set: Created 11 years, 9 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 | « chromium_config.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 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 """ Set of basic operations/utilities that are used by the build. """ 6 """ Set of basic operations/utilities that are used by the build. """
7 7
8 import copy 8 import copy
9 import errno 9 import errno
10 import fnmatch 10 import fnmatch
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 def GetGClientCommand(platform=None): 442 def GetGClientCommand(platform=None):
443 """Returns the executable command name, depending on the platform. 443 """Returns the executable command name, depending on the platform.
444 """ 444 """
445 if not platform: 445 if not platform:
446 platform = sys.platform 446 platform = sys.platform
447 if platform == 'win32': 447 if platform == 'win32':
448 # Windows doesn't want to depend on bash. 448 # Windows doesn't want to depend on bash.
449 return 'gclient.bat' 449 return 'gclient.bat'
450 else: 450 else:
451 return 'gclient' 451 return 'gclient'
452
453
454 # Linux scripts use ssh to to move files to the archive host.
455 def SshMakeDirectory(host, dest_path):
456 """Creates the entire dest_path on the remote ssh host.
457 """
458 command = ['ssh', host, 'mkdir', '-p', dest_path]
Nicolas Sylvain 2009/03/12 04:28:12 oh. my other suggestion wont work really well here
459 result = RunCommand(command)
460 if result:
461 raise ExternalError('Failed to ssh mkdir "%s" on "%s" (%s)' %
462 (dest_path, host, result))
463
464 def SshCopyFiles(srcs, host, dst):
465 """Copies the srcs file(s) to dst on the remote ssh host.
466 dst is expected to exist.
467 """
468 command = ['scp', srcs, host + ':' + dst]
469 result = RunCommand(command)
470 if result:
471 raise ExternalError('Failed to scp "%s" to "%s" (%s)' %
472 (srcs, host + ':' + dst, result))
473
474 def SshCopyTree(srctree, host, dst):
M-A Ruel 2009/03/12 11:02:22 So it takes 3 separate connections to do the whole
475 """Recursively copies the srctree to dst on the remote ssh host.
476 For consistency with shutil, dst is expected to not exist.
477 """
478 command = ['ssh', host, '[ -d "%s" ]' % dst]
479 result = RunCommand(command)
480 if result:
481 raise ExternalError('SshCopyTree destination directory "%s" already exists.'
482 % host + ':' + dst)
483
484 SshMakeDirectory(host, os.path.dirname(dst))
485 command = ['scp', '-r', '-p', srctree, host + ':' + dst]
486 result = RunCommand(command)
487 if result:
488 raise ExternalError('Failed to scp "%s" to "%s" (%s)' %
489 (srctree, host + ':' + dst, result))
OLDNEW
« no previous file with comments | « chromium_config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698