bitbake: ssh: fix fetcher
* set localpath in urldata_init otherwise localpath and basename were None, when fetcher was trying to define .lock and .done paths basepath = d.expand("${DL_DIR}/%s" % os.path.basename(self.localpath or self.basename)) * remove "host" from localpath .done and .lock files are always using just basename, so if someone has 2 recipes with: SRC_URI = "ssh://foo/file.txt" SRC_URI = "ssh://bar/file.txt" then there will be only one file.txt.done in downloads anyway (and only first file.txt from first server will be returned on do_fetch (Bitbake rev: 41208760d70a657297f9ecfb48b74e2c3b594e70) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
c30ef8886d
commit
e863851045
|
@ -72,15 +72,14 @@ class SSH(FetchMethod):
|
||||||
def supports_checksum(self, urldata):
|
def supports_checksum(self, urldata):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def localpath(self, url, urldata, d):
|
def urldata_init(self, urldata, d):
|
||||||
m = __pattern__.match(urldata.url)
|
m = __pattern__.match(urldata.url)
|
||||||
path = m.group('path')
|
path = m.group('path')
|
||||||
host = m.group('host')
|
host = m.group('host')
|
||||||
lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path))
|
urldata.localpath = os.path.join(d.getVar('DL_DIR', True), os.path.basename(path))
|
||||||
return lpath
|
|
||||||
|
|
||||||
def download(self, url, urldata, d):
|
def download(self, url, urldata, d):
|
||||||
dldir = data.getVar('DL_DIR', d, True)
|
dldir = d.getVar('DL_DIR', True)
|
||||||
|
|
||||||
m = __pattern__.match(url)
|
m = __pattern__.match(url)
|
||||||
path = m.group('path')
|
path = m.group('path')
|
||||||
|
@ -89,16 +88,10 @@ class SSH(FetchMethod):
|
||||||
user = m.group('user')
|
user = m.group('user')
|
||||||
password = m.group('pass')
|
password = m.group('pass')
|
||||||
|
|
||||||
ldir = os.path.join(dldir, host)
|
|
||||||
lpath = os.path.join(ldir, os.path.basename(path))
|
|
||||||
|
|
||||||
if not os.path.exists(ldir):
|
|
||||||
os.makedirs(ldir)
|
|
||||||
|
|
||||||
if port:
|
if port:
|
||||||
port = '-P %s' % port
|
portarg = '-P %s' % port
|
||||||
else:
|
else:
|
||||||
port = ''
|
portarg = ''
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
fr = user
|
fr = user
|
||||||
|
@ -112,9 +105,9 @@ class SSH(FetchMethod):
|
||||||
|
|
||||||
import commands
|
import commands
|
||||||
cmd = 'scp -B -r %s %s %s/' % (
|
cmd = 'scp -B -r %s %s %s/' % (
|
||||||
port,
|
portarg,
|
||||||
commands.mkarg(fr),
|
commands.mkarg(fr),
|
||||||
commands.mkarg(ldir)
|
commands.mkarg(dldir)
|
||||||
)
|
)
|
||||||
|
|
||||||
bb.fetch2.check_network_access(d, cmd, urldata.url)
|
bb.fetch2.check_network_access(d, cmd, urldata.url)
|
||||||
|
|
Loading…
Reference in New Issue