Minor recipetool create fixes
cover Minor recipetool create fixes
The following changes since commit c59fa3bd71b42410bf032846ee8fdb6e6eb1b95c:
python*-git: Upgrade to version 2.1.3 (2017-05-12 08:49:30 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/recipetool-fixes8
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=paule/recipetool-fixes8
Paul Eggleton (2):
recipetool: create: skip values extracted from spec files containing macros
recipetool: create: extract name of package from a repository
scripts/lib/recipetool/create.py | 11 ++++++++--- scripts/lib/recipetool/create_buildsys.py | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/2 recipetool: create: skip values extracted from spec files containing macros
If a value we extract from a spec file contains an unexpanded macro (e.g. %{macroname}) then we should discard it since we're not seeing the actual value and we don't have an easy way of expanding it at the moment.
This fixes for example getting %{name} as the recipe name when running the following:
recipetool create https://github.com/gavincarr/mod_auth_tkt.git
--- scripts/lib/recipetool/create_buildsys.py | 4 ++++ 1 file changed, 4 insertions(+)
scripts/lib/recipetool/create_buildsys.py +4 -0
@@ -863,6 +863,10 @@ class SpecFileRecipeHandler(RecipeHandler): break if len(foundvalues) == len(valuemap): break + # Drop values containing unexpanded RPM macros + for k in list(foundvalues.keys()): + if '%' in foundvalues[k]: + del foundvalues[k] if 'PV' in foundvalues: if not validate_pv(foundvalues['PV']): del foundvalues['PV']
Signature · 1 line
2.9.3
PATCH 2/2 recipetool: create: extract name of package from a repository
In reply to Paul EggletonFor 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.
--- scripts/lib/recipetool/create.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
scripts/lib/recipetool/create.py +8 -3
@@ -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)
Signature · 1 line
2.9.3