summaryrefslogtreecommitdiffstats
path: root/lib/bb/cache_extra.py
diff options
context:
space:
mode:
authorLiping Ke <liping.ke@intel.com>2011-06-03 08:20:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-07 22:36:59 +0100
commit75d9add923560af9fdd772a363c68337d2c9a97d (patch)
tree21e0fffbb9398aa46116d08e4ad93b156f37dd0b /lib/bb/cache_extra.py
parentf0f53506926a3f79181796dde177f11f0a396b75 (diff)
downloadbitbake-contrib-75d9add923560af9fdd772a363c68337d2c9a97d.tar.gz
cache: Introduce extra cache class for image creator
Extra RecipeInfo will be all defined in this file. Currently, Only Hob (Image Creator) Requests some extra fields. So HobRecipeInfo is defined. It's named HobRecipeInfo because it is introduced by 'hob'. Users could also introduce other RecipeInfo or simply use those already defined RecipeInfo. In the following patch, this newly defined new extra RecipeInfo will be dynamically loaded and used for loading/saving the extra cache fields. Signed-off-by: Liping Ke <liping.ke@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cache_extra.py')
-rw-r--r--lib/bb/cache_extra.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/bb/cache_extra.py b/lib/bb/cache_extra.py
new file mode 100644
index 000000000..4c8841f85
--- /dev/null
+++ b/lib/bb/cache_extra.py
@@ -0,0 +1,54 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# Extra RecipeInfo will be all defined in this file. Currently,
+# Only Hob (Image Creator) Requests some extra fields. So
+# HobRecipeInfo is defined. It's named HobRecipeInfo because it
+# is introduced by 'hob'. Users could also introduce other
+# RecipeInfo or simply use those already defined RecipeInfo.
+# In the following patch, this newly defined new extra RecipeInfo
+# will be dynamically loaded and used for loading/saving the extra
+# cache fields
+
+# Copyright (C) 2011, Intel Corporation. All rights reserved.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from bb.cache import RecipeInfoCommon
+
+class HobRecipeInfo(RecipeInfoCommon):
+ __slots__ = ()
+
+ classname = "HobRecipeInfo"
+ # please override this member with the correct data cache file
+ # such as (bb_cache.dat, bb_extracache_hob.dat)
+ cachefile = "bb_extracache_" + classname +".dat"
+
+ def __init__(self, filename, metadata):
+
+ self.summary = self.getvar('SUMMARY', metadata)
+ self.license = self.getvar('LICENSE', metadata)
+ self.section = self.getvar('SECTION', metadata)
+
+ @classmethod
+ def init_cacheData(cls, cachedata):
+ # CacheData in Hob RecipeInfo Class
+ cachedata.summary = {}
+ cachedata.license = {}
+ cachedata.section = {}
+
+ def add_cacheData(self, cachedata, fn):
+ cachedata.summary[fn] = self.summary
+ cachedata.license[fn] = self.license
+ cachedata.section[fn] = self.section