From 75a524e9a53ef4dc941947cb99d34fdf1ccab6e4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 16 May 2013 19:06:41 -0700 Subject: [PATCH] PORTAGE_BINHOST: sftp with FETCHCOMMAND_SFTP Do not generate the sftp command for downloading the Packages file, and simply use the FETCHCOMMAND_SFTP setting. --- pym/portage/dbapi/bintree.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 7f2d01765..14d05ad48 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -911,20 +911,10 @@ class binarytree(object): path = parsed_url.path.rstrip("/") + "/Packages" - if parsed_url.scheme == 'sftp': - # The sftp command complains about 'Illegal seek' if - # we try to make it write to /dev/stdout, so use a - # temp file instead. - fd, tmp_filename = tempfile.mkstemp() - os.close(fd) - if port is not None: - port_args = ['-P', "%s" % (port,)] - proc = subprocess.Popen(['sftp'] + port_args + \ - [user_passwd + host + ":" + path, tmp_filename]) - if proc.wait() != os.EX_OK: - raise EnvironmentError("sftp failed") - f = open(tmp_filename, 'rb') - elif parsed_url.scheme == 'ssh': + if parsed_url.scheme == 'ssh': + # Use a pipe so that we can terminate the download + # early if we detect that the TIMESTAMP header + # matches that of the cached Packages file. if port is not None: port_args = ['-p', "%s" % (port,)] proc = subprocess.Popen(['ssh'] + port_args + \ -- 2.26.2