summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-08-01 15:18:18 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-02 17:07:21 +0100
commit9461854a3cf64a1d8fbf0248140d91bbd0a8e054 (patch)
tree0df35d4cb8e57322f01d1716590901149dbf70c4 /bitbake
parent94f57a169e393f659184f1d7a4df01f175521c1e (diff)
downloadpoky-9461854a3cf64a1d8fbf0248140d91bbd0a8e054.tar.gz
bitbake: contrib/dump_cache.py: dump recipe -> packages mapping from bb_cache.dat
Add the dump_cache.py to dump the "recipe -> packages" mapping for target recipes form bb_cache.dat: * Usage: dump_cache.py bb_cache.dat * The format is: recipe_path pn pv packages For example: /path/to/gzip_1.5.bb gzip 1.5 gzip-dbg gzip-staticdev gzip-dev gzip-doc gzip-locale gzip * Only save the mapping for the target recipe * We can extend this to dump other informations when needed. * Put this script to bitbake/contrib/ (not to oe-core) is because it needs the bb.cache. [YOCTO #2741] (Bitbake rev: 75a7caf6f2d9f4399c95b9249db1b3bc5a48dc61) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bitbake/contrib/dump_cache.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/bitbake/bitbake/contrib/dump_cache.py b/bitbake/bitbake/contrib/dump_cache.py
new file mode 100755
index 0000000000..e1f23090b9
--- /dev/null
+++ b/bitbake/bitbake/contrib/dump_cache.py
@@ -0,0 +1,68 @@
1#!/usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4#
5# Copyright (C) 2012 Wind River Systems, Inc.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20#
21# This is used for dumping the bb_cache.dat, the output format is:
22# recipe_path PN PV PACKAGES
23#
24import os
25import sys
26import warnings
27
28# For importing bb.cache
29sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '../lib'))
30from bb.cache import CoreRecipeInfo
31
32import cPickle as pickle
33
34def main(argv=None):
35 """
36 Get the mapping for the target recipe.
37 """
38 if len(argv) != 1:
39 print >>sys.stderr, "Error, need one argument!"
40 return 2
41
42 cachefile = argv[0]
43
44 with open(cachefile, "rb") as cachefile:
45 pickled = pickle.Unpickler(cachefile)
46 while cachefile:
47 try:
48 key = pickled.load()
49 val = pickled.load()
50 except Exception:
51 break
52 if isinstance(val, CoreRecipeInfo) and (not val.skipped):
53 pn = val.pn
54 # Filter out the native recipes.
55 if key.startswith('virtual:native:') or pn.endswith("-native"):
56 continue
57
58 # 1.0 is the default version for a no PV recipe.
59 if val.__dict__.has_key("pv"):
60 pv = val.pv
61 else:
62 pv = "1.0"
63
64 print("%s %s %s %s" % (key, pn, pv, ' '.join(val.packages)))
65
66if __name__ == "__main__":
67 sys.exit(main(sys.argv[1:]))
68