diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2019-03-12 18:46:19 -0400 |
---|---|---|
committer | Armin Kuster <akuster@mvista.com> | 2019-03-13 08:05:19 -0700 |
commit | a21b2598531d52123933a0ac1c4deeecfdd1697d (patch) | |
tree | 370e3f3b64d3a26fa83ec0fce881e59ab465ad1b /lib/bb/fetch2/gitsm.py | |
parent | e9c965bd816c8e4e5cc8e45db8e0dab597ce5a6f (diff) | |
download | bitbake-contrib-a21b2598531d52123933a0ac1c4deeecfdd1697d.tar.gz |
gitsm.py: Add support for alternative URL formats from submodule files
The following appear to be the git supported formats:
proto://user:pass@host/path (URI format)
user@host:path (SSH format)
/path or ./path or ../path (local file format)
We adjust the parsing to find out if we have a URI format or not.
When we are NOT in URI format, we do our best to determine SSH or
file format by looking for a ':' in the overall string. If we find
a ':' we assume SSH format and adjust accordingly.
Note, in SSH format we simply replace the ':' with a '/' when constructing
the URL. However, if the original path was ":/...", we don't want '//' so
we deal with this corner case as well.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit dcac05e7dc6b0c5f8e63d36ad105b7eab41f0016)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Diffstat (limited to 'lib/bb/fetch2/gitsm.py')
-rw-r--r-- | lib/bb/fetch2/gitsm.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py index b7959ff5d..dd94186cc 100644 --- a/lib/bb/fetch2/gitsm.py +++ b/lib/bb/fetch2/gitsm.py @@ -100,8 +100,21 @@ class GitSM(Git): module_hash = module_hash.split()[2] # Build new SRC_URI - proto = uris[module].split(':', 1)[0] - url = uris[module].replace('%s:' % proto, 'gitsm:', 1) + if "://" not in uris[module]: + # It's ssh if the format does NOT have "://", but has a ':' + if ":" in uris[module]: + proto = "ssh" + if ":/" in uris[module]: + url = "gitsm://" + uris[module].replace(':/', '/', 1) + else: + url = "gitsm://" + uris[module].replace(':', '/', 1) + else: # Fall back to 'file' if there is no ':' + proto = "file" + url = "gitsm://" + uris[module] + else: + proto = uris[module].split(':', 1)[0] + url = uris[module].replace('%s:' % proto, 'gitsm:', 1) + url += ';protocol=%s' % proto url += ";name=%s" % module url += ";bareclone=1;nocheckout=1;nobranch=1" |