1# 2# Extra RecipeInfo will be all defined in this file. Currently, 3# Only Hob (Image Creator) Requests some extra fields. So 4# HobRecipeInfo is defined. It's named HobRecipeInfo because it 5# is introduced by 'hob'. Users could also introduce other 6# RecipeInfo or simply use those already defined RecipeInfo. 7# In the following patch, this newly defined new extra RecipeInfo 8# will be dynamically loaded and used for loading/saving the extra 9# cache fields 10 11# Copyright (C) 2011, Intel Corporation. All rights reserved. 12 13# SPDX-License-Identifier: GPL-2.0-only 14# 15 16from bb.cache import RecipeInfoCommon 17 18class HobRecipeInfo(RecipeInfoCommon): 19 __slots__ = () 20 21 classname = "HobRecipeInfo" 22 # please override this member with the correct data cache file 23 # such as (bb_cache.dat, bb_extracache_hob.dat) 24 cachefile = "bb_extracache_" + classname +".dat" 25 26 # override this member with the list of extra cache fields 27 # that this class will provide 28 cachefields = ['summary', 'license', 'section', 29 'description', 'homepage', 'bugtracker', 30 'prevision', 'files_info'] 31 32 def __init__(self, filename, metadata): 33 34 self.summary = self.getvar('SUMMARY', metadata) 35 self.license = self.getvar('LICENSE', metadata) 36 self.section = self.getvar('SECTION', metadata) 37 self.description = self.getvar('DESCRIPTION', metadata) 38 self.homepage = self.getvar('HOMEPAGE', metadata) 39 self.bugtracker = self.getvar('BUGTRACKER', metadata) 40 self.prevision = self.getvar('PR', metadata) 41 self.files_info = self.getvar('FILES_INFO', metadata) 42 43 @classmethod 44 def init_cacheData(cls, cachedata): 45 # CacheData in Hob RecipeInfo Class 46 cachedata.summary = {} 47 cachedata.license = {} 48 cachedata.section = {} 49 cachedata.description = {} 50 cachedata.homepage = {} 51 cachedata.bugtracker = {} 52 cachedata.prevision = {} 53 cachedata.files_info = {} 54 55 def add_cacheData(self, cachedata, fn): 56 cachedata.summary[fn] = self.summary 57 cachedata.license[fn] = self.license 58 cachedata.section[fn] = self.section 59 cachedata.description[fn] = self.description 60 cachedata.homepage[fn] = self.homepage 61 cachedata.bugtracker[fn] = self.bugtracker 62 cachedata.prevision[fn] = self.prevision 63 cachedata.files_info[fn] = self.files_info 64