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, |