Patchwork [bitbake-devel,2/3] ssh.py: throw ParameterError when someone tries ssh://foo; protocol=git

login
register
mail settings
Submitter Martin Jansa
Date Jan. 28, 2013, 3:56 p.m.
Message ID <1359388602-30536-2-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/43559/
State Accepted
Commit 88e565855b52e905156d85c3f45b341cddfe2f55
Headers show

Comments

Martin Jansa - Jan. 28, 2013, 3:56 p.m.
* taken from SFTP fetcher:
  http://patchwork.openembedded.org/patch/43027/

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 lib/bb/fetch2/ssh.py | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/lib/bb/fetch2/ssh.py b/lib/bb/fetch2/ssh.py
index 61db435..721fb35 100644
--- a/lib/bb/fetch2/ssh.py
+++ b/lib/bb/fetch2/ssh.py
@@ -73,6 +73,11 @@  class SSH(FetchMethod):
         return False
 
     def urldata_init(self, urldata, d):
+        if 'protocol' in urldata.parm and urldata.parm['protocol'] == 'git':
+            raise bb.fetch2.ParameterError(
+                "Invalid protocol - if you wish to fetch from a git " +
+                "repository using ssh, you need to use " +
+                "git:// prefix with protocol=ssh", urldata.url)
         m = __pattern__.match(urldata.url)
         path = m.group('path')
         host = m.group('host')