diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-19 22:39:02 +1300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-21 09:32:43 +0000 |
| commit | 524ee088b3ce354b4f29c0b18e92c532526f8909 (patch) | |
| tree | 066fa4319f25410b7c8e0ae996497f39a5e69394 /scripts/lib/recipetool/create_buildsys.py | |
| parent | 7b6e5b025e2ba8a91be01d61f7b9093f4729e8cc (diff) | |
| download | poky-524ee088b3ce354b4f29c0b18e92c532526f8909.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
(From OE-Core rev: 2ddad52ccca07245eea43d9b844c6c7d4b667ca3)
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.py | 39 |
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 @@ | |||
| 17 | 17 | ||
| 18 | import re | 18 | import re |
| 19 | import logging | 19 | import logging |
| 20 | import glob | ||
| 20 | from recipetool.create import RecipeHandler, validate_pv | 21 | from recipetool.create import RecipeHandler, validate_pv |
| 21 | 22 | ||
| 22 | logger = logging.getLogger('recipetool') | 23 | logger = logging.getLogger('recipetool') |
| @@ -156,6 +157,16 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 156 | subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE) | 157 | subdir_re = re.compile('add_subdirectory\s*\(\s*([^)\s]*)\s*([^)\s]*)\s*\)', re.IGNORECASE) |
| 157 | dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?') | 158 | dep_re = re.compile('([^ ><=]+)( *[<>=]+ *[^ ><=]+)?') |
| 158 | 159 | ||
| 160 | def find_cmake_package(pkg): | ||
| 161 | RecipeHandler.load_devel_filemap(tinfoil.config_data) | ||
| 162 | for fn, pn in RecipeHandler.recipecmakefilemap.iteritems(): | ||
| 163 | splitname = fn.split('/') | ||
| 164 | if len(splitname) > 1: | ||
| 165 | if splitname[0].lower().startswith(pkg.lower()): | ||
| 166 | if splitname[1] == '%s-config.cmake' % pkg.lower() or splitname[1] == '%sConfig.cmake' % pkg or splitname[1] == 'Find%s.cmake' % pkg: | ||
| 167 | return pn | ||
| 168 | return None | ||
| 169 | |||
| 159 | def interpret_value(value): | 170 | def interpret_value(value): |
| 160 | return value.strip('"') | 171 | return value.strip('"') |
| 161 | 172 | ||
| @@ -209,7 +220,7 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 209 | res = findpackage_re.match(line) | 220 | res = findpackage_re.match(line) |
| 210 | if res: | 221 | if res: |
| 211 | origpkg = res.group(1) | 222 | origpkg = res.group(1) |
| 212 | pkg = interpret_value(origpkg.lower()) | 223 | pkg = interpret_value(origpkg) |
| 213 | found = False | 224 | found = False |
| 214 | for handler in handlers: | 225 | for handler in handlers: |
| 215 | if handler.process_findpackage(srctree, fn, pkg, deps, outlines, inherits, values): | 226 | if handler.process_findpackage(srctree, fn, pkg, deps, outlines, inherits, values): |
| @@ -218,23 +229,29 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 218 | break | 229 | break |
| 219 | if found: | 230 | if found: |
| 220 | continue | 231 | continue |
| 221 | elif pkg == 'gettext': | 232 | elif pkg == 'Gettext': |
| 222 | inherits.append('gettext') | 233 | inherits.append('gettext') |
| 223 | elif pkg == 'perl': | 234 | elif pkg == 'Perl': |
| 224 | inherits.append('perlnative') | 235 | inherits.append('perlnative') |
| 225 | elif pkg == 'pkgconfig': | 236 | elif pkg == 'PkgConfig': |
| 226 | inherits.append('pkgconfig') | 237 | inherits.append('pkgconfig') |
| 227 | elif pkg == 'pythoninterp': | 238 | elif pkg == 'PythonInterp': |
| 228 | inherits.append('pythonnative') | 239 | inherits.append('pythonnative') |
| 229 | elif pkg == 'pythonlibs': | 240 | elif pkg == 'PythonLibs': |
| 230 | inherits.append('python-dir') | 241 | inherits.append('python-dir') |
| 231 | else: | 242 | else: |
| 232 | dep = cmake_pkgmap.get(pkg, None) | 243 | # Try to map via looking at installed CMake packages in pkgdata |
| 244 | dep = find_cmake_package(pkg) | ||
| 233 | if dep: | 245 | if dep: |
| 234 | logger.debug('Mapped CMake package %s to recipe %s via internal list' % (pkg, dep)) | 246 | logger.debug('Mapped CMake package %s to recipe %s via pkgdata' % (pkg, dep)) |
| 235 | deps.append(dep) | 247 | deps.append(dep) |
| 236 | elif dep is None: | 248 | else: |
| 237 | unmappedpkgs.append(origpkg) | 249 | dep = cmake_pkgmap.get(pkg.lower(), None) |
| 250 | if dep: | ||
| 251 | logger.debug('Mapped CMake package %s to recipe %s via internal list' % (pkg, dep)) | ||
| 252 | deps.append(dep) | ||
| 253 | elif dep is None: | ||
| 254 | unmappedpkgs.append(origpkg) | ||
| 238 | continue | 255 | continue |
| 239 | res = checklib_re.match(line) | 256 | res = checklib_re.match(line) |
| 240 | if res: | 257 | if res: |
| @@ -257,7 +274,7 @@ class CmakeRecipeHandler(RecipeHandler): | |||
| 257 | parse_cmake_file(srcfiles[0]) | 274 | parse_cmake_file(srcfiles[0]) |
| 258 | 275 | ||
| 259 | if unmappedpkgs: | 276 | if unmappedpkgs: |
| 260 | outlines.append('# NOTE: unable to map the following CMake package dependencies: %s' % ' '.join(unmappedpkgs)) | 277 | outlines.append('# NOTE: unable to map the following CMake package dependencies: %s' % ' '.join(list(set(unmappedpkgs)))) |
| 261 | 278 | ||
| 262 | RecipeHandler.handle_depends(libdeps, pcdeps, deps, outlines, values, tinfoil.config_data) | 279 | RecipeHandler.handle_depends(libdeps, pcdeps, deps, outlines, values, tinfoil.config_data) |
| 263 | 280 | ||
