summaryrefslogtreecommitdiff
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-09-19 08:08:11 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-19 09:06:52 +0100
commit78c672a72f49c4b6cfd8c247efcc676b0ba1681a (patch)
treec1218f7f19edb592ca24735b569c2251b977c11b /scripts/lib/recipetool
parentba4aa319fd49ee02ce2e30c2db0f3988c0e8833c (diff)
downloadopenembedded-core-78c672a72f49c4b6cfd8c247efcc676b0ba1681a.tar.gz
openembedded-core-78c672a72f49c4b6cfd8c247efcc676b0ba1681a.tar.bz2
openembedded-core-78c672a72f49c4b6cfd8c247efcc676b0ba1681a.zip
recipetool: create: support git short form URLs
In keeping with making recipetool create / devtool add as easy to use as possible, users shouldn't have to know how to reformat git short form ssh URLs for consumption by BitBake's fetcher (for example user@git.example.com:repo.git should be expressed as git://user@git.example.com/repo.git;protocol=ssh ) - instead we should just take care of that automatically. Add some logic in the appropriate places to do that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/create.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 7787d8e35f..9b31fe92d7 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -353,10 +353,13 @@ def reformat_git_uri(uri):
'''Convert any http[s]://....git URI into git://...;protocol=http[s]'''
checkuri = uri.split(';', 1)[0]
if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://github.com/[^/]+/[^/]+/?$', checkuri):
- res = re.match('(https?)://([^;]+(\.git)?)(;.*)?$', uri)
+ res = re.match('(http|https|ssh)://([^;]+(\.git)?)(;.*)?$', uri)
if res:
# Need to switch the URI around so that the git fetcher is used
return 'git://%s;protocol=%s%s' % (res.group(2), res.group(1), res.group(4) or '')
+ elif '@' in checkuri:
+ # Catch e.g. git@git.example.com:repo.git
+ return 'git://%s;protocol=ssh' % checkuri.replace(':', '/', 1)
return uri
def is_package(url):
@@ -386,7 +389,7 @@ def create_recipe(args):
if os.path.isfile(source):
source = 'file://%s' % os.path.abspath(source)
- if '://' in source:
+ if scriptutils.is_src_url(source):
# Fetch a URL
fetchuri = reformat_git_uri(urldefrag(source)[0])
if args.binary:
@@ -478,7 +481,7 @@ def create_recipe(args):
for line in stdout.splitlines():
splitline = line.split()
if len(splitline) > 1:
- if splitline[0] == 'origin' and '://' in splitline[1]:
+ if splitline[0] == 'origin' and scriptutils.is_src_url(splitline[1]):
srcuri = reformat_git_uri(splitline[1])
srcsubdir = 'git'
break