diff options
Diffstat (limited to 'scripts/lib/recipetool/create.py')
| -rw-r--r-- | scripts/lib/recipetool/create.py | 9 |
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): | |||
| 353 | '''Convert any http[s]://....git URI into git://...;protocol=http[s]''' | 353 | '''Convert any http[s]://....git URI into git://...;protocol=http[s]''' |
| 354 | checkuri = uri.split(';', 1)[0] | 354 | checkuri = uri.split(';', 1)[0] |
| 355 | if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://github.com/[^/]+/[^/]+/?$', checkuri): | 355 | if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://github.com/[^/]+/[^/]+/?$', checkuri): |
| 356 | res = re.match('(https?)://([^;]+(\.git)?)(;.*)?$', uri) | 356 | res = re.match('(http|https|ssh)://([^;]+(\.git)?)(;.*)?$', uri) |
| 357 | if res: | 357 | if res: |
| 358 | # Need to switch the URI around so that the git fetcher is used | 358 | # Need to switch the URI around so that the git fetcher is used |
| 359 | return 'git://%s;protocol=%s%s' % (res.group(2), res.group(1), res.group(4) or '') | 359 | return 'git://%s;protocol=%s%s' % (res.group(2), res.group(1), res.group(4) or '') |
| 360 | elif '@' in checkuri: | ||
| 361 | # Catch e.g. git@git.example.com:repo.git | ||
| 362 | return 'git://%s;protocol=ssh' % checkuri.replace(':', '/', 1) | ||
| 360 | return uri | 363 | return uri |
| 361 | 364 | ||
| 362 | def is_package(url): | 365 | def is_package(url): |
| @@ -386,7 +389,7 @@ def create_recipe(args): | |||
| 386 | if os.path.isfile(source): | 389 | if os.path.isfile(source): |
| 387 | source = 'file://%s' % os.path.abspath(source) | 390 | source = 'file://%s' % os.path.abspath(source) |
| 388 | 391 | ||
| 389 | if '://' in source: | 392 | if scriptutils.is_src_url(source): |
| 390 | # Fetch a URL | 393 | # Fetch a URL |
| 391 | fetchuri = reformat_git_uri(urldefrag(source)[0]) | 394 | fetchuri = reformat_git_uri(urldefrag(source)[0]) |
| 392 | if args.binary: | 395 | if args.binary: |
| @@ -478,7 +481,7 @@ def create_recipe(args): | |||
| 478 | for line in stdout.splitlines(): | 481 | for line in stdout.splitlines(): |
| 479 | splitline = line.split() | 482 | splitline = line.split() |
| 480 | if len(splitline) > 1: | 483 | if len(splitline) > 1: |
| 481 | if splitline[0] == 'origin' and '://' in splitline[1]: | 484 | if splitline[0] == 'origin' and scriptutils.is_src_url(splitline[1]): |
| 482 | srcuri = reformat_git_uri(splitline[1]) | 485 | srcuri = reformat_git_uri(splitline[1]) |
| 483 | srcsubdir = 'git' | 486 | srcsubdir = 'git' |
| 484 | break | 487 | break |
