aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create_buildsys.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-19 22:39:02 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-21 09:32:00 +0000
commit2ddad52ccca07245eea43d9b844c6c7d4b667ca3 (patch)
treee4659e6a0c3b9e4c11b856529abca1c92004e364 /scripts/lib/recipetool/create_buildsys.py
parent915dea9f89cd737e5ba167c384e8d314c5c23c49 (diff)
downloadopenembedded-core-contrib-2ddad52ccca07245eea43d9b844c6c7d4b667ca3.tar.gz
recipetool: create: improve CMake package mapping
* Package names are actually case sensitive near as I can tell, so we shouldn't be lowercasing them everywhere. * Look for CMake packages in pkgdata and map those back to recipes, so we aren't dependent on the hardcoded mappings (though those are still preserved). * Avoid duplicates in the unmapped package list Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create_buildsys.py')
-rw-r--r--scripts/lib/recipetool/create_buildsys.py39
1 files changed, 28 insertions, 11 deletions
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py
index 1a06cac8c5..43dcca3c5b 100644
--- a/scripts/lib/recipetool/create_buildsys.py
+++ b/scripts/lib/recipetool/create_buildsys.py
@@ -17,6 +17,7 @@
import re
import logging
+import glob
from recipetool.create import RecipeHandler, validate_pv
logger = logging.getLogger('recipetool')
@@ -156,6 +157,16 @@ class CmakeRecipeHandler(RecipeHandler):
subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE)
dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?')
+ def find_cmake_package(pkg):
+ RecipeHandler.load_devel_filemap(tinfoil.config_data)
+ for fn, pn in RecipeHandler.recipecmakefilemap.iteritems():
+ splitname = fn.split('/')
+ if len(splitname) > 1:
+ if splitname[0].lower().startswith(pkg.lower()):
+ if splitname[1] == '%s-config.cmake' % pkg.lower() or splitname[1] == '%sConfig.cmake' % pkg or splitname[1] == 'Find%s.cmake' % pkg:
+ return pn
+ return None
+
def interpret_value(value):
return value.strip('"')
@@ -209,7 +220,7 @@ class CmakeRecipeHandler(RecipeHandler):
res = findpackage_re.match(line)
if res:
origpkg = res.group(1)
- pkg = interpret_value(origpkg.lower())
+ pkg = interpret_value(origpkg)
found = False
for handler in handlers:
if handler.process_findpackage(srctree, fn, pkg, deps, outlines, inherits, values):
@@ -218,23 +229,29 @@ class CmakeRecipeHandler(RecipeHandler):
break
if found:
continue
- elif pkg == 'gettext':
+ elif pkg == 'Gettext':
inherits.append('gettext')
- elif pkg == 'perl':
+ elif pkg == 'Perl':
inherits.append('perlnative')
- elif pkg == 'pkgconfig':
+ elif pkg == 'PkgConfig':
inherits.append('pkgconfig')
- elif pkg == 'pythoninterp':
+ elif pkg == 'PythonInterp':
inherits.append('pythonnative')
- elif pkg == 'pythonlibs':
+ elif pkg == 'PythonLibs':
inherits.append('python-dir')
else:
- dep = cmake_pkgmap.get(pkg, None)
+ # Try to map via looking at installed CMake packages in pkgdata
+ dep = find_cmake_package(pkg)
if dep:
- logger.debug('Mapped CMake package %s to recipe %s via internal list' % (pkg, dep))
+ logger.debug('Mapped CMake package %s to recipe %s via pkgdata' % (pkg, dep))
deps.append(dep)
- elif dep is None:
- unmappedpkgs.append(origpkg)
+ else:
+ dep = cmake_pkgmap.get(pkg.lower(), None)
+ if dep:
+ logger.debug('Mapped CMake package %s to recipe %s via internal list' % (pkg, dep))
+ deps.append(dep)
+ elif dep is None:
+ unmappedpkgs.append(origpkg)
continue
res = checklib_re.match(line)
if res:
@@ -257,7 +274,7 @@ class CmakeRecipeHandler(RecipeHandler):
parse_cmake_file(srcfiles[0])
if unmappedpkgs:
- outlines.append('# NOTE: unable to map the following CMake package dependencies: %s' % ' '.join(unmappedpkgs))
+ outlines.append('# NOTE: unable to map the following CMake package dependencies: %s' % ' '.join(list(set(unmappedpkgs))))
RecipeHandler.handle_depends(libdeps, pcdeps, deps, outlines, values, tinfoil.config_data)