From fe0d6dbef5583a2382bdee6a6dcabc6248588d1e Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Wed, 2 Mar 2022 20:50:36 +0100 Subject: bitbake: fetch2: ssh: support checkstatus This implements support for sstate mirrors using ssh as transport protocol. (Bitbake rev: 0a3b5b3de7bcb1c5c3748cba42d394cc484e966b) Signed-off-by: Daniel Wagenknecht Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/ssh.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index a985de4ce0..484453088f 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py @@ -113,3 +113,43 @@ class SSH(FetchMethod): runfetchcmd(cmd, d) + def checkstatus(self, fetch, urldata, d): + """ + Check the status of the url + """ + m = __pattern__.match(urldata.url) + path = m.group('path') + host = m.group('host') + port = m.group('port') + user = m.group('user') + password = m.group('pass') + + if port: + portarg = '-P %s' % port + else: + portarg = '' + + if user: + fr = user + if password: + fr += ':%s' % password + fr += '@%s' % host + else: + fr = host + + if path[0] != '~': + path = '/%s' % path + path = path.replace("%3A", ":") + + cmd = 'ssh -o BatchMode=true %s %s [ -f %s ]' % ( + portarg, + fr, + path + ) + + check_network_access(d, cmd, urldata.url) + + if runfetchcmd(cmd, d): + return True + + return False -- cgit v1.2.3-54-g00ecf