Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198)
Date: Fri, 06 May 2016 16:45:52
Message-Id: 1462553051-32237-1-git-send-email-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] make.globals: fix FETCHCOMMAND_SSH and FETCHCOMMAND_SFTP to respect ssh_config port (bug 499198) by Zac Medico
1 X-Gentoo-bug: 499198
2 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=499198
3 ---
4 This is the same as the previous patch, but formatted with --word-diff.
5
6 cnf/make.globals | 4 ++--
7 pym/portage/tests/util/test_getconfig.py | 4 ++--
8 2 files changed, 4 insertions(+), 4 deletions(-)
9
10 diff --git a/cnf/make.globals b/cnf/make.globals
11 index 836bb5c..18eba94 100644
12 --- a/cnf/make.globals
13 +++ b/cnf/make.globals
14 @@ -43,11 +43,11 @@ FETCHCOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
15 RESUMECOMMAND_RSYNC="rsync -avP \"\${URI}\" \"\${DISTDIR}/\${FILE}\""
16
17 # NOTE: rsync will evaluate quotes embedded inside PORTAGE_SSH_OPTS
18 FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && [-port=22-]{+port=+} ; exec rsync --rsh=\\\"ssh [--p\\\${port}-]{+\\\${port:+-p\\\${port}}+} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
19 RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH}
20
21 # NOTE: bash eval is used to evaluate quotes embedded inside PORTAGE_SSH_OPTS
22 FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && [-port=22-]{+port=+} ; eval \\\"declare -a ssh_opts=(\\\${3})\\\" ; exec sftp [--P \\\${port}-]{+\\\${port:+-P \\\${port}}+} \\\"\\\${ssh_opts[@]}\\\" \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
23
24 # Default user options
25 FEATURES="assume-digests binpkg-logs
26 diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py
27 index b72bd6a..05e3147 100644
28 --- a/pym/portage/tests/util/test_getconfig.py
29 +++ b/pym/portage/tests/util/test_getconfig.py
30 @@ -20,8 +20,8 @@ class GetConfigTestCase(TestCase):
31 _cases = {
32 'FETCHCOMMAND' : 'wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}"',
33 'FETCHCOMMAND_RSYNC' : 'rsync -avP "${URI}" "${DISTDIR}/${FILE}"',
34 'FETCHCOMMAND_SFTP' : 'bash -c "x=\\${2#sftp://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && [-port=22-]{+port=+} ; eval \\"declare -a ssh_opts=(\\${3})\\" ; exec sftp [--P \\${port}-]{+\\${port:+-P \\${port}}+} \\"\\${ssh_opts[@]}\\" \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
35 'FETCHCOMMAND_SSH' : 'bash -c "x=\\${2#ssh://} ; host=\\${x%%/*} ; port=\\${host##*:} ; host=\\${host%:*} ; [[ \\${host} = \\${port} ]] && [-port=22-]{+port=+} ; exec rsync --rsh=\\"ssh [--p\\${port}-]{+\\${port:+-p\\${port}}+} \\${3}\\" -avP \\"\\${host}:/\\${x#*/}\\" \\"\\$1\\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}"',
36 'PORTAGE_ELOG_MAILSUBJECT' : '[portage] ebuild log for ${PACKAGE} on ${HOST}'
37 }
38
39 --
40 2.7.4

Replies