summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch/ssh.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch/ssh.py')
-rw-r--r--bitbake/lib/bb/fetch/ssh.py94
1 files changed, 45 insertions, 49 deletions
diff --git a/bitbake/lib/bb/fetch/ssh.py b/bitbake/lib/bb/fetch/ssh.py
index 57874d5ba9..e5f69e33e7 100644
--- a/bitbake/lib/bb/fetch/ssh.py
+++ b/bitbake/lib/bb/fetch/ssh.py
@@ -64,59 +64,55 @@ __pattern__ = re.compile(r'''
64class SSH(Fetch): 64class SSH(Fetch):
65 '''Class to fetch a module or modules via Secure Shell''' 65 '''Class to fetch a module or modules via Secure Shell'''
66 66
67 def supports(self, url, d): 67 def supports(self, url, urldata, d):
68 return __pattern__.match(url) != None 68 return __pattern__.match(url) != None
69 69
70 def localpath(self, url, d): 70 def localpath(self, url, urldata, d):
71 m = __pattern__.match(url) 71 m = __pattern__.match(url)
72 path = m.group('path') 72 path = m.group('path')
73 host = m.group('host') 73 host = m.group('host')
74 lpath = os.path.join(data.getVar('DL_DIR', d, 1), host, os.path.basename(path)) 74 lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path))
75 return lpath 75 return lpath
76 76
77 def go(self, d, urls = []): 77 def go(self, url, urldata, d):
78 if not urls: 78 dldir = data.getVar('DL_DIR', d, 1)
79 urls = self.urls 79
80 80 m = __pattern__.match(url)
81 for url in urls: 81 path = m.group('path')
82 dldir = data.getVar('DL_DIR', d, 1) 82 host = m.group('host')
83 83 port = m.group('port')
84 m = __pattern__.match(url) 84 user = m.group('user')
85 path = m.group('path') 85 password = m.group('pass')
86 host = m.group('host') 86
87 port = m.group('port') 87 ldir = os.path.join(dldir, host)
88 user = m.group('user') 88 lpath = os.path.join(ldir, os.path.basename(path))
89 password = m.group('pass') 89
90 90 if not os.path.exists(ldir):
91 ldir = os.path.join(dldir, host) 91 os.makedirs(ldir)
92 lpath = os.path.join(ldir, os.path.basename(path)) 92
93 93 if port:
94 if not os.path.exists(ldir): 94 port = '-P %s' % port
95 os.makedirs(ldir) 95 else:
96 96 port = ''
97 if port: 97
98 port = '-P %s' % port 98 if user:
99 else: 99 fr = user
100 port = '' 100 if password:
101 101 fr += ':%s' % password
102 if user: 102 fr += '@%s' % host
103 fr = user 103 else:
104 if password: 104 fr = host
105 fr += ':%s' % password 105 fr += ':%s' % path
106 fr += '@%s' % host 106
107 else: 107
108 fr = host 108 import commands
109 fr += ':%s' % path 109 cmd = 'scp -B -r %s %s %s/' % (
110 110 port,
111 111 commands.mkarg(fr),
112 import commands 112 commands.mkarg(ldir)
113 cmd = 'scp -B -r %s %s %s/' % ( 113 )
114 port, 114
115 commands.mkarg(fr), 115 (exitstatus, output) = commands.getstatusoutput(cmd)
116 commands.mkarg(ldir) 116 if exitstatus != 0:
117 ) 117 print output
118 118 raise FetchError('Unable to fetch %s' % url)
119 (exitstatus, output) = commands.getstatusoutput(cmd)
120 if exitstatus != 0:
121 print output
122 raise FetchError('Unable to fetch %s' % url)