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

Unified Diff: client/common_lib/base_packages.py

Issue 6883035: Merge remote branch 'autotest-upstream/master' into autotest-merge (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 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
Index: client/common_lib/base_packages.py
diff --git a/client/common_lib/base_packages.py b/client/common_lib/base_packages.py
index 8a6700454fe3388bd4bb6184944c9b5e645e8afe..dc1aacb85ada5094ca1fffc806267475f3b84360 100644
--- a/client/common_lib/base_packages.py
+++ b/client/common_lib/base_packages.py
@@ -28,27 +28,36 @@ def parse_ssh_path(repo):
"Incorrect SSH path in global_config: %s" % repo)
-def repo_run_command(repo, cmd, ignore_status=False):
+def repo_run_command(repo, cmd, ignore_status=False, cd=True):
"""Run a command relative to the repos path"""
repo = repo.strip()
run_cmd = None
+ cd_str = ''
if repo.startswith('ssh://'):
username = None
hostline, remote_path = parse_ssh_path(repo)
+ if cd:
+ cd_str = 'cd %s && ' % remote_path
if '@' in hostline:
username, host = hostline.split('@')
- run_cmd = 'ssh %s@%s "cd %s && %s"' % (username, host,
- remote_path, cmd)
+ run_cmd = 'ssh %s@%s "%s%s"' % (username, host, cd_str, cmd)
else:
- run_cmd = 'ssh %s "cd %s && %s"' % (host, remote_path, cmd)
+ run_cmd = 'ssh %s "%s%s"' % (host, cd_str, cmd)
else:
- run_cmd = "cd %s && %s" % (repo, cmd)
+ if cd:
+ cd_str = 'cd %s && ' % repo
+ run_cmd = "%s%s" % (cd_str, cmd)
if run_cmd:
return utils.run(run_cmd, ignore_status=ignore_status)
+def create_directory(repo):
+ _, remote_path = parse_ssh_path(repo)
+ repo_run_command(repo, 'mkdir -p %s' % remote_path, cd=False)
+
+
def check_diskspace(repo, min_free=None):
# Note: 1 GB = 10**9 bytes (SI unit).
if not min_free:
@@ -272,6 +281,9 @@ class BasePackageManager(object):
if not repo.startswith('/') and not repo.startswith('ssh:'):
return
try:
+ # without comment out this, we lost the ability to package into
+ # local directories. -- ericli
+# create_directory(repo)
check_diskspace(repo)
check_write(repo)
except (error.RepoWriteError, error.RepoUnknownError,

Powered by Google App Engine
This is Rietveld 408576698