]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: create: extract name of package from a repository
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Sun, 14 May 2017 21:59:53 +0000 (09:59 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 23 May 2017 16:44:00 +0000 (17:44 +0100)
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>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/recipetool/create.py

index 5af58a12f70baf260f1e06525813b261125ba258..2a5a84c3c7ce96bbd7db515c89a1802bb0d0ad63 100644 (file)
@@ -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)