diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2013-01-31 19:12:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-03 17:01:45 +0000 |
commit | 5ac3ab3b565f70cd90cfbe121ddd2d899bfc0214 (patch) | |
tree | 162d8bd166914a88a1cffe00d47c1b27fb562f4d | |
parent | 4a97b83d1d48a5df58733058d41b665b9230198f (diff) | |
download | bitbake-5ac3ab3b565f70cd90cfbe121ddd2d899bfc0214.tar.gz |
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
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/fetch2/ssh.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/bb/fetch2/ssh.py b/lib/bb/fetch2/ssh.py index 8d6434a7e..61db435e7 100644 --- a/lib/bb/fetch2/ssh.py +++ b/lib/bb/fetch2/ssh.py @@ -72,15 +72,14 @@ class SSH(FetchMethod): def supports_checksum(self, urldata): return False - def localpath(self, url, urldata, d): + def urldata_init(self, urldata, d): m = __pattern__.match(urldata.url) path = m.group('path') host = m.group('host') - lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path)) - return lpath + urldata.localpath = os.path.join(d.getVar('DL_DIR', True), os.path.basename(path)) def download(self, url, urldata, d): - dldir = data.getVar('DL_DIR', d, True) + dldir = d.getVar('DL_DIR', True) m = __pattern__.match(url) path = m.group('path') @@ -89,16 +88,10 @@ class SSH(FetchMethod): user = m.group('user') 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: - port = '-P %s' % port + portarg = '-P %s' % port else: - port = '' + portarg = '' if user: fr = user @@ -112,9 +105,9 @@ class SSH(FetchMethod): import commands cmd = 'scp -B -r %s %s %s/' % ( - port, + portarg, commands.mkarg(fr), - commands.mkarg(ldir) + commands.mkarg(dldir) ) bb.fetch2.check_network_access(d, cmd, urldata.url) |