<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: <recipe> do_fetch: The URL: 'gitsm:git@<span class="" id=":1oh.9" tabindex="-1" style="">github</span>.com/<user>/<<span class="" id=":1oh.10" tabindex="-1" style="">submodule</span>_name1>.git;protocol=ssh;name=<<span class="" id=":1oh.11" tabindex="-1" style="">submodule</span>_name2>;<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' 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> "<span class="" id=":1oh.17" tabindex="-1" style="">submodule</span>_name1"]</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/<user>/<<span class="" id=":1oh.21" tabindex="-1" style="">submodule</span>_name1>.git </div><div><div>[<span class="" id=":1oh.22" tabindex="-1" style="">submodule</span> "<span class="" id=":1oh.23" tabindex="-1" style="">submodule</span>_name2"]<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/<user>/<<span class="" id=":1oh.27" tabindex="-1" style="">submodule</span>_name2>.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> <<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>:<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'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 <<a href="mailto:krystian.garlinski@comarch.pl" target="_blank">krystian.garlinski@comarch.pl</a>><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 "git://" to "gitsm://" 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'^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.+)$')<br>
+<br>
def supports(self, ud, d):<br>
"""<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(':', 1)[0]<br>
- url = uris[module].replace('%s:' % proto, 'gitsm:', 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 = 'gitsm://{}@{}/{}'.format(match.group(1), match.group(2), match.group(3))<br>
+ proto = 'ssh'<br>
+ else:<br>
+ proto = uri.split(':', 1)[0]<br>
+ url = 'gitsm' + uri[len(proto):]<br>
+<br>
url += ';protocol=%s' % proto<br>
url += ";name=%s" % module<br>
url += ";bareclone=1;nocheckout=1;nobranch=1"<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>