bitbake: bitbake: cooker: get extra information from recipe cache

The loaded cache modules may add extra attributes to
the recipecache, that will be populated by the cache
classes required by the UI. These attributes
will be used by the UI to display relevant information.

Adds cachefields cache class field to specify
for each cache class which attributes will be set
in the recipecache.

Adds code to automatically expand depends tree with the
fields exported by the extra cache class.

Fixes a cache field name in the HOB UI.

(Bitbake rev: 47c171005fb3803d936e65fcd4436c643883ae16)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN 2013-09-18 13:15:50 +01:00 committed by Richard Purdie
parent 5ee82d4048
commit 0c51d610e1
3 changed files with 36 additions and 22 deletions

View File

@ -35,6 +35,12 @@ class HobRecipeInfo(RecipeInfoCommon):
# such as (bb_cache.dat, bb_extracache_hob.dat) # such as (bb_cache.dat, bb_extracache_hob.dat)
cachefile = "bb_extracache_" + classname +".dat" cachefile = "bb_extracache_" + classname +".dat"
# override this member with the list of extra cache fields
# that this class will provide
cachefields = ['summary', 'license', 'section',
'description', 'homepage', 'bugtracker',
'prevision', 'files_info']
def __init__(self, filename, metadata): def __init__(self, filename, metadata):
self.summary = self.getvar('SUMMARY', metadata) self.summary = self.getvar('SUMMARY', metadata)

View File

@ -481,6 +481,19 @@ class BBCooker:
depend_tree["pn"][pn] = {} depend_tree["pn"][pn] = {}
depend_tree["pn"][pn]["filename"] = fn depend_tree["pn"][pn]["filename"] = fn
depend_tree["pn"][pn]["version"] = version depend_tree["pn"][pn]["version"] = version
# if we have extra caches, list all attributes they bring in
extra_info = []
for cache_class in self.caches_array:
if type(cache_class) is type and issubclass(cache_class, bb.cache.RecipeInfoCommon) and hasattr(cache_class, 'cachefields'):
cachefields = getattr(cache_class, 'cachefields', [])
extra_info = extra_info + cachefields
# for all attributes stored, add them to the dependency tree
for ei in extra_info:
depend_tree["pn"][pn][ei] = vars(self.recipecache)[ei][fn]
for dep in rq.rqdata.runq_depends[task]: for dep in rq.rqdata.runq_depends[task]:
depfn = taskdata.fn_index[rq.rqdata.runq_fnid[dep]] depfn = taskdata.fn_index[rq.rqdata.runq_fnid[dep]]
deppn = self.recipecache.pkg_fn[depfn] deppn = self.recipecache.pkg_fn[depfn]
@ -543,35 +556,30 @@ class BBCooker:
depend_tree["rdepends-pkg"] = {} depend_tree["rdepends-pkg"] = {}
depend_tree["rrecs-pkg"] = {} depend_tree["rrecs-pkg"] = {}
# if we have extra caches, list all attributes they bring in
extra_info = []
for cache_class in self.caches_array:
if type(cache_class) is type and issubclass(cache_class, bb.cache.RecipeInfoCommon) and hasattr(cache_class, 'cachefields'):
cachefields = getattr(cache_class, 'cachefields', [])
extra_info = extra_info + cachefields
for task in xrange(len(tasks_fnid)): for task in xrange(len(tasks_fnid)):
fnid = tasks_fnid[task] fnid = tasks_fnid[task]
fn = taskdata.fn_index[fnid] fn = taskdata.fn_index[fnid]
pn = self.recipecache.pkg_fn[fn] pn = self.recipecache.pkg_fn[fn]
version = "%s:%s-%s" % self.recipecache.pkg_pepvpr[fn]
summary = self.recipecache.summary[fn]
lic = self.recipecache.license[fn]
section = self.recipecache.section[fn]
description = self.recipecache.description[fn]
homepage = self.recipecache.homepage[fn]
bugtracker = self.recipecache.bugtracker[fn]
files_info = self.recipecache.files_info[fn]
rdepends = self.recipecache.rundeps[fn]
rrecs = self.recipecache.runrecs[fn]
prevision = self.recipecache.prevision[fn]
inherits = self.recipecache.inherits.get(fn, None)
if pn not in depend_tree["pn"]: if pn not in depend_tree["pn"]:
depend_tree["pn"][pn] = {} depend_tree["pn"][pn] = {}
depend_tree["pn"][pn]["filename"] = fn depend_tree["pn"][pn]["filename"] = fn
version = "%s:%s-%s" % self.recipecache.pkg_pepvpr[fn]
depend_tree["pn"][pn]["version"] = version depend_tree["pn"][pn]["version"] = version
depend_tree["pn"][pn]["summary"] = summary rdepends = self.recipecache.rundeps[fn]
depend_tree["pn"][pn]["license"] = lic rrecs = self.recipecache.runrecs[fn]
depend_tree["pn"][pn]["section"] = section depend_tree["pn"][pn]["inherits"] = self.recipecache.inherits.get(fn, None)
depend_tree["pn"][pn]["description"] = description
depend_tree["pn"][pn]["inherits"] = inherits # for all extra attributes stored, add them to the dependency tree
depend_tree["pn"][pn]["homepage"] = homepage for ei in extra_info:
depend_tree["pn"][pn]["bugtracker"] = bugtracker depend_tree["pn"][pn][ei] = vars(self.recipecache)[ei][fn]
depend_tree["pn"][pn]["files_info"] = files_info
depend_tree["pn"][pn]["revision"] = prevision
if fnid not in seen_fnids: if fnid not in seen_fnids:
seen_fnids.append(fnid) seen_fnids.append(fnid)

View File

@ -690,7 +690,7 @@ class RecipeListModel(gtk.ListStore):
inherits = event_model["pn"][item]["inherits"] inherits = event_model["pn"][item]["inherits"]
summary = event_model["pn"][item]["summary"] summary = event_model["pn"][item]["summary"]
version = event_model["pn"][item]["version"] version = event_model["pn"][item]["version"]
revision = event_model["pn"][item]["revision"] revision = event_model["pn"][item]["prevision"]
homepage = event_model["pn"][item]["homepage"] homepage = event_model["pn"][item]["homepage"]
bugtracker = event_model["pn"][item]["bugtracker"] bugtracker = event_model["pn"][item]["bugtracker"]
filename = event_model["pn"][item]["filename"] filename = event_model["pn"][item]["filename"]