summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/ssh.py
diff options
context:
space:
mode:
authorDaniel Wagenknecht <dwagenknecht@emlix.com>2022-03-02 20:50:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-04 17:24:45 +0000
commit0a3b5b3de7bcb1c5c3748cba42d394cc484e966b (patch)
tree20ff9cc994aef3fe56723e1292aed8ba89dee708 /lib/bb/fetch2/ssh.py
parentdf5505a1ba15524c3a185360d687854300aef342 (diff)
downloadbitbake-0a3b5b3de7bcb1c5c3748cba42d394cc484e966b.tar.gz
fetch2: ssh: support checkstatus
This implements support for sstate mirrors using ssh as transport protocol. Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/ssh.py')
-rw-r--r--lib/bb/fetch2/ssh.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/bb/fetch2/ssh.py b/lib/bb/fetch2/ssh.py
index a985de4ce..484453088 100644
--- a/lib/bb/fetch2/ssh.py
+++ b/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