diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-05-15 09:59:53 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-23 17:45:36 +0100 |
commit | a7c686cfe685f7acc20af32b41b6e2f51273ac6f (patch) | |
tree | 881108f8f10ede770c928e62a0cd044b6b8ad4eb | |
parent | 4f152bdce98854531006587aa0638e3cc68c2dad (diff) | |
download | poky-a7c686cfe685f7acc20af32b41b6e2f51273ac6f.tar.gz |
recipetool: create: extract name of package from a repository
For git repositories in the absence of any other indicator, it's not an
unreasonable assumption that the name of the repository is the name of
the software package it contains, so use that as PN if we don't have
anything else.
(From OE-Core rev: ef73fa70f0955912b0da140922465a3c817424e9)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/recipetool/create.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 5af58a12f7..2a5a84c3c7 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -339,9 +339,14 @@ def determine_from_url(srcuri): | |||
339 | pn = res.group(1).strip().replace('_', '-') | 339 | pn = res.group(1).strip().replace('_', '-') |
340 | pv = res.group(2).strip().replace('_', '.') | 340 | pv = res.group(2).strip().replace('_', '.') |
341 | 341 | ||
342 | if not pn and not pv and parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']: | 342 | if not pn and not pv: |
343 | srcfile = os.path.basename(parseres.path.rstrip('/')) | 343 | if parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']: |
344 | pn, pv = determine_from_filename(srcfile) | 344 | srcfile = os.path.basename(parseres.path.rstrip('/')) |
345 | pn, pv = determine_from_filename(srcfile) | ||
346 | elif parseres.scheme in ['git', 'gitsm']: | ||
347 | pn = os.path.basename(parseres.path.rstrip('/')).lower().replace('_', '-') | ||
348 | if pn.endswith('.git'): | ||
349 | pn = pn[:-4] | ||
345 | 350 | ||
346 | logger.debug('Determined from source URL: name = "%s", version = "%s"' % (pn, pv)) | 351 | logger.debug('Determined from source URL: name = "%s", version = "%s"' % (pn, pv)) |
347 | return (pn, pv) | 352 | return (pn, pv) |