<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello people,<br><br>I am working as well on fetch2/<span class="" id=":1oh.1" tabindex="-1" style="">gitsm</span>.<span class="" id=":1oh.2" tabindex="-1" style="">py</span>. We have a <span class="" id=":1oh.3" tabindex="-1" style="">privat</span> <span class="" id=":1oh.4" tabindex="-1" style="">repo</span> with <span class="" id=":1oh.5" tabindex="-1" style="">submodules</span> but the current <span class="" id=":1oh.6" tabindex="-1" style="">gitsm</span>.<span class="" id=":1oh.7" tabindex="-1" style="">py</span> does not support ssh.<br><br>I tested the patch by <span class="" id=":1oh.8" tabindex="-1" style="">Krystian</span> but it did not worked for me. I got the following ERROR:<br><br></div></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>ERROR: &lt;recipe&gt; do_fetch: The URL: &#39;gitsm:git@<span class="" id=":1oh.9" tabindex="-1" style="">github</span>.com/&lt;user&gt;/&lt;<span class="" id=":1oh.10" tabindex="-1" style="">submodule</span>_name1&gt;.git;protocol=ssh;name=&lt;<span class="" id=":1oh.11" tabindex="-1" style="">submodule</span>_name2&gt;;<span class="" id=":1oh.12" tabindex="-1" style="">bareclone</span>=1;<span class="" id=":1oh.13" tabindex="-1" style="">nocheckout</span>=1;<span class="" id=":1oh.14" tabindex="-1" style="">nobranch</span>=1&#39; is invalid and cannot be interpreted</div></div></div></div></blockquote><div dir="ltr"><div><br>The .<span class="" id=":1oh.15" tabindex="-1" style="">gitmodules</span> file used looks like this:<br><br><div>[<span class="" id=":1oh.16" tabindex="-1" style="">submodule</span> &quot;<span class="" id=":1oh.17" tabindex="-1" style="">submodule</span>_name1&quot;]</div><div><span style="white-space:pre">        </span>path = <span class="" id=":1oh.18" tabindex="-1" style="">submodule</span>_name1</div>        <span class="" id=":1oh.19" tabindex="-1" style="">url</span> = git@<span class="" id=":1oh.20" tabindex="-1" style="">github</span>.com/&lt;user&gt;/&lt;<span class="" id=":1oh.21" tabindex="-1" style="">submodule</span>_name1&gt;.git </div><div><div>[<span class="" id=":1oh.22" tabindex="-1" style="">submodule</span> &quot;<span class="" id=":1oh.23" tabindex="-1" style="">submodule</span>_name2&quot;]<br></div><div><span style="white-space:pre">        </span>path = <span class="" id=":1oh.24" tabindex="-1" style="">submodule</span>_name2</div><div><div>        <span class="" id=":1oh.25" tabindex="-1" style="">url</span> = git@<span class="" id=":1oh.26" tabindex="-1" style="">github</span>.com/&lt;user&gt;/&lt;<span class="" id=":1oh.27" tabindex="-1" style="">submodule</span>_name2&gt;.git </div></div><br></div><div>Attached you find my <span class="" id=":1oh.28" tabindex="-1" style="">proposal</span>.</div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr">Am Di., 8. Jan. 2019 um 08:48 <span class="" id=":1oh.29" tabindex="-1" style="">Uhr</span> <span class="" id=":1oh.30" tabindex="-1" style="">schrieb</span> <span class="" id=":1oh.31" tabindex="-1" style="">Krystian</span> <span class="" id=":1oh.32" tabindex="-1" style="">Garliński</span> &lt;<span class="" id=":1oh.33" tabindex="-1" style="">krystian</span>.<span class="" id=":1oh.34" tabindex="-1" style="">garlinski</span>@<span class="" id=":1oh.35" tabindex="-1" style="">comarch</span>.pl&gt;:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Git allows to use both the proper URI&#39;s and SCP-like short style syntax<br>
for the SSH protocol. This commit changes construction logic to detect which<br>
one of the two is used in the submodule specification and to build a correct<br>
URI out of it.<br>
<br>
Signed-off-by: Krystian Garliński &lt;<a href="mailto:krystian.garlinski@comarch.pl" target="_blank">krystian.garlinski@comarch.pl</a>&gt;<br>
---<br>
 lib/bb/fetch2/gitsm.py | 16 ++++++++++++++--<br>
 1 file changed, 14 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py<br>
index 35729dbc..95d5f652 100644<br>
--- a/lib/bb/fetch2/gitsm.py<br>
+++ b/lib/bb/fetch2/gitsm.py<br>
@@ -32,6 +32,7 @@ NOTE: Switching a SRC_URI from &quot;git://&quot; to &quot;gitsm://&quot; requires a clean of your r<br>
 import os<br>
 import bb<br>
 import copy<br>
+import re<br>
 from   bb.fetch2.git import Git<br>
 from   bb.fetch2 import runfetchcmd<br>
 from   bb.fetch2 import logger<br>
@@ -39,6 +40,8 @@ from   bb.fetch2 import Fetch<br>
 from   bb.fetch2 import BBFetchException<br>
<br>
 class GitSM(Git):<br>
+    scp_regex = re.compile(r&#39;^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.+)$&#39;)<br>
+<br>
     def supports(self, ud, d):<br>
         &quot;&quot;&quot;<br>
         Check to see if a given url can be fetched with git.<br>
@@ -88,8 +91,17 @@ class GitSM(Git):<br>
             module_hash = module_hash.split()[2]<br>
<br>
             # Build new SRC_URI<br>
-            proto = uris[module].split(&#39;:&#39;, 1)[0]<br>
-            url = uris[module].replace(&#39;%s:&#39; % proto, &#39;gitsm:&#39;, 1)<br>
+            uri = uris[module]<br>
+            match = GitSM.scp_regex.match(uri)<br>
+<br>
+            if match:<br>
+                # this URI follows the short SCP-like syntax<br>
+                url = &#39;gitsm://{}@{}/{}&#39;.format(match.group(1), match.group(2), match.group(3))<br>
+                proto = &#39;ssh&#39;<br>
+            else:<br>
+                proto = uri.split(&#39;:&#39;, 1)[0]<br>
+                url = &#39;gitsm&#39; + uri[len(proto):]<br>
+<br>
             url += &#39;;protocol=%s&#39; % proto<br>
             url += &quot;;name=%s&quot; % module<br>
             url += &quot;;bareclone=1;nocheckout=1;nobranch=1&quot;<br>
-- <br>
2.19.1<br>
<br>
-- <br>
_______________________________________________<br>
bitbake-devel mailing list<br>
<a href="mailto:bitbake-devel@lists.openembedded.org" target="_blank">bitbake-devel@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/bitbake-devel" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/bitbake-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><br><span class="" id=":1oh.36" tabindex="-1" style="">Cheers</span>, <br>Linus</div></div></div></div>