diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-03-09 17:48:49 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-09 17:00:29 +0000 |
commit | 2b6a35212dca1c6f6e85ac7be18f1ac70c7a8bd6 (patch) | |
tree | c8293b80c5236ff2a211d6f40526a01a28969346 /scripts/lib/recipetool | |
parent | 1607fac5210437dd13a96017dc65c5f2f46dbf65 (diff) | |
download | poky-2b6a35212dca1c6f6e85ac7be18f1ac70c7a8bd6.tar.gz |
recipetool: create: improve mapping for autotools program macros
Make the following improvements to mapping items specified in
AC_CHECK_PROG, AC_PATH_PROG and AX_WITH_PROG to recipes/classes:
* Produce a map of native recipe -> binary for all binaries currently in
STAGING_BINDIR_NATIVE and use this when mapping items
* Add some more entries to the class map
* Ignore autotools binaries since they are covered by the inherit of
autotools
* Ignore coreutils-native since that would almost always be a bogus
dependency
(From OE-Core rev: 5614c5ae6a004d4367eccc34dd3cc7ee61fb7e57)
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')
-rw-r--r-- | scripts/lib/recipetool/create.py | 22 | ||||
-rw-r--r-- | scripts/lib/recipetool/create_buildsys.py | 36 |
2 files changed, 50 insertions, 8 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 7560cdf7cc..a77c1910db 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -1,6 +1,6 @@ | |||
1 | # Recipe creation tool - create command plugin | 1 | # Recipe creation tool - create command plugin |
2 | # | 2 | # |
3 | # Copyright (C) 2014-2015 Intel Corporation | 3 | # Copyright (C) 2014-2016 Intel Corporation |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License version 2 as | 6 | # it under the terms of the GNU General Public License version 2 as |
@@ -44,6 +44,7 @@ class RecipeHandler(object): | |||
44 | recipelibmap = {} | 44 | recipelibmap = {} |
45 | recipeheadermap = {} | 45 | recipeheadermap = {} |
46 | recipecmakefilemap = {} | 46 | recipecmakefilemap = {} |
47 | recipebinmap = {} | ||
47 | 48 | ||
48 | @staticmethod | 49 | @staticmethod |
49 | def load_libmap(d): | 50 | def load_libmap(d): |
@@ -122,6 +123,23 @@ class RecipeHandler(object): | |||
122 | RecipeHandler.recipecmakefilemap[fn] = pn | 123 | RecipeHandler.recipecmakefilemap[fn] = pn |
123 | 124 | ||
124 | @staticmethod | 125 | @staticmethod |
126 | def load_binmap(d): | ||
127 | '''Build up native binary->recipe mapping''' | ||
128 | if RecipeHandler.recipebinmap: | ||
129 | return | ||
130 | sstate_manifests = d.getVar('SSTATE_MANIFESTS', True) | ||
131 | staging_bindir_native = d.getVar('STAGING_BINDIR_NATIVE', True) | ||
132 | build_arch = d.getVar('BUILD_ARCH', True) | ||
133 | fileprefix = 'manifest-%s-' % build_arch | ||
134 | for fn in glob.glob(os.path.join(sstate_manifests, '%s*-native.populate_sysroot' % fileprefix)): | ||
135 | with open(fn, 'r') as f: | ||
136 | pn = os.path.basename(fn).rsplit('.', 1)[0][len(fileprefix):] | ||
137 | for line in f: | ||
138 | if line.startswith(staging_bindir_native): | ||
139 | prog = os.path.basename(line.rstrip()) | ||
140 | RecipeHandler.recipebinmap[prog] = pn | ||
141 | |||
142 | @staticmethod | ||
125 | def checkfiles(path, speclist, recursive=False): | 143 | def checkfiles(path, speclist, recursive=False): |
126 | results = [] | 144 | results = [] |
127 | if recursive: | 145 | if recursive: |
@@ -143,7 +161,7 @@ class RecipeHandler(object): | |||
143 | RecipeHandler.load_libmap(d) | 161 | RecipeHandler.load_libmap(d) |
144 | 162 | ||
145 | ignorelibs = ['socket'] | 163 | ignorelibs = ['socket'] |
146 | ignoredeps = ['gcc-runtime', 'glibc', 'uclibc', 'musl', 'tar-native', 'binutils-native'] | 164 | ignoredeps = ['gcc-runtime', 'glibc', 'uclibc', 'musl', 'tar-native', 'binutils-native', 'coreutils-native'] |
147 | 165 | ||
148 | unmappedpc = [] | 166 | unmappedpc = [] |
149 | pcdeps = list(set(pcdeps)) | 167 | pcdeps = list(set(pcdeps)) |
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py index 909743b384..f84ec3dc6c 100644 --- a/scripts/lib/recipetool/create_buildsys.py +++ b/scripts/lib/recipetool/create_buildsys.py | |||
@@ -1,6 +1,6 @@ | |||
1 | # Recipe creation tool - create command build system handlers | 1 | # Recipe creation tool - create command build system handlers |
2 | # | 2 | # |
3 | # Copyright (C) 2014 Intel Corporation | 3 | # Copyright (C) 2014-2016 Intel Corporation |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License version 2 as | 6 | # it under the terms of the GNU General Public License version 2 as |
@@ -404,14 +404,34 @@ class AutotoolsRecipeHandler(RecipeHandler): | |||
404 | values = {} | 404 | values = {} |
405 | inherits = [] | 405 | inherits = [] |
406 | 406 | ||
407 | # FIXME this mapping is very thin | 407 | # Hardcoded map, we also use a dynamic one based on what's in the sysroot |
408 | progmap = {'flex': 'flex-native', | 408 | progmap = {'flex': 'flex-native', |
409 | 'bison': 'bison-native', | 409 | 'bison': 'bison-native', |
410 | 'm4': 'm4-native', | 410 | 'm4': 'm4-native', |
411 | 'tar': 'tar-native', | 411 | 'tar': 'tar-native', |
412 | 'ar': 'binutils-native'} | 412 | 'ar': 'binutils-native', |
413 | 'ranlib': 'binutils-native', | ||
414 | 'ld': 'binutils-native', | ||
415 | 'strip': 'binutils-native', | ||
416 | 'libtool': '', | ||
417 | 'autoconf': '', | ||
418 | 'autoheader': '', | ||
419 | 'automake': '', | ||
420 | 'uname': '', | ||
421 | 'rm': '', | ||
422 | 'cp': '', | ||
423 | 'mv': '', | ||
424 | 'find': '', | ||
425 | 'awk': '', | ||
426 | 'sed': '', | ||
427 | } | ||
413 | progclassmap = {'gconftool-2': 'gconf', | 428 | progclassmap = {'gconftool-2': 'gconf', |
414 | 'pkg-config': 'pkgconfig'} | 429 | 'pkg-config': 'pkgconfig', |
430 | 'python': 'pythonnative', | ||
431 | 'python3': 'python3native', | ||
432 | 'perl': 'perlnative', | ||
433 | 'makeinfo': 'texinfo', | ||
434 | } | ||
415 | 435 | ||
416 | pkg_re = re.compile('PKG_CHECK_MODULES\(\s*\[?[a-zA-Z0-9_]*\]?,\s*\[?([^,\]]*)\]?[),].*') | 436 | pkg_re = re.compile('PKG_CHECK_MODULES\(\s*\[?[a-zA-Z0-9_]*\]?,\s*\[?([^,\]]*)\]?[),].*') |
417 | pkgce_re = re.compile('PKG_CHECK_EXISTS\(\s*\[?([^,\]]*)\]?[),].*') | 437 | pkgce_re = re.compile('PKG_CHECK_EXISTS\(\s*\[?([^,\]]*)\]?[),].*') |
@@ -462,6 +482,8 @@ class AutotoolsRecipeHandler(RecipeHandler): | |||
462 | deps = [] | 482 | deps = [] |
463 | unmapped = [] | 483 | unmapped = [] |
464 | 484 | ||
485 | RecipeHandler.load_binmap(tinfoil.config_data) | ||
486 | |||
465 | def process_macro(keyword, value): | 487 | def process_macro(keyword, value): |
466 | for handler in handlers: | 488 | for handler in handlers: |
467 | if handler.process_macro(srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values): | 489 | if handler.process_macro(srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values): |
@@ -498,10 +520,12 @@ class AutotoolsRecipeHandler(RecipeHandler): | |||
498 | if progclass: | 520 | if progclass: |
499 | inherits.append(progclass) | 521 | inherits.append(progclass) |
500 | else: | 522 | else: |
501 | progdep = progmap.get(prog, None) | 523 | progdep = RecipeHandler.recipebinmap.get(prog, None) |
524 | if not progdep: | ||
525 | progdep = progmap.get(prog, None) | ||
502 | if progdep: | 526 | if progdep: |
503 | deps.append(progdep) | 527 | deps.append(progdep) |
504 | else: | 528 | elif progdep is None: |
505 | if not prog.startswith('$'): | 529 | if not prog.startswith('$'): |
506 | unmapped.append(prog) | 530 | unmapped.append(prog) |
507 | elif keyword == 'AC_CHECK_LIB': | 531 | elif keyword == 'AC_CHECK_LIB': |