From: Zac Medico Date: Fri, 17 May 2013 02:06:41 +0000 (-0700) Subject: PORTAGE_BINHOST: sftp with FETCHCOMMAND_SFTP X-Git-Tag: v2.2.0_alpha176~11 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=75a524e9a53ef4dc941947cb99d34fdf1ccab6e4;p=portage.git PORTAGE_BINHOST: sftp with FETCHCOMMAND_SFTP Do not generate the sftp command for downloading the Packages file, and simply use the FETCHCOMMAND_SFTP setting. --- 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 + \