diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2019-03-12 18:46:19 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-03-24 16:42:22 +0000 |
commit | f72d43db80cbab80202dbaf527a339bee6e8cb3d (patch) | |
tree | fa965742ee510f811858a5856479ccca89c16b51 | |
parent | d5a6da8b3d1a8639f945586828ecd4d8481f5100 (diff) | |
download | poky-f72d43db80cbab80202dbaf527a339bee6e8cb3d.tar.gz |
bitbake: 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.
(Bitbake rev: a21b2598531d52123933a0ac1c4deeecfdd1697d)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index b7959ff5d1..dd94186cc4 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -100,8 +100,21 @@ class GitSM(Git): | |||
100 | module_hash = module_hash.split()[2] | 100 | module_hash = module_hash.split()[2] |
101 | 101 | ||
102 | # Build new SRC_URI | 102 | # Build new SRC_URI |
103 | proto = uris[module].split(':', 1)[0] | 103 | if "://" not in uris[module]: |
104 | url = uris[module].replace('%s:' % proto, 'gitsm:', 1) | 104 | # It's ssh if the format does NOT have "://", but has a ':' |
105 | if ":" in uris[module]: | ||
106 | proto = "ssh" | ||
107 | if ":/" in uris[module]: | ||
108 | url = "gitsm://" + uris[module].replace(':/', '/', 1) | ||
109 | else: | ||
110 | url = "gitsm://" + uris[module].replace(':', '/', 1) | ||
111 | else: # Fall back to 'file' if there is no ':' | ||
112 | proto = "file" | ||
113 | url = "gitsm://" + uris[module] | ||
114 | else: | ||
115 | proto = uris[module].split(':', 1)[0] | ||
116 | url = uris[module].replace('%s:' % proto, 'gitsm:', 1) | ||
117 | |||
105 | url += ';protocol=%s' % proto | 118 | url += ';protocol=%s' % proto |
106 | url += ";name=%s" % module | 119 | url += ";name=%s" % module |
107 | url += ";bareclone=1;nocheckout=1;nobranch=1" | 120 | url += ";bareclone=1;nocheckout=1;nobranch=1" |