aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-04-21 14:51:24 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2017-05-15 09:58:31 +1200
commit7347a6b8ad71cf93639126b5e99986ccaf17e4cc (patch)
tree4f449a7839c7f8768072b6be409a019b7e2dae0a
parent3e4f2fa598a5061215315f53dc2086718cce295d (diff)
downloadopenembedded-core-contrib-paule/recipetool-fixes8.tar.gz
recipetool: create: extract name of package from a repositorypaule/recipetool-fixes8
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--scripts/lib/recipetool/create.py11
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):
pn = res.group(1).strip().replace('_', '-')
pv = res.group(2).strip().replace('_', '.')
- if not pn and not pv and parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']:
- srcfile = os.path.basename(parseres.path.rstrip('/'))
- pn, pv = determine_from_filename(srcfile)
+ if not pn and not pv:
+ if parseres.scheme not in ['git', 'gitsm', 'svn', 'hg']:
+ srcfile = os.path.basename(parseres.path.rstrip('/'))
+ pn, pv = determine_from_filename(srcfile)
+ elif parseres.scheme in ['git', 'gitsm']:
+ pn = os.path.basename(parseres.path.rstrip('/')).lower().replace('_', '-')
+ if pn.endswith('.git'):
+ pn = pn[:-4]
logger.debug('Determined from source URL: name = "%s", version = "%s"' % (pn, pv))
return (pn, pv)