summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2013-01-31 18:12:08 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-03 17:02:22 (GMT)
commit2b300848744ba879938612850f313e3256360dc6 (patch)
tree86669e8defd84928e0d1c00d41659dfb1c728927
parent955827af15f611189c66850fd077de344e1285c3 (diff)
downloadpoky-2b300848744ba879938612850f313e3256360dc6.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: 5ac3ab3b565f70cd90cfbe121ddd2d899bfc0214) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 8d6434a..61db435 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)