bitbake: fetch2/ssh.py: decode path back for ssh

The path has been encoded by urllib.parse.quote(), so decode it back for ssh.

Fixed when fetch from PREMIRRORS via ssh:
$ bitbake bonnie++ libsigc++-2.0 -cfetch

scp: /path/to/downloads/libsigc%2B%2B-2.10.7.tar.xz: No such file or directory

(Bitbake rev: c1c8fc678eb4783cea3974328a5fa8d1b79f1266)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2022-04-21 17:12:31 +08:00
committed by Richard Purdie
parent 1bd70f469d
commit 98a4a4a613

View File

@@ -32,6 +32,7 @@ IETF secsh internet draft:
import re, os
from bb.fetch2 import check_network_access, FetchMethod, ParameterError, runfetchcmd
import urllib
__pattern__ = re.compile(r'''
@@ -70,6 +71,7 @@ class SSH(FetchMethod):
"git:// prefix with protocol=ssh", urldata.url)
m = __pattern__.match(urldata.url)
path = m.group('path')
path = urllib.parse.unquote(path)
host = m.group('host')
urldata.localpath = os.path.join(d.getVar('DL_DIR'),
os.path.basename(os.path.normpath(path)))
@@ -99,7 +101,7 @@ class SSH(FetchMethod):
if path[0] != '~':
path = '/%s' % path
path = path.replace("%3A", ":")
path = urllib.parse.unquote(path)
fr += ':%s' % path
@@ -139,7 +141,7 @@ class SSH(FetchMethod):
if path[0] != '~':
path = '/%s' % path
path = path.replace("%3A", ":")
path = urllib.parse.unquote(path)
cmd = 'ssh -o BatchMode=true %s %s [ -f %s ]' % (
portarg,