summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/ssh.py
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2013-01-28 16:56:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-31 12:46:20 +0000
commite863851045ffce62bef65d8d414e11489641395c (patch)
tree1646f31aec8ab3bf27edb4dc42e1a03f4843a671 /bitbake/lib/bb/fetch2/ssh.py
parentc30ef8886d5597fb2b21fb101d4485a280ba73d4 (diff)
downloadpoky-e863851045ffce62bef65d8d414e11489641395c.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/fetch2/ssh.py')
-rw-r--r--bitbake/lib/bb/fetch2/ssh.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py
index 8d6434a7eb..61db435e71 100644
--- a/bitbake/lib/bb/fetch2/ssh.py
+++ b/bitbake/lib/bb/fetch2/ssh.py
@@ -72,15 +72,14 @@ class SSH(FetchMethod):
72 def supports_checksum(self, urldata): 72 def supports_checksum(self, urldata):
73 return False 73 return False
74 74
75 def localpath(self, url, urldata, d): 75 def urldata_init(self, urldata, d):
76 m = __pattern__.match(urldata.url) 76 m = __pattern__.match(urldata.url)
77 path = m.group('path') 77 path = m.group('path')
78 host = m.group('host') 78 host = m.group('host')
79 lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path)) 79 urldata.localpath = os.path.join(d.getVar('DL_DIR', True), os.path.basename(path))
80 return lpath
81 80
82 def download(self, url, urldata, d): 81 def download(self, url, urldata, d):
83 dldir = data.getVar('DL_DIR', d, True) 82 dldir = d.getVar('DL_DIR', True)
84 83
85 m = __pattern__.match(url) 84 m = __pattern__.match(url)
86 path = m.group('path') 85 path = m.group('path')
@@ -89,16 +88,10 @@ class SSH(FetchMethod):
89 user = m.group('user') 88 user = m.group('user')
90 password = m.group('pass') 89 password = m.group('pass')
91 90
92 ldir = os.path.join(dldir, host)
93 lpath = os.path.join(ldir, os.path.basename(path))
94
95 if not os.path.exists(ldir):
96 os.makedirs(ldir)
97
98 if port: 91 if port:
99 port = '-P %s' % port 92 portarg = '-P %s' % port
100 else: 93 else:
101 port = '' 94 portarg = ''
102 95
103 if user: 96 if user:
104 fr = user 97 fr = user
@@ -112,9 +105,9 @@ class SSH(FetchMethod):
112 105
113 import commands 106 import commands
114 cmd = 'scp -B -r %s %s %s/' % ( 107 cmd = 'scp -B -r %s %s %s/' % (
115 port, 108 portarg,
116 commands.mkarg(fr), 109 commands.mkarg(fr),
117 commands.mkarg(ldir) 110 commands.mkarg(dldir)
118 ) 111 )
119 112
120 bb.fetch2.check_network_access(d, cmd, urldata.url) 113 bb.fetch2.check_network_access(d, cmd, urldata.url)