Summary: | sys-apps/portage: support PORTAGE_SSH_OPTS to provide arguments to ssh and sftp | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Jason A. Donenfeld <zx2c4> |
Component: | [OLD] Core system | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | Keywords: | InVCS |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=572494 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 468524 |
Description
Jason A. Donenfeld
![]() So both ssh and sftp commands support all of the same arguments? Maybe it's better to have a separate variable for each one? AFAIK, they support the same options. The port options may be different depending upon what command you are using ssh use '-p' - lowercase 'p' scp/sftp use '-P' - uppercase 'P' Another thing to consider is that the binhost fetch code has 2 different parts which behave differently: 1) Fetching of the Packages file can close the connection early if the TIMESTAMP header has a value equal to the cached copy. The is optimized to avoid downloading the the whole (megabytes) of file when it has not been modified since it was previously downloaded. The relevant code parses the PORTAGE_BINHOST URI and generates ssh arguments as follows: if port is not None: port_args = ['-p', "%s" % (port,)] proc = subprocess.Popen(['ssh'] + port_args + \ [user_passwd + host, '--', 'cat', path], stdout=subprocess.PIPE) 2) Meanwhile, fetching of the actual binary packages uses this command: FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" It seems like we should be able to merge the proposed SSH_FETCH_ARGUMENTS value into the --rsh part of FETCHCOMMAND_SSH, and we can also merge it into the generated arguments in part (1). Does everyone think that will work? (In reply to comment #4) > It seems like we should be able to merge the proposed SSH_FETCH_ARGUMENTS > value into the --rsh part of FETCHCOMMAND_SSH, and we can also merge it into > the generated arguments in part (1). Does everyone think that will work? Perfect. (In reply to comment #3) > The port options may be different depending upon what command you are using Ahh, right, this. Shucks. At least there's "-oPort=2222", which works on all of them. If sftp doesn't have a way to pipe the file like ssh has, then there's no point having a separate kind of fetch optimized for the Packages file. So for sftp, we can include the SSH_FETCH_ARGUMENTS variable in the default FETCHCOMMAND_SFTP setting, and use that command for both the Packages file and the binary packages. Only use FETCHCOMMAND_SFTP for sftp support: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75a524e9a53ef4dc941947cb99d34fdf1ccab6e4 Note that the current default FETCHCOMMAND_SFTP looks like this: FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec sftp -P \\\${port} \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" We can update it to insert SSH_FETCH_ARGUMENTS after the port arguments. Support for PORTAGE_SSH_OPTS is in git: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1e984dab27458e3026163c5690aec5fd3298dd8b This is fixed in 2.1.12.1 and 2.2.0_alpha176. |