diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-10-18 14:52:10 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-10-29 10:41:35 +0000 |
commit | 6ce287937e86a43d696e3615aa18d439928b7691 (patch) | |
tree | 3ee4736a085396a2dadfa4a056f2274fb2d794d3 /scripts/oe-pkgdata-util | |
parent | 948a714767833948927ee2e24ef303e56df5ba99 (diff) | |
download | poky-6ce287937e86a43d696e3615aa18d439928b7691.tar.gz |
scripts/oe-pkgdata-util: add ability to find a recipe from a target package
Add a "lookup-recipe" command to show which recipe produced a particular
package.
(From OE-Core rev: 4ab561ac3df105b4b6487271b6ccc29445518d52)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-pkgdata-util')
-rwxr-xr-x | scripts/oe-pkgdata-util | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index 08773e9b05..80cacc5b66 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -219,6 +219,38 @@ def lookup_pkg(args, usage): | |||
219 | items.extend(mappings.get(pkg, [])) | 219 | items.extend(mappings.get(pkg, [])) |
220 | print '\n'.join(items) | 220 | print '\n'.join(items) |
221 | 221 | ||
222 | def lookup_recipe(args, usage): | ||
223 | if len(args) < 2: | ||
224 | usage() | ||
225 | sys.exit(1) | ||
226 | |||
227 | pkgdata_dir = args[0] | ||
228 | pkgs = args[1].split() | ||
229 | |||
230 | if not os.path.exists(pkgdata_dir): | ||
231 | print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) | ||
232 | sys.exit(1) | ||
233 | |||
234 | mappings = defaultdict(list) | ||
235 | for pkg in pkgs: | ||
236 | pkgfile = os.path.join(pkgdata_dir, 'runtime-reverse', pkg) | ||
237 | if os.path.exists(pkgfile): | ||
238 | with open(pkgfile, 'r') as f: | ||
239 | for line in f: | ||
240 | fields = line.rstrip().split(': ') | ||
241 | if fields[0] == 'PN': | ||
242 | mappings[pkg].append(fields[1]) | ||
243 | break | ||
244 | if len(mappings) < len(pkgs): | ||
245 | missing = list(set(pkgs) - set(mappings.keys())) | ||
246 | sys.stderr.write("ERROR: the following packages could not be found: %s\n" % ', '.join(missing)) | ||
247 | sys.exit(1) | ||
248 | |||
249 | items = [] | ||
250 | for pkg in pkgs: | ||
251 | items.extend(mappings.get(pkg, [])) | ||
252 | print '\n'.join(items) | ||
253 | |||
222 | def find_path(args, usage): | 254 | def find_path(args, usage): |
223 | if len(args) < 2: | 255 | if len(args) < 2: |
224 | usage() | 256 | usage() |
@@ -263,6 +295,9 @@ Available commands: | |||
263 | lookup-pkg <pkgdatadir> "<recipe-pkgs>" | 295 | lookup-pkg <pkgdatadir> "<recipe-pkgs>" |
264 | look up the specified recipe-space package name(s) to see what the | 296 | look up the specified recipe-space package name(s) to see what the |
265 | final runtime package name is (e.g. eglibc becomes libc6) | 297 | final runtime package name is (e.g. eglibc becomes libc6) |
298 | lookup-recipe <pkgdatadir> "<pkgs>" | ||
299 | look up the specified package(s) to see which recipe they were | ||
300 | produced by | ||
266 | find-path <pkgdatadir> <path> | 301 | find-path <pkgdatadir> <path> |
267 | find the package providing the specified path (wildcards * ? allowed) | 302 | find the package providing the specified path (wildcards * ? allowed) |
268 | read-value <pkgdatadir> <value-name> "<pkgs>" | 303 | read-value <pkgdatadir> <value-name> "<pkgs>" |
@@ -284,6 +319,8 @@ Available commands: | |||
284 | glob(args[1:], parser.print_help) | 319 | glob(args[1:], parser.print_help) |
285 | elif args[0] == "lookup-pkg": | 320 | elif args[0] == "lookup-pkg": |
286 | lookup_pkg(args[1:], parser.print_help) | 321 | lookup_pkg(args[1:], parser.print_help) |
322 | elif args[0] == "lookup-recipe": | ||
323 | lookup_recipe(args[1:], parser.print_help) | ||
287 | elif args[0] == "find-path": | 324 | elif args[0] == "find-path": |
288 | find_path(args[1:], parser.print_help) | 325 | find_path(args[1:], parser.print_help) |
289 | elif args[0] == "read-value": | 326 | elif args[0] == "read-value": |