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.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.py')
-rw-r--r-- | scripts/lib/recipetool/create.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 3e4bab8afe..7560cdf7cc 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -43,6 +43,7 @@ def tinfoil_init(instance): | |||
43 | class RecipeHandler(object): | 43 | class RecipeHandler(object): |
44 | recipelibmap = {} | 44 | recipelibmap = {} |
45 | recipeheadermap = {} | 45 | recipeheadermap = {} |
46 | recipecmakefilemap = {} | ||
46 | 47 | ||
47 | @staticmethod | 48 | @staticmethod |
48 | def load_libmap(d): | 49 | def load_libmap(d): |
@@ -90,15 +91,18 @@ class RecipeHandler(object): | |||
90 | RecipeHandler.recipelibmap['GLESv2'] = 'virtual/libgles2' | 91 | RecipeHandler.recipelibmap['GLESv2'] = 'virtual/libgles2' |
91 | 92 | ||
92 | @staticmethod | 93 | @staticmethod |
93 | def load_headermap(d): | 94 | def load_devel_filemap(d): |
94 | '''Build up lib headerfile->recipe mapping''' | 95 | '''Build up development file->recipe mapping''' |
95 | if RecipeHandler.recipeheadermap: | 96 | if RecipeHandler.recipeheadermap: |
96 | return | 97 | return |
98 | pkgdata_dir = d.getVar('PKGDATA_DIR', True) | ||
97 | includedir = d.getVar('includedir', True) | 99 | includedir = d.getVar('includedir', True) |
100 | cmakedir = os.path.join(d.getVar('libdir', True), 'cmake') | ||
98 | for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')): | 101 | for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')): |
99 | with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: | 102 | with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: |
100 | pn = None | 103 | pn = None |
101 | headers = [] | 104 | headers = [] |
105 | cmakefiles = [] | ||
102 | for line in f: | 106 | for line in f: |
103 | if line.startswith('PN:'): | 107 | if line.startswith('PN:'): |
104 | pn = line.split(':', 1)[-1].strip() | 108 | pn = line.split(':', 1)[-1].strip() |
@@ -108,9 +112,14 @@ class RecipeHandler(object): | |||
108 | for fullpth in sorted(dictval): | 112 | for fullpth in sorted(dictval): |
109 | if fullpth.startswith(includedir) and fullpth.endswith('.h'): | 113 | if fullpth.startswith(includedir) and fullpth.endswith('.h'): |
110 | headers.append(os.path.relpath(fullpth, includedir)) | 114 | headers.append(os.path.relpath(fullpth, includedir)) |
115 | elif fullpth.startswith(cmakedir) and fullpth.endswith('.cmake'): | ||
116 | cmakefiles.append(os.path.relpath(fullpth, cmakedir)) | ||
111 | if pn and headers: | 117 | if pn and headers: |
112 | for header in headers: | 118 | for header in headers: |
113 | RecipeHandler.recipeheadermap[header] = pn | 119 | RecipeHandler.recipeheadermap[header] = pn |
120 | if pn and cmakefiles: | ||
121 | for fn in cmakefiles: | ||
122 | RecipeHandler.recipecmakefilemap[fn] = pn | ||
114 | 123 | ||
115 | @staticmethod | 124 | @staticmethod |
116 | def checkfiles(path, speclist, recursive=False): | 125 | def checkfiles(path, speclist, recursive=False): |
@@ -172,7 +181,7 @@ class RecipeHandler(object): | |||
172 | deps.append(recipe) | 181 | deps.append(recipe) |
173 | elif recipe is None: | 182 | elif recipe is None: |
174 | if header: | 183 | if header: |
175 | RecipeHandler.load_headermap(d) | 184 | RecipeHandler.load_devel_filemap(d) |
176 | recipe = RecipeHandler.recipeheadermap.get(header, None) | 185 | recipe = RecipeHandler.recipeheadermap.get(header, None) |
177 | if recipe: | 186 | if recipe: |
178 | deps.append(recipe) | 187 | deps.append(recipe) |