aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-31 03:27:03 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-31 03:27:03 -0800
commit86dce706f512e8596cd877fe392dab2f678d425d (patch)
treebc20ec7b18a5be3da331b390e49f29b3bf2ef345 /pym/portage/dbapi/bintree.py
parentbintree: add timeout for closing binhost conn (diff)
downloadportage-86dce706f512e8596cd877fe392dab2f678d425d.tar.gz
portage-86dce706f512e8596cd877fe392dab2f678d425d.tar.bz2
portage-86dce706f512e8596cd877fe392dab2f678d425d.zip
Omit user:pass@ from binhost Packages cache path.
Diffstat (limited to 'pym/portage/dbapi/bintree.py')
-rw-r--r--pym/portage/dbapi/bintree.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 68d6845db..2da7799e8 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -733,6 +733,14 @@ class binarytree(object):
parsed_url = urlparse(base_url)
host = parsed_url.netloc
port = parsed_url.port
+ user = None
+ passwd = None
+ user_passwd = ""
+ if "@" in host:
+ user, host = host.split("@", 1)
+ user_passwd = user + "@"
+ if ":" in user:
+ user, passwd = user.split(":", 1)
port_args = []
if port is not None:
port_str = ":%s" % (port,)
@@ -775,7 +783,7 @@ class binarytree(object):
if port is not None:
port_args = ['-P', "%s" % (port,)]
proc = subprocess.Popen(['sftp'] + port_args + \
- [host + ":" + path, tmp_filename])
+ [user_passwd + host + ":" + path, tmp_filename])
if proc.wait() != os.EX_OK:
raise
f = open(tmp_filename, 'rb')
@@ -783,7 +791,8 @@ class binarytree(object):
if port is not None:
port_args = ['-p', "%s" % (port,)]
proc = subprocess.Popen(['ssh'] + port_args + \
- [host, '--', 'cat', path], stdout=subprocess.PIPE)
+ [user_passwd + host, '--', 'cat', path],
+ stdout=subprocess.PIPE)
f = proc.stdout
else:
raise