1 |
commit: 75a524e9a53ef4dc941947cb99d34fdf1ccab6e4 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 17 02:06:41 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 17 02:06:41 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75a524e9 |
7 |
|
8 |
PORTAGE_BINHOST: sftp with FETCHCOMMAND_SFTP |
9 |
|
10 |
Do not generate the sftp command for downloading the Packages file, and |
11 |
simply use the FETCHCOMMAND_SFTP setting. |
12 |
|
13 |
--- |
14 |
pym/portage/dbapi/bintree.py | 18 ++++-------------- |
15 |
1 files changed, 4 insertions(+), 14 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py |
18 |
index 7f2d017..14d05ad 100644 |
19 |
--- a/pym/portage/dbapi/bintree.py |
20 |
+++ b/pym/portage/dbapi/bintree.py |
21 |
@@ -911,20 +911,10 @@ class binarytree(object): |
22 |
|
23 |
path = parsed_url.path.rstrip("/") + "/Packages" |
24 |
|
25 |
- if parsed_url.scheme == 'sftp': |
26 |
- # The sftp command complains about 'Illegal seek' if |
27 |
- # we try to make it write to /dev/stdout, so use a |
28 |
- # temp file instead. |
29 |
- fd, tmp_filename = tempfile.mkstemp() |
30 |
- os.close(fd) |
31 |
- if port is not None: |
32 |
- port_args = ['-P', "%s" % (port,)] |
33 |
- proc = subprocess.Popen(['sftp'] + port_args + \ |
34 |
- [user_passwd + host + ":" + path, tmp_filename]) |
35 |
- if proc.wait() != os.EX_OK: |
36 |
- raise EnvironmentError("sftp failed") |
37 |
- f = open(tmp_filename, 'rb') |
38 |
- elif parsed_url.scheme == 'ssh': |
39 |
+ if parsed_url.scheme == 'ssh': |
40 |
+ # Use a pipe so that we can terminate the download |
41 |
+ # early if we detect that the TIMESTAMP header |
42 |
+ # matches that of the cached Packages file. |
43 |
if port is not None: |
44 |
port_args = ['-p', "%s" % (port,)] |
45 |
proc = subprocess.Popen(['ssh'] + port_args + \ |