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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromium_config.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromium_utils.py
===================================================================
--- chromium_utils.py (revision 11516)
+++ chromium_utils.py (working copy)
@@ -449,3 +449,41 @@
return 'gclient.bat'
else:
return 'gclient'
+
+
+# Linux scripts use ssh to to move files to the archive host.
+def SshMakeDirectory(host, dest_path):
+ """Creates the entire dest_path on the remote ssh host.
+ """
+ command = ['ssh', host, 'mkdir', '-p', dest_path]
Nicolas Sylvain 2009/03/12 04:28:12 oh. my other suggestion wont work really well here
+ result = RunCommand(command)
+ if result:
+ raise ExternalError('Failed to ssh mkdir "%s" on "%s" (%s)' %
+ (dest_path, host, result))
+
+def SshCopyFiles(srcs, host, dst):
+ """Copies the srcs file(s) to dst on the remote ssh host.
+ dst is expected to exist.
+ """
+ command = ['scp', srcs, host + ':' + dst]
+ result = RunCommand(command)
+ if result:
+ raise ExternalError('Failed to scp "%s" to "%s" (%s)' %
+ (srcs, host + ':' + dst, result))
+
+def SshCopyTree(srctree, host, dst):
M-A Ruel 2009/03/12 11:02:22 So it takes 3 separate connections to do the whole
+ """Recursively copies the srctree to dst on the remote ssh host.
+ For consistency with shutil, dst is expected to not exist.
+ """
+ command = ['ssh', host, '[ -d "%s" ]' % dst]
+ result = RunCommand(command)
+ if result:
+ raise ExternalError('SshCopyTree destination directory "%s" already exists.'
+ % host + ':' + dst)
+
+ SshMakeDirectory(host, os.path.dirname(dst))
+ command = ['scp', '-r', '-p', srctree, host + ':' + dst]
+ result = RunCommand(command)
+ if result:
+ raise ExternalError('Failed to scp "%s" to "%s" (%s)' %
+ (srctree, host + ':' + dst, result))
« 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