1# Copyright (C) 2016-2018 Wind River Systems, Inc. 2# 3# SPDX-License-Identifier: GPL-2.0-only 4# 5# The file contains: 6# LayerIndex exceptions 7# Plugin base class 8# Utility Functions for working on layerindex data 9 10import logging 11 12logger = logging.getLogger('BitBake.layerindexlib.plugin') 13 14class LayerIndexPluginException(Exception): 15 """LayerIndex Generic Exception""" 16 def __init__(self, message): 17 self.msg = message 18 Exception.__init__(self, message) 19 20 def __str__(self): 21 return self.msg 22 23class LayerIndexPluginUrlError(LayerIndexPluginException): 24 """Exception raised when a plugin does not support a given URL type""" 25 def __init__(self, plugin, url): 26 msg = "%s does not support %s:" % (plugin, url) 27 self.plugin = plugin 28 self.url = url 29 LayerIndexPluginException.__init__(self, msg) 30 31class IndexPlugin(): 32 def __init__(self): 33 self.type = None 34 35 def init(self, layerindex): 36 self.layerindex = layerindex 37 38 def plugin_type(self): 39 return self.type 40 41 def load_index(self, uri): 42 raise NotImplementedError('load_index is not implemented') 43 44 def store_index(self, uri, index): 45 raise NotImplementedError('store_index is not implemented') 46 47